Repository navigation
[4.2-dev] fix(pipeline): make terminal completion durable - #27991
Conversation
…ors (matrixorigin#26990) - [ ] API-change - [x] BUG - [ ] Improvement - [ ] Documentation - [ ] Feature - [ ] Test and CI - [ ] Code Refactoring Fixes matrixorigin#26743 Fixes matrixorigin#26745 This fixes two execution-mechanism failures, independently of query-plan quality: - Records normal pipeline completion as durable edge state, so a full data channel cannot turn `End` into `pipeline end signal delivery failed`. Receivers drain buffered data before observing the recorded terminal state. - Preserves substantive operator failures across sibling-pipeline cancellation. Cancellation is suppressed or replaced only when every error-tree leaf is attributable to the same canceled context; independent deadlines and joined substantive errors survive scope aggregation and remote cleanup. - Keeps query-owned timeouts classified as `context deadline exceeded`, while allowing the internal-executor cause to be attached by the owning caller. Q4 may still exceed the hash-build memory budget with its current plan; after this change the client receives that actual resource error instead of `context canceled`. --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> (cherry picked from commit fe62a8f)
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
XuPeng-SH
left a comment
There was a problem hiding this comment.
This backport is incomplete on the remote-notify cancellation path.
sendNotifyMessageWithFactoryAndWait.closeWithError still calls suppressRemoteNotifyCancelError, which only suppresses ErrQueryInterrupted. On 4.2 head, a notifier returning raw context.Canceled after the pipeline has been canceled (1) loses an already-recorded substantive cancel cause, and (2) reports ordinary internal cancellation as a terminal error. I reproduced both cases on 22e5aa27e9; replacing that call with normalizeScopeRunError(err, s.Proc.Ctx, scopeRunQueryContext(s.Proc)) makes the full regression matrix pass 100 times.
Please backport the remote-notify half of main #27537 (including its regression matrix), or land it as an explicit prerequisite before merging this PR. This is needed for the PR's stated root-error preservation contract and avoids publishing EventError for normal remote early-stop cleanup.
Validated separately: durable End ordering, multi-sender/full-channel delivery, spool cleanup ownership, and focused race tests are otherwise sound.
(cherry picked from commit 306ccdb)
XuPeng-SH
left a comment
There was a problem hiding this comment.
Deep re-review of exact head 88f034fa3fb0b7acf21a92747b7d21f2721b0536 against 4.2-dev base b2a873419200b3685fe4dd89401857440a0e145c.
The previous remote-notify blocker is closed. closeWithError now uses the same normalizeScopeRunError contract as local/remote scope aggregation, and the added matrix distinguishes raw pipeline cancellation, query cancellation, active-pipeline cancellation, query interruption, and a substantive cancellation cause.
I rechecked the complete sender/receiver/cleanup closure and counterexamples:
- End is recorded durably even when Ch2 is full; receivers drain already-buffered data before synthesizing a missing End.
- Multi-sender completion is bounded by
NilBatchCnt/endRecorded; fatal first-wins state accounts for remaining senders without waiting behind data. - Reset/reuse drains stale direct batches and spool references before replacing terminal state.
- Query deadlines preserve
context.DeadlineExceeded; joined substantive/deadline leaves are not hidden by sibling cancellation. - Cleanup notification, Done/Abort publication, and receiver termination have independent bounded/non-blocking release paths.
- No new goroutine, retry accumulation, unbounded queue, per-row logging, double cleanup, or terminal wait cycle is introduced.
Exact-head Ubuntu UT, SCA, build, coverage, PROXY/PESSIMISTIC BVT, Iceberg and MongoDB E2E are terminal green; git diff --check passes and the exact base merge-tree is clean. No blocking correctness, liveness, resource, performance, compatibility, or unhappy-path issue found.
Merge Queue Status
This pull request spent 22 seconds in the queue, including 3 seconds running CI. Required conditions to merge
|
## What type of PR is this? - [ ] API-change - [x] BUG - [ ] Improvement - [ ] Documentation - [ ] Feature - [x] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: Refs #27991, #31064, #31089, #28473 and #30738. ## What this PR does / why we need it: The dated 4.2.1 hotfix tags fork from `v4.2.1`; the `v4.2.1-hotfix` branch at `115c227239` does not contain all their fixes. Consolidate the missing changes so the branch preserves pipeline completion/cancellation, correct catalog index types, and the later SQL, vector and backup/restore fixes. | Source tag | Changes | Source commits | | --- | --- | --- | | `20260902` | Durable pipeline End completion and preservation of primary query errors | `07a7e871ec` | | `20260909` | Correct logical-ID index primary-column type | `2cb5379d78` | | `20261025` | Release materialized CTE batches and readers | `9ebefa5bc1` | | `20261026` | Resolve secondary indexes in subscriptions | `47e644f2d7` | | `20261029` | Skip empty predicate traversals; reuse window aggregate frames; preserve vector ownership on clone/transaction errors | `7ce664f08a`, `f6a27941d7`, `3391c6844e` | | `20261030` | Preserve GC retention evidence and table-ID history through physical backup/restore | `e0e2308d07` | | `20261104` | Release accounted window buffers on prepared Reset; preserve vector Area when admission fails | `d8286add27`, `15b1983f04` | All ten cherry-picks are conflict-free and retain their source patch IDs and `-x` provenance. The ETL and multi-CN IVF fixes are already present in the base; `9572bd3311` and `87866e6d28` require no duplicate changes. The final tree equals the `20261104` tag plus the `20260902` pipeline and `20260909` catalog fixes, verified by a combined stable patch-ID comparison. Catalog migration SQL, order, versions and offsets are unchanged. The pending catalog-upgrade/lineage dependency fix is separate from this consolidation. ### Validation - Linux/amd64, Go 1.26.4, CGO enabled; branch-matched `make thirdparties`, `make cgo`, and release `make build`: PASS. - Full normal suites for all 21 changed component packages, plus the two new real authenticated SQL witnesses in `pkg/tests/issues`: PASS. - Full race suites for 15 affected lifecycle packages and the two SQL witnesses: PASS. - Adaptive race stress for 56 individual changed lifecycle regressions: 5,237 successful repetitions; each exact test selected separately, using terminal JSON timing and a 30-second per-test budget capped at 100 repetitions: PASS. - Full `go vet -mod=readonly -p=4 ./...`: PASS. - Repository-pinned golangci-lint 2.6.2 with unchanged `.golangci.yml`, tests enabled, full package/reverse-dependency coverage: PASS against both `origin/v4.2.1-hotfix` and freshly fetched `origin/main` using `run --new-from-rev=<base> ./...`. - `molint check -mod=readonly -p=4 ./...`: no new diagnostics. Three `checkrecover` findings in unchanged CDC, lockservice and planner code reproduce identically on clean base `115c227239`. - Official `mo-tester` comparison mode on a dedicated service: large LIMIT, unbounded windows and subscription secondary indexes, **58/58 SQL checks PASS**. The separate 8 MiB HashJoin fixture is included for QA; local admission coverage is in the vector/HashJoin normal and race suites. - `git diff --check`: PASS. The GC metadata extension preserves the original block-zero representation and reads legacy one-block metadata. This PR does not repair previously incomplete backup archives. Deployment follows the existing full-shutdown, uniform-version upgrade contract. --------- Co-authored-by: GreatRiver <[email protected]> Co-authored-by: gouhongshen <[email protected]> Co-authored-by: Cao Kai <[email protected]> Co-authored-by: XuPeng-SH <[email protected]> Co-authored-by: GreatRiver <[email protected]> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> Co-authored-by: 和光同尘 <[email protected]>
What type of PR is this?
Which issue(s) this PR fixes:
Fixes #27987
What this PR does / why we need it:
Backports #26990 to 4.2-dev.
A normal pipeline End is now recorded as durable edge state even when the bounded data channel is full. The receiver drains buffered batches before observing the recorded End, preventing a slow full-table-scan consumer from turning graceful completion into pipeline end signal delivery failed.
The backport also preserves substantive execution errors across sibling-pipeline cancellation and keeps query deadline classification intact. Existing 4.2-dev cancellation helpers were retained while resolving the cherry-pick conflict.
Validation: