Repository navigation
Conversation
- [ ] API-change - [x] BUG - [ ] Improvement - [ ] Documentation - [ ] Feature - [ ] Test and CI - [ ] Code Refactoring issue matrixorigin#25114 Fix/pipeline remote batch backpressure --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> (cherry picked from commit f526bc7)
## What type of PR is this? - [ ] API-change - [x] BUG - [ ] Improvement - [ ] Documentation - [ ] Feature - [ ] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: issue matrixorigin#25114 ## What this PR does / why we need it: fix(fileservice): retry COS multipart init on EOF --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> (cherry picked from commit 998815d)
fix ivf prefilter oom Approved by: @XuPeng-SH, @gouhongshen, @fengttt (cherry picked from commit 45a917d)
…26989) Approved by: @XuPeng-SH, @aunjgr, @LeftHandCold (cherry picked from commit dcfaae0)
…trixorigin#27156) ## What type of PR is this? - [ ] API-change - [x] BUG - [ ] Improvement - [ ] Documentation - [ ] Feature - [ ] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: issue matrixorigin#26720 ## What this PR does / why we need it: ## Summary Fix frontend connections being incorrectly closed after a successful long-running request. `Routine.handleRequest` created a request observer context with a fixed 30-minute deadline and later treated expiration of that child context as cancellation of the connection itself. As a result, SQL requests running longer than 30 minutes could complete successfully but still trigger transaction rollback and connection closure, causing clients to report `Lost connection to MySQL server during query`. This PR: - determines connection termination only from the real routine/root context or explicit connection cancellation; - removes the obsolete per-request observer deadline; - preserves client disconnect, `KILL CONNECTION`, cancellation, rollback, and cleanup behavior; - adds a regression test proving that expiration of a request-scoped child context does not close a healthy connection; - completes explain node-name coverage for `APPLY`, `POSTDML`, and `TABLE_CLONE`, preventing long- query plan diagnostics from reporting `Unsupported node type`. ## Validation - `TestRoutineShouldCloseConnectionIgnoresRequestDeadline` passed. - `TestGetLabelOrTitle` passed with exhaustive node-type name coverage. - Nightly IVF workflow validation used a temporary 10-minute observer deadline: - `LOAD DATA` ran for `28m52s`; - no `rollback the txn`, lost connection, or request failure occurred; - the workflow successfully continued into IVFFlat index construction. Validation workflow: https://github.com/matrixorigin/mo-nightly-regression/actions/runs/31778171059/job/94700724247 --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> (cherry picked from commit 8448892)
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? |
aunjgr
left a comment
There was a problem hiding this comment.
Reviewed the 4.2 backport at head 41a5fe9. The five component commits correspond to the already-reviewed upstream fixes: remote batch-credit backpressure, COS EOF retry, IVF prefilter memory bounds/copy reduction, and long-request connection liveness. The non-generated hunks preserve those source fixes with the expected 4.2 adaptations, generated pipeline code is included, and all backport CI is green. No additional blocking finding.
gouhongshen
left a comment
There was a problem hiding this comment.
Codex automated review
Reviewed the complete base-to-head diff, existing PR reviews, issue comments, and inline comments; no concrete blocking or non-blocking code findings remain.
XuPeng-SH
left a comment
There was a problem hiding this comment.
P1: this backport advertises cumulative protocol capability 11 without implementing the version-10 storage contract.
pkg/defines/const.go:48-50 changes this 4.2 binary from latest=9 to latest=11 and explicitly defines v10 as "persisted appendable-object abort metadata". However the v10 implementation from #26345 is absent here. In particular, pkg/vm/engine/tae/tables/mnode.go:159-182 still discards the abort vector and writes the legacy commitTS-only layout, while both appendable read paths only load/filter commitTS (pkg/objectio/ioutil/loadfuncs.go:195-245 and pkg/vm/engine/tae/blockio/read.go:1522-1542). There is no Runtime.PersistedAObjectAbortSupported() rollout gate or abort-column reader in this head.
This is a real rolling-upgrade correctness break, not just a skipped number. Protocol versions are cumulative rollout capabilities. Once operators see every live binary report >=10 and set the deployment protocol to 10/11, a newer TN may persist aborted appendable rows using the v10 abort column. A still-live 4.2 CN from this PR claims it supports that format but ignores the abort column, so rows whose commit timestamp is otherwise visible are returned even though they were rolled back. The upstream v10 change explicitly keeps legacy layout until every reader supports v10 for exactly this reason.
Please either backport the complete v10 reader/writer/rollout contract before advertising 11, or redesign the v11 backport so this branch does not falsely claim all prior protocol capabilities. Add a mixed-version test where a v10 appendable object contains an aborted row and the 4.2 reader must filter it.
This PR adds end-to-end support for rollback holes and persisted abort metadata in appendable objects. - Keeps rolled-back AppendNode ranges in the MVCC chain and marks them aborted, preserving ownership of already-applied physical rows and PK-index entries. - Makes memory scans and tombstone collection paths consume rollback holes. - Adds a unified special-column layout resolver instead of inferring commitTS from the last column or column count. - Persists and reads the abort column for new appendable objects. - Filters aborted rows across snapshot reads, deduplication, tombstone processing, merge/flush, logtail, publication, and custom object readers. - Extends WAL serialization to preserve the aborted state while retaining V1 compatibility. - Supports legacy objects containing only commitTS; a missing abort column is interpreted as false. - Supports both valid special-column layouts: - rowid → commitTS → abort - commitTS → rowid → abort Approved by: @gouhongshen, @fengttt, @LeftHandCold, @XuPeng-SH (cherry picked from commit a3f3f06)
…es-26720-25114-4.2-dev
XuPeng-SH
left a comment
There was a problem hiding this comment.
Deep review of exact head 7c48925dc70c731f70d21b90496747b2a513a62b, without waiting for CI.
The persisted-abort compatibility, const/malformed-column handling, merge-iterator cleanup, IVF memory admission/output bounds, COS ambiguity handling, and frontend connection-lifecycle paths are closed in this head. The remote-batch backpressure backport is not protocol-complete: two direct correctness fixes that immediately followed #26711 on main are missing.
[P1] Acknowledge a decoded batch before every graceful receiver-terminal return
All three graceful early-stop paths still return before acknowledgeRemoteBatch: receiveMsgAndForward, the connector receiver, and the dispatch ExecStop receiver. In these cases the batch was successfully decoded and handed off or intentionally discarded; returning is successful termination, not an error/cancellation teardown. The server nevertheless still owns the reserved batch credit until it sees the ACK, and its original handler blocks in waitUntilDrained before it can send the terminal response.
I reproduced this on the exact head with an already-terminal WaitRegister and a decoded batch at sequence 5: receiveMsgAndForward returns nil, but pendingBatchAck remains 5 and the stream sends no PipelineBatchAck. The existing test only asserts that the function returns, so it stays green while missing the ownership leak. Main fixed this direct #26711 regression in #26751.
Please backport that fix for remote-notify, connector, and dispatch: do not ACK decode/forward errors, but ACK a successfully decoded batch before returning on receiverDone/ExecStop, with assertions for the ACK command and sequence in all three paths.
[P1] Make StopSending terminate the negotiated batch-flow state, including the registration race
Method_StopSending only cancels the colexec pipeline record. It does not transition pipelineBatchFlow to a terminal state, clear its outstanding accounting, or wake reserve/drain waiters. waitUntilDrained does not time out: after 30 seconds its timer only logs once and is disabled, so without an ACK or external context/connection cancellation it continues waiting.
The exact-head white-box reproduction reserves one batch, starts waitUntilDrained, then runs the production StopSending handler. The handler returns nil, but the drain barrier is still blocked after 250 ms and the pending accounting remains live; only a manually injected ACK releases it. This is reachable because ACK and StopSending are handled concurrently, and StopSending can also arrive before the original stream lifecycle is registered. The client then waits up to 30 seconds for the terminal response before poisoning/closing the reusable connection, turning ordinary early termination into long query teardown and retained server work.
Main fixed this second direct #26711 regression in #26787. Please backport the complete state-machine fix, not only a call in the StopSending case: idempotent first-cause abort, accounting release, reserve/drain wakeup, rejection of new reservations, harmless late ACK, and the publish-then-check handshake for StopSending-before-lifecycle-registration. Include both lifecycle orderings in the regression matrix.
Focused local validation used the repository CGo wrapper. Existing tests for docfilter, loopjoin, remote batch/lifecycle, COS, frontend, persisted abort/legacy layouts, backup, and tombstone iterator cleanup pass. The two additional exact-head termination regressions above fail deterministically, which is why this review requests changes despite the existing green tests.
Acknowledge decoded batches before graceful early-stop returns, make StopSending abort negotiated batch-flow accounting across both registration orderings, and scope registry cancellation to the remote pipeline tree rather than the whole query.
XuPeng-SH
left a comment
There was a problem hiding this comment.
Deep re-review of exact head 4d00bff after applying the systemic closure, without waiting for CI as requested.\n\nThe two reported batch-credit blockers are closed:\n- graceful receiver-terminal paths ACK every successfully decoded batch before returning, while decode/forward/Exec errors still do not ACK;\n- StopSending now performs an idempotent first-cause batch-flow abort, clears bounded accounting, wakes reserve/drain waiters, rejects new reservations, tolerates late ACKs, and reconciles Stop-before-lifecycle registration.\n\nThe ownership audit also found and deterministically reproduced the related query-lifetime bug fixed upstream by #27458: the registry stored the query cancel function, so a normal downstream early stop could cancel the whole query. This head stores the remote pipeline-root cancel function instead; StopSending, pre-registration tombstones, and session cleanup stop that pipeline tree while the query context remains owned by the client/query path.\n\nValidation:\n- all focused regressions passed;\n- all 11 added/modified concurrency tests measured T=0 at race event resolution, so B=30s and N=100; every exact test passed 100 race repetitions;\n- full pkg/sql/compile and pkg/sql/colexec passed in normal and race modes;\n- go list, build, vet, and diff checks passed.\n\nPerformance remains bounded: one required ACK only on graceful decoded-batch termination, one short registry lookup per negotiated stream, constant-time hot-path abort checks, and O(pending) abort cleanup with pending capped at 8 and 64 MiB. No wire capability or legacy-client behavior changed.\n\n#26990/#27150 were reviewed but intentionally not folded into this backport: they change broader PipelineEdge/error-arbitration semantics for separate issues and are not required by this ownership state machine. No remaining blocker found.
XuPeng-SH
left a comment
There was a problem hiding this comment.
Deep review of exact head 4d00bff0079af9b83fb4ffd31d76f837cdfe6a94, without waiting for CI as requested.
The previously reported batch-credit and StopSending blockers are closed. One correctness blocker remains in the tombstone compatibility backport:
[P1] Preserve const commitTS broadcast semantics in every tombstone consumer
ReadDeletes now accepts a valid N-row non-null const commitTS and the PR provides TombstoneCommitTSColumn.At specifically to preserve its logical-row broadcast semantics. However, the partition-state stats path still converts that vector with MustFixedColNoTypeCheck, which returns the physical one-element backing slice for a const vector, and then indexes it by the rowid count at line 1641. Any matching tombstone with two or more logical rows therefore panics on row 1.
I reproduced this through the persisted public path on the exact head: write a two-row TN tombstone with objectio.NewObjectWriter, [rowid, pk, commitTS] seqnums, and commitTS = vector.NewConstFixed(T_TS, ts, 2, ...); register its stats in a partition state and call CollectTombstoneStats. The result is deterministic:
panic: runtime error: index out of range [1] with length 1
... (*PartitionState).countTombstoneStatsLinear.func1
partition_state.go:1641
The same backing-slice/logical-row mismatch remains in the map stats path, the merge iterator, and LocalDisttaeDataSource.batchApplyTombstoneObjects. Thus stats/count paths and local delete application can crash on an object that the shared reader explicitly validates as legal.
Please use ValidateTombstoneCommitTSColumn(len(rowids), vec) plus .At(logicalRow) systematically in all four consumers, propagate validation errors after releasing the current lease, and add persisted const-commitTS regressions for linear/map/merge stats and local tombstone application. Fixing only line 1641 would leave the same crash in the other execution strategies.
Focused existing tests passed for objectio/ioutil, TAE logtail, process/pipeline, compile batch-flow and StopSending, dispatch/connector, loopjoin, docfilter, vector, readutil, and publication. The added persisted const-commitTS regression above fails deterministically, so this review requests changes despite the current approval state.
XuPeng-SH
left a comment
There was a problem hiding this comment.
Systematic follow-up completed on this exact head.
- Linear, map, merge, and local tombstone consumers now use the validated logical-row commitTS accessor, preserving flat and non-null constant broadcast semantics.
- Validation remains once per loaded block; the hot loop adds no allocation, vector expansion/copy, or I/O.
- Added real persisted constant-vector regressions for visible/future timestamps across all strategies and local application.
- Re-ran malformed-column and reader-lease unhappy paths, focused regressions x10, full objectio/ioutil + disttae/... tests, and affected build/vet.
No remaining review blocker found.
XuPeng-SH
left a comment
There was a problem hiding this comment.
Deep review on c6714f3. Requesting changes: the combined backport reopens the target OOM path and introduces persisted-visibility regressions.
[P1] Restore admitted, single-owner construction in txnTable.BuildReaders (pkg/vm/engine/disttae/txn_table.go:2410). The persisted-abort cherry-pick overwrote the previously reviewed prepareMembershipFilter and closeReaders implementation. This local IVF scan path now reconstructs with docfilter.New, bypassing the CN MemoryAdmission lease used to bound concurrent filter memory. Its error ownership is also invalid: NewReader consumes source and filterHint.BF on every return, but freeOnError frees that current share again and then frees mainFilter; previously completed readers are never closed, so their LocalDisttaeDataSource iterators leak. Restore admitted reconstruction, free only the current pre-NewReader share, close all earlier readers on partial failure, and add Nth-reader failure coverage.
[P1] Iterate persisted commitTS by logical row and close loaded vectors on all errors (pkg/vm/engine/tae/tables/pnode.go:305). A valid N-row const commitTS has one physical value, so MustFixedCol returns a length-1 backing slice here. The loop processes only row 0 and ValidateTombstoneAbortColumn is called with 1 instead of len(rowIDs), causing valid persisted tombstones to be omitted or rejected. The abort validation return also bypasses vecs.Close. The exact-base implementation already used ValidateTombstoneCommitTSColumn(len(rowIDs), ...).At(i) and closed vectors on validation failure; please preserve that contract while adding abort handling. The same physical-slice regression exists in tables/utils.go:155 and should be fixed systemically, with const commitTS plus legacy/const abort tests.
[P2] Preserve the session timezone in fast range filtering (pkg/vm/engine/disttae/txn_table.go:1167). The exact PR base calls TryFastFilterBlocksWithZone with proc.GetSessionInfo().TimeZone; this backport changes it to the nil-zone wrapper. Mixed datetime/timestamp predicates intentionally cannot compile without a timezone, so they now always fall back to the slow ranges path and lose object/block zonemap pruning. Restore the base call and its timezone argument.
The source IVF fixes have positive workload evidence, but this combined 4.2 backport cannot close #26720 as-is because it removed consumer-side admission from a reachable local scan path. Focused ownership, timezone, and tombstone contract tests pass, but none covers these composition regressions.
Merge Queue Status
This pull request spent 1 minute 11 seconds in the queue, with no time running CI. Waiting for
All conditions
ReasonPull request #27313 has been dequeued Queue conditions are not satisfied:
HintYou should look at the reason for the failure and decide if the pull request needs to be fixed or if you want to requeue it. Tick the box to put this pull request back in the merge queue (same as
|
XuPeng-SH
left a comment
There was a problem hiding this comment.
Re-review on current head cda67a1 after merging the latest 4.2-dev. The merge does not touch the three blockers from review 5002923893, so changes are still required.
[P1] pkg/vm/engine/disttae/txn_table.go:2410 still reconstructs the local IVF membership filter with docfilter.New instead of admitted prepareMembershipFilter, reopening unbounded concurrent native filter memory. freeOnError still double-releases the current share after NewReader already consumes it and does not close previously built readers and their LocalDisttaeDataSource iterators. Restore the admitted single-owner implementation and partial-construction failure tests.
[P1] pkg/vm/engine/tae/tables/pnode.go:305 still iterates the physical MustFixedCol backing slice. A valid N-row constant commitTS therefore processes only row 0 and passes the wrong row count to abort validation; abort validation errors still return without closing vecs. pkg/vm/engine/tae/tables/utils.go:155 has the same logical-row regression. Use ValidateTombstoneCommitTSColumn with the rowid or location logical count, access through At, and close vectors plus zero-copy release leases on every error.
[P2] pkg/vm/engine/disttae/txn_table.go:1167 still drops proc.GetSessionInfo().TimeZone by calling the nil-zone wrapper. Mixed datetime/timestamp filters consequently fail fast-path compilation and lose object/block zonemap pruning. Preserve TryFastFilterBlocksWithZone from the exact base.
Nine focused current-head tests pass, including ownership, timezone, const-column, pnode, and the newly merged nested-PK-filter test. They validate the underlying contracts but do not exercise these composition failures. As-is the branch still cannot establish #26720 closure.
XuPeng-SH
left a comment
There was a problem hiding this comment.
Re-reviewed exact head b262f55 without waiting for CI. The three requested composition fixes are now closed: local reader construction uses admitted shared filters and has explicit Nth-source/Nth-reader ownership regressions; session timezone is preserved; persisted tombstone consumers use logical-row commitTS/abort access with complete vector and release cleanup. This follow-up also closes two same-shape unhappy paths found during self-review: metadata lookup errors now return physical-address vectors to the pool, and the object metadata producer broadcasts const fixed vectors instead of slicing their one-element backing storage. Legacy missing-abort and persisted const commitTS/abort paths are covered. Affected-package list/build/vet/full tests pass, and focused lifecycle/const-path tests pass under race. APPROVE.
LeftHandCold
left a comment
There was a problem hiding this comment.
Request changes: the new persisted-object ChangeHandle paths still interpret a const commitTS vector by its physical backing length instead of its logical row count.
In updatePersistedTombstoneBatch (pkg/vm/engine/disttae/logtailreplay/change_handle.go:2820-2835), MustFixedColWithTypeCheck returns one physical TS for a const vector whose Length() is N. Consequently, ValidateTombstoneAbortColumn(len(commits), ...) rejects a valid N-row const abort vector; if no abort column exists, the loop filters only the first logical row. updatePersistedDataBatch has the same pattern at lines 2966-2981.
This format is valid in this PR: the new validators explicitly support const MVCC vectors, and the persisted-node regression writes const commitTS/abort vectors. A focused two-row reproducer with const commitTS and const-false abort fails with:
invalid input: tombstone abort column has 2 rows, expected 1
Please validate commitTS using the batch/user-column logical row count, iterate logical rows through TombstoneCommitTSColumn.At, and add regressions for both persisted tombstone and data ChangeHandle paths.
XuPeng-SH
left a comment
There was a problem hiding this comment.
Deep re-reviewed exact head 524911f9271ec3b4b1924c3a6f355432898f2115 against 4.2-dev base 05f8a2938df56e8911701fe0276a37a0b2832f22, focusing on the post-approval const-MVCC follow-up. The latest change closes the remaining persisted ChangeHandle gap by deriving logical row count from the tombstone PK/rowid contract or batch RowCount, validating commitTS and abort vectors against that count, and reading both through const-aware logical accessors. Filtering, synthesized rowids, missing-abort compatibility, all-rows-kept/all-rows-removed cases, and retained vector lengths stay aligned. The accessor performs no allocations; its per-row const check is inlineable and does not introduce a material scan-path regression. No new correctness, ownership, leak/double-cleanup, hang, compatibility, or performance blocker found. The newly added tests were proven non-empty and pass on current head; full logtailreplay and objectio/ioutil package tests pass, and git diff --check is clean.
XuPeng-SH
left a comment
There was a problem hiding this comment.
Deep-reviewed exact head 22e3354 after the systemic remediation. The change-collection, persisted object/tombstone decoding, snapshot/backup rebuild, membership filtering, TN scan/append, ownership and cancellation paths were re-audited for correctness, compatibility, bounded allocation, atomic publication, cleanup, and performance. The final fixes close stale-index/object-identity, const-MVCC/logical-row, malformed metadata/vector, out-of-range/OOM, terminal-error, cancellation, and partial-publication paths. Relevant package tests, targeted race tests, go vet, and git diff --check pass locally. No remaining blocking finding on this exact head; approving without waiting for CI as requested.
What type of PR is this?
Which issue(s) this PR fixes:
issue #26720
What this PR does / why we need it:
Backport the fixes missing from
4.2-devfor #26720 and#25114.
Included PRs:
The changes address vector-index memory usage, file-service retry behavior, remote pipeline backpressure, and
frontend connection lifecycle on
4.2-dev.