Skip to content

[MISC] Check that the watcher is connected#18

Open
dragomirp wants to merge 5 commits into
16/edgefrom
start-checker
Open

[MISC] Check that the watcher is connected#18
dragomirp wants to merge 5 commits into
16/edgefrom
start-checker

Conversation

@dragomirp
Copy link
Copy Markdown
Contributor

@dragomirp dragomirp commented May 19, 2026

  • Check RAFT connectivity when starting the observer
  • Revert watcher default port to 2222

@dragomirp dragomirp added the bug Something isn't working label May 19, 2026
Comment thread src/raft_controller.py
logger.info(f"Raft controller configured: self={self_addr}, partners={partner_addrs}")
return True

def start(self) -> bool:
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not used.

Comment on lines +13 to +14
StartLimitBurst=10
StartLimitIntervalSec=30
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To not be rate limited by systemd.

Comment thread src/raft_controller.py
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
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If at least one partner connection is detected, the watcher should have started correctly.

Comment thread src/raft_controller.py
for addr in partner_addrs:
try:
logger.debug(
f"{addr} Raft: {syncobj_util.executeCommand(f'{addr}:{RAFT_PORT}', ['status'])}"
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sanity check to make sure that at least one of the expected partners is up.

@dragomirp dragomirp marked this pull request as ready for review May 22, 2026 11:15
@dragomirp dragomirp requested a review from a team as a code owner May 22, 2026 11:15
@dragomirp dragomirp requested review from carlcsaposs-canonical, juju-charm-bot, marceloneppel and taurus-forever and removed request for a team May 22, 2026 11:15
taurus-forever
taurus-forever previously approved these changes May 22, 2026
Copy link
Copy Markdown
Contributor

@taurus-forever taurus-forever left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

# Assign next available port starting from RAFT_PORT
used_ports = set(allocations.values())
port = RAFT_PORT + 1
port = RAFT_PORT
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reverting to 2222, for easier firewall management in single cluster watcher setups.

marceloneppel
marceloneppel previously approved these changes May 22, 2026
@dragomirp dragomirp dismissed stale reviews from marceloneppel and taurus-forever via 9247128 May 22, 2026 14:26
Comment thread src/raft_controller.py
return False

def get_stale_watchers(
def cleanup_raft_cluster(
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ported cleanup from the PG charm.

Comment thread src/raft_controller.py
Comment on lines -282 to -284
key.startswith(RAFT_PARTNER_PREFIX)
and key.endswith(port_postfix)
and key != watcher_key
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Too aggressive if port is shared with the PG charm.

Comment thread src/raft_controller.py
# 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]]:
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Diff from PG. Looping over all the nodes to clean up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working Libraries: OK

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants