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

Fix removing is_active node after re-creation #61105

Merged
merged 5 commits into from Mar 21, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/Databases/DatabaseReplicatedWorker.cpp
Expand Up @@ -75,6 +75,8 @@ void DatabaseReplicatedDDLWorker::initializeReplication()
String active_path = fs::path(database->replica_path) / "active";
String active_id = toString(ServerUUID::get());
zookeeper->deleteEphemeralNodeIfContentMatches(active_path, active_id);
if (active_node_holder)
active_node_holder->setAlreadyRemoved();
zookeeper->create(active_path, active_id, zkutil::CreateMode::Ephemeral);
active_node_holder.reset();
active_node_holder_zookeeper = zookeeper;
Expand Down
4 changes: 4 additions & 0 deletions tests/integration/test_replicated_database/test.py
Expand Up @@ -1141,6 +1141,10 @@ def test_sync_replica(started_cluster):

dummy_node.query("SYSTEM SYNC DATABASE REPLICA test_sync_database")

assert "2\n" == main_node.query(
"SELECT sum(is_active) FROM system.clusters WHERE cluster='test_sync_database'"
)

assert dummy_node.query(
"SELECT count() FROM system.tables where database='test_sync_database'"
).strip() == str(number_of_tables)
Expand Down