From a965438eea2893adfde24d77cc19a52fb834dda9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Mar=C3=ADn?= Date: Fri, 8 Jul 2022 13:57:53 +0200 Subject: [PATCH] clearOldLogs: Don't report errors on concurrent deletes --- .../ReplicatedMergeTreeCleanupThread.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Storages/MergeTree/ReplicatedMergeTreeCleanupThread.cpp b/src/Storages/MergeTree/ReplicatedMergeTreeCleanupThread.cpp index bdafe166e3ce..74e3d0881ff4 100644 --- a/src/Storages/MergeTree/ReplicatedMergeTreeCleanupThread.cpp +++ b/src/Storages/MergeTree/ReplicatedMergeTreeCleanupThread.cpp @@ -248,17 +248,17 @@ void ReplicatedMergeTreeCleanupThread::clearOldLogs() /// Simultaneously with clearing the log, we check to see if replica was added since we received replicas list. ops.emplace_back(zkutil::makeCheckRequest(storage.zookeeper_path + "/replicas", stat.version)); - try + Coordination::Responses responses; + Coordination::Error e = zookeeper->tryMulti(ops, responses); + + if (e == Coordination::Error::ZNONODE) { - zookeeper->multi(ops); + /// Another replica already deleted the same node concurrently. + break; } - catch (const zkutil::KeeperMultiException & e) + else { - /// Another replica already deleted the same node concurrently. - if (e.code == Coordination::Error::ZNONODE) - break; - - throw; + zkutil::KeeperMultiException::check(e, ops, responses); } ops.clear(); }