Fix mutaion status for retryable errors

This commit is contained in:
alesapin 2022-02-04 16:27:59 +03:00
parent 06499ce847
commit 1582c4bf24
4 changed files with 10 additions and 2 deletions

View File

@ -31,6 +31,7 @@ bool ReplicatedMergeMutateTaskBase::executeStep()
{
std::exception_ptr saved_exception;
bool retryable_error = false;
try
{
/// We don't have any backoff for failed entries
@ -46,16 +47,19 @@ bool ReplicatedMergeMutateTaskBase::executeStep()
{
/// If no one has the right part, probably not all replicas work; We will not write to log with Error level.
LOG_INFO(log, fmt::runtime(e.displayText()));
retryable_error = true;
}
else if (e.code() == ErrorCodes::ABORTED)
{
/// Interrupted merge or downloading a part is not an error.
LOG_INFO(log, fmt::runtime(e.message()));
retryable_error = true;
}
else if (e.code() == ErrorCodes::PART_IS_TEMPORARILY_LOCKED)
{
/// Part cannot be added temporarily
LOG_INFO(log, fmt::runtime(e.displayText()));
retryable_error = true;
storage.cleanup_thread.wakeup();
}
else
@ -80,7 +84,7 @@ bool ReplicatedMergeMutateTaskBase::executeStep()
}
if (saved_exception)
if (!retryable_error && saved_exception)
{
std::lock_guard lock(storage.queue.state_mutex);

View File

@ -1668,6 +1668,7 @@ bool ReplicatedMergeTreeQueue::tryFinalizeMutations(zkutil::ZooKeeperPtr zookeep
{
LOG_TRACE(log, "Marking mutation {} done because it is <= mutation_pointer ({})", znode, mutation_pointer);
mutation.is_done = true;
mutation.latest_fail_reason.clear();
alter_sequence.finishDataAlter(mutation.entry->alter_version, lock);
if (mutation.parts_to_do.size() != 0)
{
@ -1712,6 +1713,7 @@ bool ReplicatedMergeTreeQueue::tryFinalizeMutations(zkutil::ZooKeeperPtr zookeep
{
LOG_TRACE(log, "Mutation {} is done", entry->znode_name);
it->second.is_done = true;
it->second.latest_fail_reason.clear();
if (entry->isAlterMutation())
{
LOG_TRACE(log, "Finishing data alter with version {} for entry {}", entry->alter_version, entry->znode_name);

View File

@ -1,5 +1,5 @@
#!/usr/bin/env bash
# Tags: zookeeper, no-parallel
# Tags: zookeeper, no-parallel, no-s3-storage
# Because REPLACE PARTITION does not forces immediate removal of replaced data parts from local filesystem
# (it tries to do it as quick as possible, but it still performed in separate thread asynchronously)

View File

@ -1,3 +1,5 @@
-- Tags: no-s3-storage
DROP TABLE IF EXISTS data_01551;
CREATE TABLE data_01551