diff --git a/src/Storages/MergeTree/MergeTreeSource.cpp b/src/Storages/MergeTree/MergeTreeSource.cpp index 6c9c0508bda..ae1679cebfd 100644 --- a/src/Storages/MergeTree/MergeTreeSource.cpp +++ b/src/Storages/MergeTree/MergeTreeSource.cpp @@ -104,7 +104,16 @@ struct MergeTreeSource::AsyncReadingState void schedule(ThreadPool::Job job) { - callback_runner(std::move(job), 0); + try + { + callback_runner(std::move(job), 0); + } + catch (...) + { + /// Roll back stage in case of exception from ThreadPool::schedule + control->stage = Stage::NotStarted; + throw; + } } ChunkAndProgress getResult()