Skip to content

Report missing termination targets instead of success - #57

Merged
tuhaihe merged 2 commits into
apache:mainfrom
leborchuk:fix/issue-44-termination-status
Dec 2, 2026
Merged

tuhaihe merged 2 commits into
apache:mainfrom
leborchuk:fix/issue-44-termination-status

Conversation

@leborchuk

Copy link
Copy Markdown
Contributor

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

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
@leborchuk
leborchuk requested review from tuhaihe and a balanced review from Copilot December 1, 2026 15:51

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 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 NotFound and HTTP 404.
  • Return NotFound for 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

Comment thread internal/grpc/actions.go Resolved
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 tuhaihe left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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.

@tuhaihe
tuhaihe merged commit 0882a08 into apache:main Dec 2, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] terminate-session returns SUCCESS for a non-existent session

3 participants