Skip to content
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

feature(raft): Rolling restart raft topology coordinator node #9102

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

aleksbykov
Copy link
Contributor

@aleksbykov aleksbykov commented Oct 31, 2024

When current topology coordinator is not available, new round
of election of new coordinator should be started and new
raft topology coordinator node will be elected.

Added new function to search current coordinator node
Added new nemesis to Rolling restart of elected coordinator node

Testing

PR pre-checks (self review)

  • I added the relevant backport labels
  • I didn't leave commented-out/debugging code

Reminders

  • Add New configuration option and document them (in sdcm/sct_config.py)
  • Add unit tests to cover my changes (under unit-test/ folder)
  • Update the Readme/doc folder relevant to this change (if needed)

@aleksbykov aleksbykov force-pushed the find-kill-topology-coordinator branch from a231f16 to ee78519 Compare November 1, 2024 09:28
@aleksbykov aleksbykov added backport/2024.2 Need backport to 2024.2 backport/6.1 Need backport to 6.1 backport/6.2 labels Nov 1, 2024
@aleksbykov aleksbykov marked this pull request as ready for review November 1, 2024 09:49
sdcm/nemesis.py Outdated
@@ -5151,6 +5151,35 @@ def disrupt_disable_binary_gossip_execute_major_compaction(self):
self.target_node.restart_scylla_server()
raise

def disrupt_rolling_restart_topology_coordinator_node(self):
Copy link
Contributor

Choose a reason for hiding this comment

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

the name rolling restart doesn't related to what going on with this nemesis

it's multiple restarts of the same node.

rolling means, all of the cluster is being restarted (one by one, hence where the rolling comes from)

Copy link
Contributor

Choose a reason for hiding this comment

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

@aleksbykov please update the PR headline and the commit headline, to match the name change

@@ -44,6 +50,27 @@ def validate_raft_on_nodes(nodes: list[BaseNode]) -> None:
LOGGER.debug("Raft is ready!")


def get_topology_coordinator_node(cluster: BaseScyllaCluster) -> BaseNode:
active_nodes = cluster.get_nodes_up_and_normal()
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe this function should be guarded with self.target_node.raft.is_consistent_topology_changes_enabled ?

to make sure it's not getting called when raft topology is disabled ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

added

Copy link
Contributor

@fruch fruch left a comment

Choose a reason for hiding this comment

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

Name of this nemesis should have rolling in it.

@aleksbykov
Copy link
Contributor Author

@soyacz , @fruch can you take a look?

sdcm/nemesis.py Outdated Show resolved Hide resolved
sdcm/nemesis.py Outdated Show resolved Hide resolved
sdcm/nemesis.py Outdated Show resolved Hide resolved
sdcm/nemesis.py Show resolved Hide resolved
sdcm/utils/raft/common.py Outdated Show resolved Hide resolved
@soyacz
Copy link
Contributor

soyacz commented Nov 8, 2024

[ Passed for PR ] (https://argus.scylladb.com/tests/scylla-cluster-tests/aa2a2300-e6bc-4d36-8081-b35ff7517523) - job failed due to cassandra, Nemesis functionality passed

Ins't it a Scylla issue?

Copy link
Contributor

@soyacz soyacz left a comment

Choose a reason for hiding this comment

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

Few more small issues, otherwise LGTM.

if we backport it, it will shuffle all nemesis lists on backported branches. Do we want that backported? cc @roydahan

sdcm/nemesis.py Show resolved Hide resolved
sdcm/nemesis.py Outdated
coordinator_node.start_scylla()
assert coordinator_node != new_coordinator_node, \
f"New coordinator node was not elected while old one {coordinator_node.name} was stopped"
self.unset_current_running_nemesis(coordinator_node)
Copy link
Contributor

Choose a reason for hiding this comment

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

let's unset before assert

Copy link
Contributor Author

Choose a reason for hiding this comment

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

agree. fixed

sdcm/nemesis.py Show resolved Hide resolved
@aleksbykov
Copy link
Contributor Author

Few more small issues, otherwise LGTM.

if we backport it, it will shuffle all nemesis lists on backported branches. Do we want that backported? cc @roydahan

i think we can live with it on master only

@aleksbykov
Copy link
Contributor Author

@aleksbykov
Copy link
Contributor Author

@fruch @soyacz can you review?

Copy link
Contributor

@soyacz soyacz left a comment

Choose a reason for hiding this comment

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

one more thing and good to go for me.

sdcm/nemesis.py Outdated
self.log.debug("Wait new topology coordinator election timeout: %s", election_wait_timeout)
self.unset_current_running_nemesis(self.target_node)
for _ in range(num_of_restarts):
self.target_node = coordinator_node = get_topology_coordinator_node(cluster=self.cluster)
Copy link
Contributor

Choose a reason for hiding this comment

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

we should set target node after verifying it's not running nemesis

Copy link
Contributor

Choose a reason for hiding this comment

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

we have machinery for selecting target_node, all selection of target nodes should work in similar fashion

see the logic of run_nemesis

doing so in multiple setup, is prone to errors and can lead to selection of the same target nodes from multiple nemesis threads, every selection should go via the same lock we introduced for that purpose

Copy link
Contributor

Choose a reason for hiding this comment

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

with run nemesis it's going to fail the test when coordinator node is one that currently runs nemesis due to assert free_nodes, f"couldn't find nodes for running:{nemesis_label}, are all nodes running nemesis ?"

When current topology coordinator is not available, new round
of election of new coordinator should be started and new
raft topology coordinator node will be elected.

Added new function to search current coordinator node
Added new nemesis to Rolling restart of elected coordinator node
Copy link
Contributor

@soyacz soyacz left a comment

Choose a reason for hiding this comment

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

LGTM

new_coordinator_node = get_topology_coordinator_node(cluster=self.cluster)
self.log.debug("New coordinator node: %s, %s", new_coordinator_node, new_coordinator_node.name)
coordinator_node.start_scylla()
self.unset_current_running_nemesis(coordinator_node)
Copy link
Contributor

Choose a reason for hiding this comment

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

if there was a failure you won't reach this, and would let go of that node, no more nemesis would run on it

we should use context manager (similar to run_nemesis), or try/finally clause here.

Copy link
Contributor

Choose a reason for hiding this comment

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

but won't nemesis mashinery unset running nemesis upon finishing? (that's why need to re-set target node each loop)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport/6.1 Need backport to 6.1 backport/6.2 backport/2024.2 Need backport to 2024.2
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants