Merge pull request #3928 from yandex/fix_replication_queue_exponential_backoff

Fix exponential backoff for replication queue
This commit is contained in:
alexey-milovidov 2018-12-26 18:08:07 +03:00 committed by GitHub
commit d9ab0cfb9f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2077,7 +2077,16 @@ bool StorageReplicatedMergeTree::queueTask()
LogEntryPtr & entry = selected.first;
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::milliseconds(100));
/// 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;