Skip to content

Commit 9fb0d3a

Browse files
Algunenanoclaude
andcommitted
Remove cancelQuery from processCancel to avoid killing unrelated pipelines
The `cancelQuery` call on the `ProcessListElement` was too aggressive: it cancels ALL registered pipeline executors, not just the one that received the Cancel packet. This breaks parallel replica queries where multiple executors share the same `ProcessListElement`. Cancellation of scalar subqueries still works correctly: `processCancel` throws `QUERY_WAS_CANCELLED_BY_CLIENT`, which propagates through the cancel callback up through the pull loop. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
1 parent a58b168 commit 9fb0d3a

File tree

1 file changed

+0
-9
lines changed

1 file changed

+0
-9
lines changed

src/Server/TCPHandler.cpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
#include <Interpreters/TablesStatus.h>
3131
#include <Interpreters/executeQuery.h>
3232
#include <Interpreters/Context.h>
33-
#include <Interpreters/ProcessList.h>
3433
#include <Parsers/ASTCreateQuery.h>
3534
#include <Parsers/ASTInsertQuery.h>
3635
#include <Server/TCPServer.h>
@@ -2712,14 +2711,6 @@ void TCPHandler::processCancel(QueryState & state)
27122711
state.read_all_data = true;
27132712
state.stop_query = true;
27142713

2715-
/// Cancel through the ProcessListElement so that all pipelines (including those
2716-
/// running during analysis, e.g. scalar subqueries) see the cancellation.
2717-
if (state.query_context)
2718-
{
2719-
if (auto process_list_element = state.query_context->getProcessListElement())
2720-
process_list_element->cancelQuery(CancelReason::CANCELLED_BY_USER);
2721-
}
2722-
27232714
throw Exception(ErrorCodes::QUERY_WAS_CANCELLED_BY_CLIENT, "Received 'Cancel' packet from the client, canceling the query.");
27242715
}
27252716

0 commit comments

Comments
 (0)