Skip to content

Commit

Permalink
fix removing is_active node after re-creation
Browse files Browse the repository at this point in the history
  • Loading branch information
tavplubix committed Mar 8, 2024
1 parent d93dd98 commit e231747
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
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
2 changes: 2 additions & 0 deletions tests/integration/test_replicated_database/test.py
Expand Up @@ -1141,6 +1141,8 @@ 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

0 comments on commit e231747

Please sign in to comment.