mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-20 00:30:49 +00:00
Merge pull request #24957 from ClickHouse/fix_endless_wait
Fix endless wait in replica clone
This commit is contained in:
commit
f59f444ac6
@ -2647,24 +2647,6 @@ void StorageReplicatedMergeTree::cloneReplica(const String & source_replica, Coo
|
||||
{
|
||||
String source_path = fs::path(zookeeper_path) / "replicas" / source_replica;
|
||||
|
||||
/** TODO: it will be deleted! (It is only to support old version of CH server).
|
||||
* In current code, the replica is created in single transaction.
|
||||
* If the reference/master replica is not yet fully created, let's wait.
|
||||
*/
|
||||
while (!zookeeper->exists(fs::path(source_path) / "columns"))
|
||||
{
|
||||
LOG_INFO(log, "Waiting for replica {} to be fully created", source_path);
|
||||
|
||||
zkutil::EventPtr event = std::make_shared<Poco::Event>();
|
||||
if (zookeeper->exists(fs::path(source_path) / "columns", nullptr, event))
|
||||
{
|
||||
LOG_WARNING(log, "Oops, a watch has leaked");
|
||||
break;
|
||||
}
|
||||
|
||||
event->wait();
|
||||
}
|
||||
|
||||
/// The order of the following three actions is important.
|
||||
|
||||
Strings source_queue_names;
|
||||
|
Loading…
Reference in New Issue
Block a user