diff --git a/src/Storages/MergeTree/ReplicatedMergeTreeSink.cpp b/src/Storages/MergeTree/ReplicatedMergeTreeSink.cpp index b43d47bf5f4..91f85cbd87d 100644 --- a/src/Storages/MergeTree/ReplicatedMergeTreeSink.cpp +++ b/src/Storages/MergeTree/ReplicatedMergeTreeSink.cpp @@ -940,14 +940,25 @@ std::pair, bool> ReplicatedMergeTreeSinkImpl:: }); bool node_exists = false; + bool quorum_fail_exists = false; /// The loop will be executed at least once new_retry_controller.retryLoop([&] { fiu_do_on(FailPoints::replicated_merge_tree_commit_zk_fail_when_recovering_from_hw_fault, { zookeeper->forceFailureBeforeOperation(); }); zookeeper->setKeeper(storage.getZooKeeper()); node_exists = zookeeper->exists(fs::path(storage.replica_path) / "parts" / part->name); + if (isQuorumEnabled()) + quorum_fail_exists = zookeeper->exists(fs::path(storage.zookeeper_path) / "quorum" / "failed_parts" / part->name); }); + /// if it has quorum fail node, the restarting thread will clean the garbage. + if (quorum_fail_exists) + { + LOG_INFO(log, "Part {} fails to commit and will not retry or clean garbage. Restarting Thread will do everything.", part->name); + transaction.clear(); + return CommitRetryContext::ERROR; + } + if (node_exists) { LOG_DEBUG(log, "Insert of part {} recovered from keeper successfully. It will be committed", part->name);