mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-27 18:12:02 +00:00
fix logical-error when undoing quorum insert transaction
This commit is contained in:
parent
233a75505b
commit
97fca6682e
@ -940,14 +940,25 @@ std::pair<std::vector<String>, bool> ReplicatedMergeTreeSinkImpl<async_insert>::
|
||||
});
|
||||
|
||||
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);
|
||||
|
Loading…
Reference in New Issue
Block a user