Repository navigation
Conversation
…in#27991) Backports matrixorigin#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: - Focused regression tests across process, connector, dispatch, and compile - Full owning-package tests - Focused race stress for concurrent terminal publication, count 100 - Full owning-package race tests - go build and go vet for all affected packages Approved by: @XuPeng-SH (cherry picked from commit dad3554) (cherry picked from commit 07a7e87)
(cherry picked from commit 2cb5379)
Adapt the ownership fix from matrixorigin#30796 to production base d239386 without adding later scalar-reader features. Retain and clean the current caller-owned batch at advancement and terminal paths, and release source readers idempotently. Add lifecycle/account regression tests and real authenticated SQL coverage for ordinary, binary prepared, and text prepared execution. Refs matrixorigin#31064. (cherry picked from commit 9ebefa5)
…8280) ## 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: Fixes matrixorigin#28279 ## What this PR does / why we need it: Regular secondary-index scans over a subscribed database resolve the hidden index table under the publisher account. `ResolveIndexTableByRef` carried the publisher account ID but omitted the publisher database name, so `getRelation` replaced the valid source database with an empty name and returned `no such table <publisher_db>.__mo_index_secondary_*`. This PR: - sets `SubscriptionMeta.DbName` from the planner-resolved published table reference; - adds a deterministic publication/subscription BVT with a different subscription alias, 100,000 flushed rows, and forced scans over two regular secondary indexes; - asserts that the plan actually uses `idx_event_type`, preventing the regression case from silently falling back to a table scan. This is the focused `4.2-dev` backport of the subscription metadata fix already merged into `main` by matrixorigin#26702. It does not backport the unrelated FULLTEXT implementation from that PR. Validation: - Base `c8b8e2c046`: the regression SQL reproduced the production failure for both hidden secondary-index tables. - Head `7f32413fbb`: `pub_sub_secondary_index` passed, 19/19 statements. - The fixed BVT query pair also passed three consecutive runs before adding the explicit plan assertion. - `make build` passed. - `git diff --check` passed. QA required: yes. The BVT reproduces and verifies the single-node planner/resolver path; normal 4.2 CI and publication/subscription testing should run on the PR. (cherry picked from commit 33640a3) (cherry picked from commit 47e644f)
…atrixorigin#31511) ## 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: Related to matrixorigin#31502. ## What this PR does / why we need it: Minimally backport the non-empty predicate-deduction guards from main commit `5d6f921345` (matrixorigin#26927). Skip the extra child traversal when no predicates were deduced, while preserving normal pushdown and non-empty deduction. No UPDATE alias, DEDUP, cancellation, or other changes from that PR are included. Add deterministic regression coverage for both chain directions and all six affected JOIN types, non-empty deduction semantics, and an eight-table PREPARE through the real planner entry point. The unpatched eight-table INNER chain performs 509 visits for 15 nodes; the guarded version performs 15. Independently reverting any of the four guards is caught by the regression. Validation on this target branch (Go 1.26.4, macOS arm64, branch-local native libraries): - New regressions fail on unpatched production code for the expected visit-count assertion; non-empty deduction and PREPARE controls pass. - Focused regression and related pushdown tests pass. - Full `pkg/sql/plan` tests, `go vet`, and incremental golangci-lint 2.6.2 pass. - All eight added executable production lines are covered (100%). This addresses empty-deduction traversal amplification, not a general planning-memory budget or a proof of linear planning cost for every SQL shape. No changes to main are included. (cherry picked from commit 7ce664f)
…rigin#31581) ## What type of PR is this? - [ ] API-change - [x] BUG - [x] Improvement - [ ] Documentation - [ ] Feature - [ ] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: Addresses matrixorigin#31530 on `release/v4.2.1-hotfix-20261026`. ## What this PR does / why we need it: Backport matrixorigin#31546 to the active 4.2.1 hotfix branch. Aggregate windows currently rescan unbounded frames for every output row, causing quadratic aggregate work, including with a `LIMIT` above the Window operator. Compute a whole-partition aggregate once and broadcast its result. Reuse independent unfinalized states for supported cumulative COUNT/SUM/AVG and fixed-width MIN/MAX frames; RANGE includes the complete peer group. Preserve the existing evaluator for unsupported cumulative aggregates and frames, and keep the target branch's unrelated vector and lifecycle code unchanged. Validation on the target branch, macOS arm64 and Go 1.26.4: - Full Window package passed normally and with `-race`; tests cover aggregate values, NULLs, peers, partition isolation, varlen/DISTINCT full frames, work counts, cancellation and allocation failures. - Exact public SQL BVT passed twice on a two-CN cluster: 20/20 each, no skipped or failed statements, with database cleanup checked on both CNs. - Incremental 31-package `go vet`, `molint` and configured `golangci-lint` passed; lint reported zero issues. Molint printed six diagnostics in unchanged frontend/compile files; the same six were reproduced against the target baseline. - Same local SQL harness, target baseline versus backport, 8,000 rows: full SUM 10.708 s → 1.639 ms, cumulative SUM 5.323 s → 1.952 ms, full COUNT 332.37 ms → 0.285 ms; returned values checked. These are single observations on separate local cluster starts, not a statistical no-regression benchmark. The UT also checks aggregate work counts. - gpt-6.1-terra/max design and final overall review completed. Unsupported cumulative DISTINCT, variable-length MIN/MAX and other unsupported states, and frames ending at a non-current offset retain the generic evaluator. CI remains separate. (cherry picked from commit f6a2794)
…atrixorigin#31693) ## What type of PR is this? - [ ] API-change - [x] BUG - [x] Improvement - [ ] Documentation - [ ] Feature - [ ] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: Fixes matrixorigin#31690 ## What this PR does / why we need it: Constant-NULL cloning can discard an owned destination buffer, and transaction error paths can abandon vectors borrowed from the Small pool. Retain owned destination capacity as a zero-length slice for reuse and eventual release, while detaching borrowed data safely. Register row-ID cleanup before either caller rejects an error, preserving write-write conflict continuation. Release newly acquired append vectors on failure until ownership transfers to the node; leave borrowed vectors under their existing owner. Regression tests cover allocator/account balance, serialization, nil-mpool and borrowed-buffer controls, pool reuse and allocation-limit eviction, both actual lookup callers including cancellation/deadline errors and write-write conflict results, and append-vector early/late errors, successful transfer, and positive-offset borrowing. The new regressions fail against the original production code. Validation: normal and race tests for `pkg/container/vector`, `pkg/vm/engine/tae/containers`, and `pkg/vm/engine/tae/txn/txnimpl`; incremental gofmt, go vet, MatrixOne molint, and repository-pinned golangci-lint. Native prerequisites were rebuilt locally from this release base. Vector owning-package tests use `TZ=UTC`: the existing `TestRowToString` fails in the host's New York timezone with the same signature on the original production code. These are internal ownership fixes with no intended SQL/error/protocol changes; no SQL BVT or performance benchmark was added. CI results are pending. (cherry picked from commit 3391c68)
…matrixorigin#31886) ## 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: Related to matrixorigin#28473 and matrixorigin#30738 on `release/v4.2.1-hotfix-20261026`. Backports matrixorigin#29504 and matrixorigin#30744. This PR does not claim to recover previously missing source objects or repair already incomplete backup archives. ## What this PR does / why we need it: Cherry-pick the two final, merged `4.2-dev` fixes onto the hotfix base `3391c6844e95d1bb27a647b18f48f7c3a5ba1695`, preserving them as separate commits: | Upstream PR | Upstream commit | Hotfix commit | Purpose | | --- | --- | --- | --- | | matrixorigin#29504 | `6d4569bce66acb67e6d0fe746ee537da7955bffd` | `2bf7df8892748f7ff8fe160641b52a7acaa70d9e` | Safely omit reclaimed historical objects without dropping required snapshot/shared-owner data | | matrixorigin#30744 | `b7d2cc7b5644641da580dd5650a02211167a781d` | `969680122fdebccfacdb21b7c84f40b5204878b3` | Preserve real table-ID history across physical backup/restore so an immediate GCKP can validate its required history | Both cherry-picks are conflict-free and their stable patch IDs match upstream. No unrelated `4.2-dev` commits, hotfix-specific production changes, retention-policy changes or weakened GCKP checks are included. ### Backup object selection - Resolve object lifecycles before physical-file deduplication; retain other live owners, compacted references and restore-boundary objects. - Require an actual persisted GC scan interval before using absence from remaining objects to omit a deleted lifecycle. A GC filename is only a recovery watermark and can be advanced without scanning by `CopyGCDir`. - Keep the existing block-zero format and add an optional scan-proof block. Unknown legacy coverage stays conservative; incomplete reads and malformed proof fail rather than publishing a partial backup. ### Restore history - Copy and checksum the exact predecessor's real table-ID index before bulk data copying. Reuse matching destination bytes; reject mismatches without overwriting. - Merge retained history through the rewritten backup checkpoint, persist the index location, and include its files, sizes and checksums in the archive manifest. - Preserve the distinct global/incremental successor-boundary conventions. - On pre-publication failure, clean only newly generated, unambiguously unpublished destination index files. Do not delete source data or potentially published history files. ### Validation Performed on the combined hotfix head, Darwin/arm64 CPU, Go 1.26.4, with freshly built branch-matched native artifacts and the repository CGo wrapper: - Focused combined backup/GC/history regressions: PASS. - Full normal suites with `-vet=all`: `pkg/backup`, `pkg/vm/engine/tae/logtail`, `pkg/vm/engine/tae/db/gc/v3`, `pkg/vm/engine/tae/db/checkpoint`, `pkg/vm/engine/tae/db`, `pkg/objectio`, and `pkg/datasync`: PASS. - Full race suites: backup, logtail, GC v3, checkpoint, and DB: PASS. - `TestBackupRestoreGlobalCheckpointWithFreshWAL`: normal/race PASS, plus 19 consecutive race repetitions PASS. This exercises a separate restored WAL, immediate GCKP, durable 24-hour history coverage, archived checksums, LSN `4 -> 0 -> 1`, post-restore writes and complete row/value checks after another restart. - `TestGlobalCheckpointTableIDHistoryFallbackAndFailClosed`: normal/race PASS, plus 36 consecutive race repetitions PASS. Missing history still rejects GCKP, and repeated rejected attempts do not accumulate unreachable objects. - Historical snapshot retention, repeated backups with inherited GC watermarks, legacy metadata, scan gaps, owner/type/epoch boundaries, partial reads, cancellation, checksum mismatch and cleanup-failure cases: PASS in the owning suites. - Go-toolchain-matched `gofmt` and `git diff --check`: PASS. These are real engine/file-service integration and component tests, not an external mo-backup image, production-scale performance or production restore acceptance. No production environment was changed. ### Rollout boundaries - matrixorigin#29504 includes both CN backup selection and TN scan-proof production. Updating only the external backup tool cannot substitute for updating the relevant MO components. - Legacy metadata without trustworthy scan proof may still cause conservative backup failure. Upgrading cannot retroactively certify old scans or guarantee that one new GC cycle covers every old object. - matrixorigin#30744 preserves history in newly generated archives; an existing archive that already lacks that history is not repaired retroactively. - Source GC deletion/retention policy is unchanged. Extra metadata reads and backup-time history work exist; zero overhead or universal production recovery is not claimed. --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> Co-authored-by: XuPeng-SH <[email protected]> (cherry picked from commit e0e2308)
…matrixorigin#32112) ## 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: Related to matrixorigin#31089. Backports the Window lifecycle fix from matrixorigin#31127 to the 4.2.1 hotfix branch. ## What this PR does / why we need it: A prepared JOIN followed by a Window can leave account-owned input and expression buffers alive after execution. Window Reset clears their logical data but retains their backing, so allocation-account finalization reports an invariant failure and suspends admission for subsequent account-owning queries on the same CN. Release the Window-owned buffers belonging to an allocation account at Reset, detach the result wrapper's borrowed references, and clear freed expression slots. Continue reusing unaccounted buffers. The change scans Window's buffered vector slots at Reset; it does not add per-row work or change account admission policy. On base `87866e6d2822`, a three-row prepared JOIN with an unpartitioned cumulative SUM reproduced `allocation account invariant failure` (48 bytes, four allocations); a subsequent JOIN failed with `allocation account admission is suspended`. A direct Window/registry control reproduced the same transition and showed that freeing Window's retained buffers releases the suspension. The user's incident has not yet been correlated with this specific query shape. Validation on macOS arm64, Go 1.26.4, with native libraries built from this hotfix source: - Full Window package normal and race tests. - Public prepared SQL regression normal and race: literal and prepared JOIN/window queries, repeated and empty executions, result equality, and new connection authentication. - Window account regression: partitioned and unpartitioned execution, cancellation, direct Free, two generations, and unaccounted buffer reuse. - Incremental formatting, vet, repository error checks, molint and golangci-lint for the affected packages. GitHub CI is pending. The standalone customer workload and Linux runtime have not been tested in this local run. (cherry picked from commit d8286ad)
…xorigin#32138) ## 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: Related to matrixorigin#27968. Cherry-picks the Area ownership fix from matrixorigin#28369 (`027194e3ac2a`) to the 4.2.1 hotfix branch. ## What this PR does / why we need it: When bulk appending variable-length Vector data, an allocation or budget rejection can return a nil Area while the previous Area is still allocated. Assigning that result directly to the Vector loses the only cleanup reference. HashJoin can then finish with a nonzero allocation account and suspend later account admission on the same CN. Keep the existing Area until growth succeeds. The conflict was resolved in the 4.2.1 branch's existing `UnionBatch` fast path; allocation policy, error classification, and successful copy behavior are unchanged. The original PR's tests and SQL fixtures are included. A test-only follow-up replaces unsafe pointer inspection with guarded slice access while retaining the zero-length/nonzero-capacity ownership check. Validation on the 4.2.1 base `d8286add2798`, macOS arm64 and Go 1.26.4: - Before the fix, Vector and real HashJoin admission tests reproduced a 4096-byte live allocation and suspended next admission. With the fix, both pass with zero live bytes and usable next admission; successful-growth controls pass. - Full Vector and HashJoin packages passed normally and with race; final adapted regression tests passed normally and with race. - With an isolated single-CN 8 MiB budget, the same HashJoin SQL/physical plan reproduced a 524288-byte account invariant and suspended admission on the base. The fixed candidate returned the ordinary budget error and both existing and new connections returned the expected 16384-row count. - The picked default mo-tester case passed 19/19 twice on the same isolated instance with teardown checked. The picked 8 MiB isolated SQL/result passed 15/15 in mo-tester comparison mode with teardown checked. - Incremental formatting, vet, golangci-lint and repository error checks passed. Molint has no findings in the changed files; its output still includes one pre-existing `checkunsafe` diagnostic in `pkg/container/vector/functionTool_test.go`. The reported customer incident has not yet been tied to this exact SQL path. GitHub CI and validation on the deployed image are pending. --------- Co-authored-by: 和光同尘 <[email protected]> (cherry picked from commit 15b1983)
aptend
requested review from
LeftHandCold,
XuPeng-SH,
aunjgr,
fengttt and
volgariver6
as code owners
November 13, 2026 09:47
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? |
Contributor
|
This pull request is merged. |
2 of 7 tasks
fengttt
approved these changes
Nov 13, 2026
XuPeng-SH
pushed a commit
that referenced
this pull request
Nov 14, 2026
## 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: Related to #25077. ## What this PR does / why we need it: Upgrading a 3.0.4 catalog can fail inside the v4.0.0 migrations: COPY ALTER's lineage hooks query `mo_feature_registry` and `mo_snapshots.kind` before those migrations have installed them. Reordering the registry creation alone cannot fix ALTER of `mo_snapshots` itself. Mark statements issued by `UpgradeEntry` with a statement-scoped internal option. COPY ALTER skips its lineage preparation and preservation hooks only when the option is present and the resolved database is `mo_catalog`. Ordinary ALTER retains its lineage behavior, and the existing statement-context defer clears the marker on success/error. Migration SQL, ordering, versions and offsets are unchanged. This PR targets `v4.2.1-hotfix` independently of #32699; the combined tree is also validated. Validation (Linux/amd64, Go 1.26.4, CGO enabled): - Full owning-package suites: `.agents/skills/mo-dev/scripts/mo-cgo-test -json -p=1 -count=1 -timeout=240s ./pkg/defines ./pkg/util/executor ./pkg/bootstrap/versions ./pkg/sql/compile ./pkg/tests/upgrade`. - Regression coverage includes explicit/default catalog resolution, marked user-database and unmarked catalog controls, context restoration after parse failure, upgrade rollback/retry/idempotency, and preservation of an existing snapshot row. - Persisted official v3.0.4 data with two accounts, snapshot and PITRs: direct upgrade, restart, resume after original failure, resume after manual table creation, and fresh installation. Business ALTER, historical snapshot reads and data-branch ALTER are checked. - `pkg/sql/compile` and `pkg/tests/upgrade` also pass atop #32699. - `make thirdparties`, `make cgo`, release `make build`, and full `go vet -mod=readonly -p=4 ./...`. - Pinned golangci-lint 2.6.2, unchanged repository configuration, tests and affected reverse dependencies covered: `golangci-lint run --new-from-rev=origin/v4.2.1-hotfix ./...` and the same check against freshly fetched `origin/main`. - Full molint has no new findings; its three unchanged `checkrecover` findings reproduce on clean base `115c227239`. `gofmt` and `git diff --check` pass.
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.
What type of PR is this?
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; thev4.2.1-hotfixbranch at115c227239does 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.2026090207a7e871ec202609092cb5379d78202610259ebefa5bc12026102647e644f2d7202610297ce664f08a,f6a27941d7,3391c6844e20261030e0e2308d0720261104d8286add27,15b1983f04All ten cherry-picks are conflict-free and retain their source patch IDs and
-xprovenance. The ETL and multi-CN IVF fixes are already present in the base;9572bd3311and87866e6d28require no duplicate changes. The final tree equals the20261104tag plus the20260902pipeline and20260909catalog 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
make thirdparties,make cgo, and releasemake build: PASS.pkg/tests/issues: PASS.go vet -mod=readonly -p=4 ./...: PASS..golangci.yml, tests enabled, full package/reverse-dependency coverage: PASS against bothorigin/v4.2.1-hotfixand freshly fetchedorigin/mainusingrun --new-from-rev=<base> ./....molint check -mod=readonly -p=4 ./...: no new diagnostics. Threecheckrecoverfindings in unchanged CDC, lockservice and planner code reproduce identically on clean base115c227239.mo-testercomparison 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.