Check for "SYSTEM STOP MERGES" primarily for MERGE_PARTS/MUTATE_PART

Since after it will obtain part information (getPartIfExists()), that
will try to acquire DataPartsLock.

Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
This commit is contained in:
Azat Khuzhin 2024-03-27 12:52:29 +01:00
parent bce6817fcc
commit c1a44f887e

View File

@ -1337,6 +1337,13 @@ bool ReplicatedMergeTreeQueue::shouldExecuteLogEntry(
if (entry.type == LogEntry::MERGE_PARTS || entry.type == LogEntry::MUTATE_PART) if (entry.type == LogEntry::MERGE_PARTS || entry.type == LogEntry::MUTATE_PART)
{ {
if (merger_mutator.merges_blocker.isCancelled())
{
constexpr auto fmt_string = "Not executing log entry {} of type {} for part {} because merges and mutations are cancelled now.";
LOG_DEBUG(LogToStr(out_postpone_reason, log), fmt_string, entry.znode_name, entry.typeToString(), entry.new_part_name);
return false;
}
/** If any of the required parts are now fetched or in merge process, wait for the end of this operation. /** If any of the required parts are now fetched or in merge process, wait for the end of this operation.
* Otherwise, even if all the necessary parts for the merge are not present, you should try to make a merge. * Otherwise, even if all the necessary parts for the merge are not present, you should try to make a merge.
* If any parts are missing, instead of merge, there will be an attempt to download a part. * If any parts are missing, instead of merge, there will be an attempt to download a part.
@ -1371,12 +1378,6 @@ bool ReplicatedMergeTreeQueue::shouldExecuteLogEntry(
} }
} }
} }
if (merger_mutator.merges_blocker.isCancelled())
{
constexpr auto fmt_string = "Not executing log entry {} of type {} for part {} because merges and mutations are cancelled now.";
LOG_DEBUG(LogToStr(out_postpone_reason, log), fmt_string, entry.znode_name, entry.typeToString(), entry.new_part_name);
return false;
}
const auto data_settings = data.getSettings(); const auto data_settings = data.getSettings();
if (data_settings->allow_remote_fs_zero_copy_replication) if (data_settings->allow_remote_fs_zero_copy_replication)