-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DPE-2654 profile-limits option #331
Conversation
Codecov Report
@@ Coverage Diff @@
## main #331 +/- ##
==========================================
+ Coverage 64.01% 64.50% +0.48%
==========================================
Files 16 17 +1
Lines 2993 3113 +120
Branches 389 413 +24
==========================================
+ Hits 1916 2008 +92
- Misses 955 979 +24
- Partials 122 126 +4
|
dpe-2654-profile-limit-option # Conflicts: # lib/charms/mysql/v0/mysql.py # src/charm.py # src/mysql_vm_helpers.py
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice. The new code it way more pleasant to read!
One question inside, and I hope the answer there is "no", so LGTM.
self.app_peer_data.setdefault( | ||
"cluster-name", self.config.cluster_name or f"cluster-{common_hash}" | ||
) | ||
self.app_peer_data.setdefault("cluster-set-domain-name", f"cluster-set-{common_hash}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Q: will we overwrite cluster-name
and cluster-set-domain-name
on the leader move (re-elected)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
by using setdefault
we avoid overwriting it
|
||
# escape variable values when needed | ||
if not re.match(r"^[0-9,a-z,A-Z$_]+$", value): | ||
value = f"`{value}`" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
any reason not to always escape?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also do you need to check that
`
is not in the string?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not really: 096fe7f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
actually, we cannot escape always - number will fail. rolledback on ea0ecb9
self._mysql.write_content_to_file( | ||
path=MYSQLD_CUSTOM_CONFIG_FILE, content=new_config_content | ||
) | ||
self.on[f"{self.restart.name}"].acquire_lock.emit() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
self.on[f"{self.restart.name}"].acquire_lock.emit() | |
self.on[self.restart.name].acquire_lock.emit() |
nit
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's like that to shut the linter - self.restart.name
is typed ad AnyStr
and key should be str
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggest str()
instead of f-string
src/charm.py
Outdated
# the upgrade already restart the daemon | ||
return | ||
|
||
if not self._mysql.is_mysqld_running: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is not a property. should we add ()
to invoke the method?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lib/charms/mysql/v0/mysql.py
Outdated
@@ -116,15 +116,17 @@ def wait_until_mysql_connection(self) -> None: | |||
|
|||
# Increment this PATCH version before using `charmcraft publish-lib` or reset | |||
# to 0 if you are raising the major API version | |||
LIBPATCH = 49 | |||
LIBPATCH = 50 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please update to 51 as another PR was merged with libpatch 50
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
096fe7f
@@ -773,8 +762,18 @@ def _join_unit_to_cluster(self) -> None: | |||
self.unit.status = WaitingStatus("waiting to join the cluster") | |||
logger.debug("Waiting to joing the cluster, failed to acquire lock.") | |||
|
|||
def _restart(self, _: EventBase) -> None: | |||
def _restart(self, event: EventBase) -> None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: not all events that isinstance EventBase can be deferred
merging besides the CI error - test passed previously, failing due disk full error. Deal with it on another PR |
Issue
Solution
profile-limit-memory
config optiondata-models
lib for config validationrollingOps
lib for workload restart orchestration, when the changed configs requires.Chore
get_available_memory
to be simplerrelations/mysql.py
data-models
lib