-
Notifications
You must be signed in to change notification settings - Fork 25
[DPE-5714] Filter out degraded read only endpoints #679
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
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #679 +/- ##
==========================================
+ Coverage 71.40% 71.49% +0.08%
==========================================
Files 13 13
Lines 3189 3199 +10
Branches 475 476 +1
==========================================
+ Hits 2277 2287 +10
Misses 797 797
Partials 115 115 ☔ View full report in Codecov by Sentry. 🚨 Try these New Features:
|
b69b4de
to
c2188c0
Compare
response = requests.get( | ||
f"{self._patroni_url}/cluster", | ||
verify=self.verify, | ||
auth=self._patroni_auth, | ||
timeout=PATRONI_TIMEOUT, | ||
) |
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.
I think that if the majority of units goes down, the cluster endpoint will stop being updated. Best to address this after the RAFT reinit PRs land.
replicas_endpoint = list(self.charm.members_ips - {self.charm.primary_endpoint}) | ||
replicas_endpoint.sort() | ||
cluster_state = self.charm._patroni.are_replicas_up() | ||
if cluster_state: |
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.
We are getting the primary endpoint just above, so we should be able to get the cluster endpoint as well, but if we can't, no filtering will be done.
FIRST_DATABASE_RELATION_NAME, | ||
"read-only-endpoints", | ||
) | ||
assert data is 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.
There are two units in the cluster, so there will be no readonly endpoints if the down unit is filtered out.
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.
LGTM!
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.
LGTM, but two points:
- Q: will we trigger DPlib events, so client app will react (restart) every time we add RO unit?
- BTW, did we agree on consensus with @delgod and @7annaba3l about adding RW as RO endpoint if the system has 1 unit only?
DPL should fire a separate event (
I don't think so, we can add it in a follow up PR. |
Currently, the charm sets all replica units as readonly endpoints to clients, no matter if the unit is functioning or not.
The PR adds filtering for the read only endpoints based on Patroni's cluster endpoint.