Skip to content

[4.2-dev] Preserve COS GET cancellation identity - #32945

Merged
XuPeng-SH merged 1 commit into
matrixorigin:4.2-devfrom
XuPeng-SH:fix/4.2-cos-read-cancellation
Nov 19, 2026
Merged

XuPeng-SH merged 1 commit into
matrixorigin:4.2-devfrom
XuPeng-SH:fix/4.2-cos-read-cancellation

Conversation

@XuPeng-SH

Copy link
Copy Markdown
Contributor

What type of PR is this?

  • API-change
  • BUG
  • Improvement
  • Documentation
  • Feature
  • Test and CI
  • Code Refactoring

Which issue(s) this PR fixes:

Related to #32389.

What this PR does / why we need it:

A COS GET canceled while waiting for response headers can return a singleton SDK RetryError even with SDK retries disabled. It renders as context canceled, but standard Go error traversal cannot identify the wrapped cancellation. A normal early stop after IVF sampling reaches its LIMIT can then surface as SQL error 1105.

Restore the request's context error at the COS GET boundary only when the SDK wrapper contains that exact error as its sole child. Independent storage errors and mixed errors retain their identity. The success path incurs no additional checks or allocations.

A local three-CN reproduction on the nightly revision used 250,000 persisted rows and controlled only the response timing of a GET. The same CREATE INDEX failed before normalization and succeeded with it. With disk caching enabled, delaying a bounded-range GET also reproduced the failure. The archived nightly logs contain the same reader and SQL symptoms, but do not record the original Go error type.

The new public Read regression uses a real HTTP request and cancels after the server receives it. It fails with the expected RetryError when normalization is removed. Focused counterexamples cover deadlines, active requests, independent errors and mixed errors. The fileservice package passed under the race detector.

Expected reader cancellation uses the existing DEBUG event. The existing rate-limited reader event includes the concrete Go error type, so failures with identical messages can be distinguished. The type is formatted only after the event passes its log-level and rate-limit checks.

@XuPeng-SH
XuPeng-SH requested a review from fengttt as a code owner November 19, 2026 13:51
@qodo-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@mergify

mergify Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

This pull request is merged.

@XuPeng-SH

XuPeng-SH commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor Author

mo-bot review · mo-bot-local · done

Commit: 6020c260b451f18d46eac8955e7449660874335c

Review completed. Read the assessment.

@XuPeng-SH XuPeng-SH left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

mo-bot review · mo-bot-local · review

Commit: 6020c260b451f18d46eac8955e7449660874335c

Assessment: approve

The COS GET adapter restores the request’s cancellation error when it is the sole error in the SDK wrapper. Existing scope logic can then distinguish a normal pipeline stop from a query cancellation, deadline, or storage failure. The reader diagnostic records the concrete error type through the existing rate-limited log path.

Model: gpt-6.2-sol / xhigh

Session: 01a1f0a0-5126-78f3-9ab8-ef4e87f2f119 · slot 0 · generation 3

Validation:

  • The real HTTP cancellation regression passed 100 times under the race detector. The same test with the merge-base adapter reproduced the opaque *cos.RetryError.

  • Focused race tests passed for COS, retry behavior, and S3FS reads. Reader and scope tests passed for normal early stop, query cancellation, deadlines, and substantive failures.

  • Isolation preflight, the native build, and git diff --check passed. Commands, exits, and logs are indexed in validation-reconciliation.json.

Limitations:

  • The full fileservice race run reached its 150-second timeout during local filesystem tests.

  • The author reports a controlled three-CN SQL reproduction. This review verified the HTTP and scope boundaries locally. The cause of the archived nightly failures remains unconfirmed.

@XuPeng-SH
XuPeng-SH merged commit 505977b into matrixorigin:4.2-dev Nov 19, 2026
@XuPeng-SH
XuPeng-SH deleted the fix/4.2-cos-read-cancellation branch November 19, 2026 14:50
XuPeng-SH added a commit that referenced this pull request Nov 20, 2026
…32947)

## What type of PR is this?

- [ ] API-change
- [x] BUG
- [ ] Improvement
- [ ] Documentation
- [ ] Feature
- [ ] Test and CI
- [ ] Code Refactoring

## Which issue(s) this PR fixes:

Related to #32389 and the 4.2-dev fix #32945.

## What this PR does / why we need it:

Main already restores ordinary COS read cancellation identity through
#28070. The read-only adapter's singleton retry wrapper check can also
match a cancellation nested inside an aggregate and discard a sibling
storage failure. Walk the single-error unwrap chain to preserve pure
wrapped cancellations and retain aggregate errors.

Route matching reader context cancellations through the existing bounded
DEBUG event contract. Real reader failures use a bounded ERROR event
carrying the concrete error type and the reader context status. Derived
fields are formatted after log-level and rate checks.

The existing in-flight HTTP tests pass on main. The new wrapped
aggregate regression fails with main's original adapter and passes with
this change. The 4.2-dev nightly reproduction is related context. It has
no logged concrete Go error type and does not establish that the
aggregate occurred there.

Local race validation passed on fileservice and readutil with Go 1.27.1.
The repository SCA selector chose the full scan. Molint and
golangci-lint passed.

This branch was previously deployed

1 inactive deployment
ci — 6020c260 Deployed Nov 19, 2026 by XuPeng-SH
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/bug Something isn't working size/S Denotes a PR that changes [10,99] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants