Merge pull request #24957 from ClickHouse/fix_endless_wait

Fix endless wait in replica clone
This commit is contained in:
alexey-milovidov 2021-06-06 16:50:08 +03:00 committed by GitHub
commit f59f444ac6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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;