mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-23 16:12:01 +00:00
Add backoff for merges when always_fetch_merged_part turned on
This commit is contained in:
parent
e32133ff8f
commit
ffff1c22a6
@ -1256,6 +1256,25 @@ bool ReplicatedMergeTreeQueue::shouldExecuteLogEntry(
|
||||
{
|
||||
ignore_max_size = max_source_parts_size == data_settings->max_bytes_to_merge_at_max_space_in_pool;
|
||||
|
||||
if (data_settings->always_fetch_merged_part && entry.num_tries > 0)
|
||||
{
|
||||
static constexpr auto MAX_SECONDS_TO_WAIT = 300L;
|
||||
static constexpr auto BACKOFF_SECONDS = 3;
|
||||
|
||||
auto time_to_wait_seconds = std::min<int64_t>(MAX_SECONDS_TO_WAIT, entry.num_tries * BACKOFF_SECONDS);
|
||||
auto time_since_last_try_seconds = std::time(nullptr) - entry.last_attempt_time;
|
||||
if (time_to_wait_seconds > time_since_last_try_seconds)
|
||||
{
|
||||
out_postpone_reason = fmt::format(
|
||||
"Not executing log entry ({}) to merge parts for part {} because `always_fetch_merged_part` enabled and "
|
||||
" too less time passed since last try, have to wait {}",
|
||||
entry.znode_name, entry.new_part_name, time_to_wait_seconds - time_since_last_try_seconds);
|
||||
|
||||
LOG_DEBUG(log, fmt::runtime(out_postpone_reason));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (isTTLMergeType(entry.merge_type))
|
||||
{
|
||||
if (merger_mutator.ttl_merges_blocker.isCancelled())
|
||||
|
Loading…
Reference in New Issue
Block a user