-
Notifications
You must be signed in to change notification settings - Fork 14
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-3879 update endpoint on upgrade #426
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #426 +/- ##
==========================================
- Coverage 66.25% 65.98% -0.27%
==========================================
Files 17 17
Lines 3180 3199 +19
Branches 424 428 +4
==========================================
+ Hits 2107 2111 +4
- Misses 935 951 +16
+ Partials 138 137 -1 ☔ View full report in Codecov by Sentry. |
…pe-3879-update-endpoints-on-upgrade
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.
Thank you!
src/relations/mysql_provider.py
Outdated
# rw endpoints | ||
endpoints = ( | ||
self.database.fetch_my_relation_field(relation.id, "endpoints", DB_RELATION_NAME) | ||
or "" | ||
) | ||
if unit_address in endpoints: | ||
self.database.set_endpoints( | ||
relation.id, | ||
",".join([e for e in endpoints.split(",") if unit_address not in e]), | ||
) |
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.
can this set read-write endpoints to ""
?
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.
Yes, and it's intentional - a client app should be able to handle (and wait for the endpoint to be set)
# we assume the leader is primary, since the switchover is done on pre-upgrade-check | ||
self._primary_switchover() | ||
|
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.
question: if leader is not primary (e.g. switchover after pre-upgrade-check), will things break?
src/relations/mysql_provider.py
Outdated
@@ -309,3 +311,45 @@ def _on_database_provides_relation_departed(self, event: RelationDepartedEvent) | |||
logger.info(f"Removed router from metadata {user.router_id}") | |||
except MySQLRemoveRouterFromMetadataError: | |||
logger.error(f"Failed to remove router from metadata with ID {user.router_id}") | |||
|
|||
def remove_unit_from_endpoints(self, unit: Unit) -> 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.
where is this method being used?
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.
nowhere, removed. it would be useful if upgrade happened in distinct hook calls, which is not the case
Issue
Slow, no preemptive primary switchover on upgrade.
Solution
Add preemptive switchover where possible.