Skip to content

test: verify KILL cancels INSERT SELECT#8151

Merged
killme2008 merged 2 commits into
GreptimeTeam:mainfrom
QuakeWang:fix-insert-select-kill
May 23, 2026
Merged

test: verify KILL cancels INSERT SELECT#8151
killme2008 merged 2 commits into
GreptimeTeam:mainfrom
QuakeWang:fix-insert-select-kill

Conversation

@QuakeWang
Copy link
Copy Markdown
Contributor

I hereby agree to the terms of the GreptimeDB CLA.

Refer to a related PR or issue link (optional)

Closes #6334

What's changed and what's your intention?

This PR adds tests to verify that tracked INSERT INTO ... SELECT statements can be cancelled through the process manager.

The tests cover both supported kill forms:

  • KILL QUERY <connection_id>
  • KILL '<frontend>/<process_id>'

The test uses a pending source table scan to keep INSERT INTO target SELECT * FROM source running, then verifies that KILL makes the original insert task return Cancelled instead of only disappearing from SHOW PROCESSLIST.

This does not change runtime logic. It only strengthens coverage for the existing insert-select process tracking and cancellation path.

PR Checklist

Please convert it to a draft if some of the following conditions are not met.

  • I have written the necessary rustdoc comments.
  • I have added the necessary unit tests and integration tests.
  • This PR requires documentation updates.
  • API changes are backward compatible.
  • Schema or data changes are backward compatible.

Signed-off-by: QuakeWang <wangfuzheng0814@foxmail.com>
@QuakeWang QuakeWang requested a review from a team as a code owner May 21, 2026 16:20
@github-actions github-actions Bot added size/S docs-not-required This change does not impact docs. labels May 21, 2026
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces unit tests to verify that 'KILL QUERY' and 'KILL [process_id]' commands successfully cancel 'INSERT INTO ... SELECT ...' operations. To support these tests, mock components such as 'PendingRecordBatchStream' and 'PendingDataSource' were implemented, and test setup helpers were refactored. Reviewer feedback recommends replacing several instances of '.unwrap()' with proper error propagation and context using 'snafu' to align with the project's error handling standards.

Comment thread src/frontend/src/instance.rs Outdated
Comment thread src/frontend/src/instance.rs Outdated
Comment thread src/frontend/src/instance.rs Outdated
Signed-off-by: QuakeWang <wangfuzheng0814@foxmail.com>
@github-actions github-actions Bot added size/M and removed size/S labels May 22, 2026
Copy link
Copy Markdown
Member

@killme2008 killme2008 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job

@killme2008 killme2008 added this pull request to the merge queue May 23, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks May 23, 2026
@killme2008 killme2008 added this pull request to the merge queue May 23, 2026
Merged via the queue into GreptimeTeam:main with commit 9916027 May 23, 2026
47 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs-not-required This change does not impact docs. size/M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Currently KILL cannot terminate queries like INSERT INTO SELECT

2 participants