mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-27 18:12:02 +00:00
HashedDictionaryParallelLoader exception safe constructor
This commit is contained in:
parent
b6cfba33f1
commit
7ebaa4d1ca
@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <Dictionaries/IDictionary.h>
|
||||
#include <Dictionaries/DictionaryHelpers.h>
|
||||
#include <Common/CurrentThread.h>
|
||||
#include <Common/iota.h>
|
||||
#include <Common/scope_guard_safe.h>
|
||||
@ -62,6 +63,9 @@ public:
|
||||
for (size_t shard = 0; shard < shards; ++shard)
|
||||
{
|
||||
shards_queues[shard].emplace(backlog);
|
||||
|
||||
try
|
||||
{
|
||||
pool.scheduleOrThrowOnError([this, shard, thread_group = CurrentThread::getGroup()]
|
||||
{
|
||||
WorkerStatistic statistic;
|
||||
@ -85,6 +89,15 @@ public:
|
||||
threadWorker(shard, statistic);
|
||||
});
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
for (size_t shard_to_finish = 0; shard_to_finish < shard; ++shard_to_finish)
|
||||
shards_queues[shard_to_finish]->clearAndFinish();
|
||||
|
||||
pool.wait();
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void addBlock(Block block)
|
||||
|
Loading…
Reference in New Issue
Block a user