diff --git a/src/Common/RingBuffer.h b/src/Common/RingBuffer.h index 9c65ac3dff1..f87bdbea3ac 100644 --- a/src/Common/RingBuffer.h +++ b/src/Common/RingBuffer.h @@ -21,15 +21,9 @@ public: buffer.assign(capacity, {}); } - size_t size() const - { - return count; - } + size_t size() const { return count; } - bool empty() const - { - return count == 0; - } + bool empty() const { return count == 0; } bool tryPush(T element) { diff --git a/src/Storages/MergeTree/BackgroundJobsExecutor.cpp b/src/Storages/MergeTree/BackgroundJobsExecutor.cpp index b67156f195f..f863ce91e72 100644 --- a/src/Storages/MergeTree/BackgroundJobsExecutor.cpp +++ b/src/Storages/MergeTree/BackgroundJobsExecutor.cpp @@ -111,8 +111,6 @@ void BackgroundJobAssignee::finish() getContext()->getFetchesExecutor()->removeTasksCorrespondingToStorage(storage_id); getContext()->getMergeMutateExecutor()->removeTasksCorrespondingToStorage(storage_id); } - - finished = true; } @@ -141,7 +139,14 @@ catch (...) /// Catch any exception to avoid thread termination. BackgroundJobAssignee::~BackgroundJobAssignee() { - assert(finished); + try + { + finish(); + } + catch (...) + { + tryLogCurrentException(__PRETTY_FUNCTION__); + } } } diff --git a/src/Storages/MergeTree/BackgroundJobsExecutor.h b/src/Storages/MergeTree/BackgroundJobsExecutor.h index 3d776e56a35..82bd6882b96 100644 --- a/src/Storages/MergeTree/BackgroundJobsExecutor.h +++ b/src/Storages/MergeTree/BackgroundJobsExecutor.h @@ -48,8 +48,6 @@ private: /// Mutex for thread safety std::mutex holder_mutex; - bool finished{false}; - public: enum class Type {