[MISC] Check that the watcher is connected#18
Open
dragomirp wants to merge 5 commits into
Open
Conversation
dragomirp
commented
May 22, 2026
| logger.info(f"Raft controller configured: self={self_addr}, partners={partner_addrs}") | ||
| return True | ||
|
|
||
| def start(self) -> bool: |
dragomirp
commented
May 22, 2026
Comment on lines
+13
to
+14
| StartLimitBurst=10 | ||
| StartLimitIntervalSec=30 |
Contributor
Author
There was a problem hiding this comment.
To not be rate limited by systemd.
dragomirp
commented
May 22, 2026
| logger.debug(f"Observer raft: {raft_status}") | ||
| for key in raft_status: | ||
| if key.startswith(RAFT_PARTNER_PREFIX) and raft_status[key] == 2: | ||
| enabled = True |
Contributor
Author
There was a problem hiding this comment.
If at least one partner connection is detected, the watcher should have started correctly.
dragomirp
commented
May 22, 2026
| for addr in partner_addrs: | ||
| try: | ||
| logger.debug( | ||
| f"{addr} Raft: {syncobj_util.executeCommand(f'{addr}:{RAFT_PORT}', ['status'])}" |
Contributor
Author
There was a problem hiding this comment.
Sanity check to make sure that at least one of the expected partners is up.
dragomirp
commented
May 22, 2026
| # Assign next available port starting from RAFT_PORT | ||
| used_ports = set(allocations.values()) | ||
| port = RAFT_PORT + 1 | ||
| port = RAFT_PORT |
Contributor
Author
There was a problem hiding this comment.
Reverting to 2222, for easier firewall management in single cluster watcher setups.
marceloneppel
previously approved these changes
May 22, 2026
9247128
dragomirp
commented
May 22, 2026
| return False | ||
|
|
||
| def get_stale_watchers( | ||
| def cleanup_raft_cluster( |
Contributor
Author
There was a problem hiding this comment.
Ported cleanup from the PG charm.
dragomirp
commented
May 22, 2026
Comment on lines
-282
to
-284
| key.startswith(RAFT_PARTNER_PREFIX) | ||
| and key.endswith(port_postfix) | ||
| and key != watcher_key |
Contributor
Author
There was a problem hiding this comment.
Too aggressive if port is shared with the PG charm.
dragomirp
commented
May 22, 2026
| # Get the status of the raft cluster. | ||
| syncobj_util = TcpUtility(password=raft_password, timeout=3) | ||
|
|
||
| for raft_host in [watcher_addr, *[f"{addr}:{RAFT_PORT}" for addr in partner_addrs]]: |
Contributor
Author
There was a problem hiding this comment.
Diff from PG. Looping over all the nodes to clean up.
taurus-forever
approved these changes
May 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.