Merge pull request #26828 from ClickHouse/flush-LazyOutputFormat-on-cancel

Flush LazyOutputFormat on query cancel.
This commit is contained in:
Nikolai Kochetov 2021-07-28 13:07:58 +03:00 committed by GitHub
commit 421650dc68
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 4 deletions

View File

@ -174,9 +174,8 @@ void PullingAsyncPipelineExecutor::cancel()
if (data && !data->is_finished && data->executor)
data->executor->cancel();
/// Finish lazy format. Otherwise thread.join() may hung.
if (lazy_format && !lazy_format->isFinished())
lazy_format->finish();
/// The following code is needed to rethrow exception from PipelineExecutor.
/// It could have been thrown from pull(), but we will not likely call it again.
/// Join thread here to wait for possible exception.
if (data && data->thread.joinable())

View File

@ -29,7 +29,7 @@ public:
void setRowsBeforeLimit(size_t rows_before_limit) override;
void finish()
void onCancel() override
{
finished_processing = true;
/// Clear queue in case if somebody is waiting lazy_format to push.