Repository navigation
Report missing termination targets instead of success - #57
Merged
Merged
Conversation
Detect empty cancellation results and return NotFound from single-session termination and query cancellation, mapped to HTTP 404. Return NotFound for bulk requests without matches and preserve per-session failures when a selected backend disappears. Cover empty, successful, rejected and failed result streams, bulk no-match gRPC/HTTP behavior, and document the error semantics. Fixes apache#44
There was a problem hiding this comment.
🟡 Changes recommended
Tests omit missing-target cases for single-session termination and query cancellation, leaving their gRPC NotFound and HTTP 404 error mappings unverified.
1 open issue
What changed in this PR
Addresses #44 by reporting missing termination targets instead of success, allowing clients to distinguish missing sessions from successful actions.
Changes:
- Detect empty cancellation results and map missing single targets to gRPC
NotFoundand HTTP 404. - Return
NotFoundfor bulk requests without matches while preserving individual session failures. - Add result-stream and bulk no-match tests, and document the error semantics.
| File | Description |
|---|---|
internal/httpui/handler_termination_test.go |
Tests HTTP 404 for bulk requests without matches. |
internal/httpui/handler_actions.go |
Maps termination NotFound errors to HTTP 404. |
internal/grpc/actions.go |
Reports missing targets and preserves bulk failure details. |
internal/grpc/actions_test.go |
Asserts NotFound for bulk requests without matches. |
internal/gp/actions.go |
Detects empty results and handles row errors and cleanup. |
internal/gp/actions_test.go |
Covers empty, successful, rejected, and failed result streams. |
docs/API.md |
Documents missing-target and bulk error semantics. |
Review effort: Balanced
golangci-lint failed on the deferred rows.Close() in CancelQuery, whose error was not checked. Close the rows explicitly on the error path and return the Close error on success. Make the cancel call of ActionsServer replaceable and test that TerminateQuery and TerminateSession return gRPC NotFound, and that their HTTP endpoints return 404, when the session does not exist. Assisted-by: Claude Code
tuhaihe
approved these changes
Dec 2, 2026
tuhaihe
left a comment
Member
There was a problem hiding this comment.
Verified on a 4-node Cloudberry 3.0 demo cluster: terminate-session and terminate-query return 404 for a missing session, bulk termination without matches returns 404, and terminating a live session still succeeds.
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.

Detect empty cancellation results and return NotFound from single-session termination and query cancellation, mapped to HTTP 404. Return NotFound for bulk requests without matches and preserve per-session failures when a selected backend disappears.
Cover empty, successful, rejected and failed result streams, bulk no-match gRPC/HTTP behavior, and document the error semantics.
Fixes #44