mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-25 17:12:03 +00:00
Fix thread accounting for max_part_removal_threads
This commit is contained in:
parent
dfe3699e77
commit
6e71757814
@ -56,6 +56,8 @@
|
|||||||
#include <boost/range/adaptor/filtered.hpp>
|
#include <boost/range/adaptor/filtered.hpp>
|
||||||
#include <boost/algorithm/string/join.hpp>
|
#include <boost/algorithm/string/join.hpp>
|
||||||
|
|
||||||
|
#include <ext/scope_guard_safe.h>
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
#include <optional>
|
#include <optional>
|
||||||
@ -1217,8 +1219,15 @@ void MergeTreeData::clearPartsFromFilesystem(const DataPartsVector & parts_to_re
|
|||||||
/// NOTE: Under heavy system load you may get "Cannot schedule a task" from ThreadPool.
|
/// NOTE: Under heavy system load you may get "Cannot schedule a task" from ThreadPool.
|
||||||
for (const DataPartPtr & part : parts_to_remove)
|
for (const DataPartPtr & part : parts_to_remove)
|
||||||
{
|
{
|
||||||
pool.scheduleOrThrowOnError([&]
|
pool.scheduleOrThrowOnError([&, thread_group = CurrentThread::getGroup()]
|
||||||
{
|
{
|
||||||
|
SCOPE_EXIT_SAFE(
|
||||||
|
if (thread_group)
|
||||||
|
CurrentThread::detachQueryIfNotDetached();
|
||||||
|
);
|
||||||
|
if (thread_group)
|
||||||
|
CurrentThread::attachTo(thread_group);
|
||||||
|
|
||||||
LOG_DEBUG(log, "Removing part from filesystem {}", part->name);
|
LOG_DEBUG(log, "Removing part from filesystem {}", part->name);
|
||||||
part->remove();
|
part->remove();
|
||||||
});
|
});
|
||||||
|
@ -5714,8 +5714,15 @@ void StorageReplicatedMergeTree::removePartsFromFilesystem(const DataPartsVector
|
|||||||
/// NOTE: Under heavy system load you may get "Cannot schedule a task" from ThreadPool.
|
/// NOTE: Under heavy system load you may get "Cannot schedule a task" from ThreadPool.
|
||||||
for (const DataPartPtr & part : parts)
|
for (const DataPartPtr & part : parts)
|
||||||
{
|
{
|
||||||
pool.scheduleOrThrowOnError([&]
|
pool.scheduleOrThrowOnError([&, thread_group = CurrentThread::getGroup()]
|
||||||
{
|
{
|
||||||
|
SCOPE_EXIT_SAFE(
|
||||||
|
if (thread_group)
|
||||||
|
CurrentThread::detachQueryIfNotDetached();
|
||||||
|
);
|
||||||
|
if (thread_group)
|
||||||
|
CurrentThread::attachTo(thread_group);
|
||||||
|
|
||||||
LOG_DEBUG(log, "Removing part from filesystem {}", part->name);
|
LOG_DEBUG(log, "Removing part from filesystem {}", part->name);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user