[fix](load) Make insert cancellation reliable - #67137
Open
0AyanamiRei wants to merge 1 commit into
Open
Conversation
### What problem does this PR solve?
Issue Number: None
Related PR: None
Problem Summary: Nereids INSERT INTO SELECT and CTAS publish their coordinator only after planning and transaction initialization. A cancellation received before publication was reported as successful but lost, allowing the later coordinator to execute and commit. A second race allowed cancellation after coordinator completion but immediately before transaction commit to report success while the insert still committed. REST and forwarded cancellation also did not propagate whether cancellation was accepted.
Remember cancellation in StmtExecutor and apply it when a command publishes its coordinator, prevent a cancelled coordinator from dispatching fragments, and serialize cancellation against the start of insert completion. Propagate the accepted or rejected result through SQL, JDBC, REST, local scheduling, and forwarded FE cancellation paths so a request received after commit starts is not reported as successful.
### Release note
KILL QUERY, JDBC Statement.cancel(), and the REST query kill API now reliably cancel Nereids INSERT INTO SELECT and CTAS before transaction commit, including coordinator-publication races. Cancellation attempted after commit begins returns an error instead of a false success.
### Check List (For Author)
- Test: Unit Test and Regression Test
- ./run-fe-ut.sh --run org.apache.doris.qe.StmtExecutorTest
- ./run-regression-test.sh --run -d insert_p0 -s test_cancel_nereids_insert_query
- ./build.sh --fe -j48
- Behavior changed: Yes. Query cancellation is sticky until coordinator publication and is rejected once insert commit begins.
- Does this need documentation: No
0AyanamiRei
requested review from
924060929,
englefly,
morrySnow and
starocean999
as code owners
August 25, 2026 16:38
Contributor
|
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What problem does this PR solve?
Issue Number: None
Related PR: None
Problem Summary:
INSERT INTO SELECT and CTAS expose two query cancellation races:
The same false-success behavior exists in local REST cancellation and follower-to-master forwarding because those layers do not propagate whether the statement accepted cancellation.
This PR:
Scope: CANCEL LOAD is not changed by this PR. Running InsertLoadJob transaction/query binding is an independent load-job lifecycle issue.
Release note
KILL QUERY, JDBC Statement.cancel(), and the REST query kill API now reliably cancel Nereids INSERT INTO SELECT and CTAS before transaction commit, including coordinator-publication races. Cancellation attempted after commit begins returns an error instead of a false success.
Check List (For Author)
Test
Behavior changed:
Does this need documentation?
Check List (For Reviewer who merge this PR)