Fix exponential backoff for replication queue

This commit is contained in:
alesapin 2018-12-26 12:56:52 +03:00
parent 8f306e8b45
commit 444eb21d28

View File

@ -2077,7 +2077,16 @@ bool StorageReplicatedMergeTree::queueTask()
LogEntryPtr & entry = selected.first; LogEntryPtr & entry = selected.first;
if (!entry) if (!entry)
return false; {
/// Nothing to do, we can sleep for some time, just not to
/// abuse background pool scheduling policy
std::this_thread::sleep_for(std::chrono::seconds(5));
/// If we return false, than background pool for this task
/// will accumulate exponential backoff and after empty replication queue
/// we will sleep for a long time
return true;
}
time_t prev_attempt_time = entry->last_attempt_time; time_t prev_attempt_time = entry->last_attempt_time;