Skip to content

Commit 6531ff7

Browse files
authored
Merge pull request #43458 from ClickHouse/tavplubix-patch-5
Fix createTableSharedID again
2 parents 52d33ff + ad74961 commit 6531ff7

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/Storages/StorageReplicatedMergeTree.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7645,7 +7645,15 @@ void StorageReplicatedMergeTree::createTableSharedID() const
76457645
return;
76467646
}
76477647

7648-
auto zookeeper = getZooKeeper();
7648+
/// We may call getTableSharedID when table is shut down. If exception happen, restarting thread will be already turned
7649+
/// off and nobody will reconnect our zookeeper connection. In this case we use zookeeper connection from
7650+
/// context.
7651+
ZooKeeperPtr zookeeper;
7652+
if (shutdown_called.load())
7653+
zookeeper = getZooKeeperIfTableShutDown();
7654+
else
7655+
zookeeper = getZooKeeper();
7656+
76497657
String zookeeper_table_id_path = fs::path(zookeeper_path) / "table_shared_id";
76507658
String id;
76517659
if (!zookeeper->tryGet(zookeeper_table_id_path, id))

0 commit comments

Comments
 (0)