diff --git a/src/Storages/MergeTree/ReplicatedMergeTreePartCheckThread.cpp b/src/Storages/MergeTree/ReplicatedMergeTreePartCheckThread.cpp index 20e60e0adc8..24857bdb17e 100644 --- a/src/Storages/MergeTree/ReplicatedMergeTreePartCheckThread.cpp +++ b/src/Storages/MergeTree/ReplicatedMergeTreePartCheckThread.cpp @@ -559,14 +559,13 @@ void ReplicatedMergeTreePartCheckThread::run() }); if (selected == parts_queue.end()) { - // find next part to check in the queue and schedule the check - // otherwise, scheduled for later checks won't be executed until a new check is enqueued (i.e. task is scheduled again) - auto next_it = - std::min_element(begin(parts_queue), end(parts_queue), - [](const auto &l, const auto &r) { - return l.time < r.time; - }); - if (next_it != parts_queue.end()) { + // Find next part to check in the queue and schedule the check + // Otherwise, scheduled for later checks won't be executed until + // a new check is enqueued (i.e. task is scheduled again) + auto next_it = std::min_element( + begin(parts_queue), end(parts_queue), [](const auto & l, const auto & r) { return l.time < r.time; }); + if (next_it != parts_queue.end()) + { auto delay = next_it->time - current_time; task->scheduleAfter(delay * 1000); } diff --git a/src/Storages/MergeTree/ReplicatedMergeTreePartCheckThread.h b/src/Storages/MergeTree/ReplicatedMergeTreePartCheckThread.h index 07c39d2ed07..eb9d6144593 100644 --- a/src/Storages/MergeTree/ReplicatedMergeTreePartCheckThread.h +++ b/src/Storages/MergeTree/ReplicatedMergeTreePartCheckThread.h @@ -90,9 +90,10 @@ private: Poco::Logger * log; using StringSet = std::set; - struct PartToCheck { - String name; - time_t time; + struct PartToCheck + { + String name; + time_t time; }; using PartsToCheckQueue = std::list;