Fix pulling pipeline

This commit is contained in:
alexX512 2023-03-16 12:41:17 +00:00
parent cf75dd2595
commit 29dd2e56f9
2 changed files with 7 additions and 4 deletions

View File

@ -4051,7 +4051,7 @@ Possible values:
Default value: `0`.
## stop_reading_on_first_cancel {#stop_reading_on_first_cancel}
When set to true and the user wants to interrupt a query (for example using Ctrl+C on the client), then the query continues execution only on data that was already read from the table. Afterward, it will return a partial result of the query for the part of the table that was read. To fully stop the execution of a query without a partial result, the user should send 2 cancel requests.
When set to `true` and the user wants to interrupt a query (for example using `Ctrl+C` on the client), then the query continues execution only on data that was already read from the table. Afterward, it will return a partial result of the query for the part of the table that was read. To fully stop the execution of a query without a partial result, the user should send 2 cancel requests.
**Example without setting on Ctrl+C**
```sql

View File

@ -175,6 +175,9 @@ bool PullingAsyncPipelineExecutor::pull(Block & block, uint64_t milliseconds)
void PullingAsyncPipelineExecutor::cancel()
{
if (!data)
return;
/// Cancel execution if it wasn't finished.
cancelWithExceptionHandling([&]()
{
@ -194,6 +197,9 @@ void PullingAsyncPipelineExecutor::cancel()
void PullingAsyncPipelineExecutor::cancelReading()
{
if (!data)
return;
/// Stop reading from source if pipeline wasn't finished.
cancelWithExceptionHandling([&]()
{
@ -203,9 +209,6 @@ void PullingAsyncPipelineExecutor::cancelReading()
void PullingAsyncPipelineExecutor::cancelWithExceptionHandling(CancelFunc && cancel_func)
{
if (!data)
return;
try
{
if (!data->is_finished && data->executor)