Repository navigation
Fix point-update secondary index maintenance scans - #32243
Conversation
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? |
|
mo-bot review · Commit: Review completed. Read the assessment. |
XuPeng-SH
left a comment
There was a problem hiding this comment.
mo-bot review · mo-bot-local · review
Commit: 1491babb9a0dbc3eab90dc87bed82fd1ee9f7648
Assessment: approve
The bounded singleton proof supports selective maintenance of multiple indexes while reusing existing filter delivery, budgeting and cleanup. The reported scan reduction justifies the added proof logic; no actionable defects remain.
Model: gpt-6.1-sol / max
Session: 01a1a004-90c3-73b1-acc9-3d4636452003 · slot 0 · generation 0
Validation:
-
Reviewed all six changed files, linked issue, discussion and affected planner/compiler/HashBuild consumers.
-
Local source and independent relational/SQL-oracle audit passed: source-audit.log and checks/1793871937421022604-2.json.
-
Reused author-reported planner/race, HashBuild/topology and live SQL/performance evidence after checking revision and semantic scope.
Limitations:
-
No local Go tests or SQL/BVT rerun; native prerequisites and raw author execution logs were not supplied.
-
Substantive current-head CI remains pending. Reported AP measurements show scan reduction without a latency improvement.
c0ddd57 to
8dd7c8d
Compare
|
mo-bot review · Commit: Review completed. Read the assessment. |
XuPeng-SH
left a comment
There was a problem hiding this comment.
mo-bot review · mo-bot-local · review
Commit: 8dd7c8d9ea9e9a55bb19c4d15546c5e33d84e4a9
Assessment: approve
The bounded singleton proof enables selective multi-index maintenance through existing runtime-filter delivery and budgeting, without changing statistics or placement. The shutdown, fixture-ownership and static-analysis repairs reuse existing owners and address observed blocking and memory costs. No actionable findings remain.
Model: gpt-6.1-sol / max
Session: 01a1a004-9884-72c0-ad39-f096c4209c4a · slot 1 · generation 0
Validation:
-
Reviewed all 32 changed files, linked issue #32221, all four discussion entries and affected planner/compiler/HashBuild, shutdown and fixture consumers.
-
Qualified prior review 5782897144 by source identity: five feature files are unchanged; the sixth differs only in process-fixture cleanup. Subsequent repairs were reviewed independently.
-
Local preflight and source audit passed: pinned clean head, 27 Go files formatted, 29 SQL/result commands aligned, nine expected results checked with an independent SQLite relational oracle, preserved Makefile checks and complete discussion coverage. Logs and matching check-run receipts are retained.
-
Reused author-reported planner normal/race, HashBuild/topology, 29/29 SQL regression and two-CN prepared/index/concurrency/cancellation checks for unchanged feature code. Reported 50k-row point median improved from 15.47ms to 1.22ms with each index scan reduced to one row.
-
Reused author-reported owning-package race, named 100x stress, final planner race and incremental static checks for the repairs. Reported x86 static analysis stayed within an 8GiB limit; the preceding full-analysis run and final incremental checks were distinguished.
Limitations:
-
No fresh local Go, MatrixOne SQL, race or performance execution; author raw logs and native build inputs were not supplied. The local SQLite audit checks expected relational results only.
-
Frozen-head shared build, Ubuntu unit tests/coverage and Linux arm64 static analysis remain pending. Final arm64 memory behavior and external workflow license-step execution are unverified.
-
Reported AP runs demonstrate scan reduction without a latency improvement; the prior planner OOM is an incomplete run, not a completed before/after benchmark.
iamlinjunhong
left a comment
There was a problem hiding this comment.
Reviewed head 8dd7c8d9ea9e9a55bb19c4d15546c5e33d84e4a9 against 4.2-dev base ebf03dc42bf25ba00018da019783e1037299d1ae. No actionable findings; approve.
Reviewed all 32 changed files against the scope of issue 32221, including singleton proof and fallback, nested index ownership, runtime-filter delivery and memory-budget fallback, statistics cancellation, trace shutdown, test fixture ownership, and static-analysis changes. The shared CI workflow retains separate license checks when selecting the new analysis target.
According to the supplied exact-head review data, the 34 checks are 19 success, 13 skipped, and 2 neutral: they are not all successful, although none are failed or pending. The required CI gate, Ubuntu unit tests and coverage, arm64 static analysis, shared build, and both active BVT jobs succeeded. CI run.
Validation performed here: source and caller-path review, git diff --check, and the provided read-only PR artifact check; both checks passed. Local Go/race/SQL/performance execution was skipped because no remaining concrete uncertainty required a targeted reproduction and exact-head CI evidence was available. Author-reported local performance and stress results were not independently reproduced.
This is the first review by this reviewer. The supplied history contains no prior findings or inline threads requiring an author-response assessment.
|
mo-bot review · Commit: New discussion was assessed; the previous review remains unchanged. |
## What type of PR is this? - [ ] API-change - [x] BUG - [x] Improvement - [ ] Documentation - [ ] Feature - [ ] Test and CI - [x] Code Refactoring ## Which issue(s) this PR fixes: Related to #30125. Backport of #32191. ## What this PR does / why we need it: Bound HashBuild runtime-filter key collection to aligned chunks of at most 8,192 rows, with earlier splits for component-vector byte limits. This avoids growing one key vector across the entire build. The ordinary path collects newly inserted hash groups; HashOnPK retains the existing primary-key uniqueness assumption. Account for chunk metadata, roll back failed multi-column appends, and reject invalid checkpoints without publishing partial keys. Keep the ordinary IN encoding and single-chunk fast path. Numeric runs are copied and sorted in the final admitted buffer; other sorted runs are merged without a whole-build vector. Inline runs whose key ranges are already ordered can use the same admitted buffer and bulk-copy path. Integrate the 4.2-dev composite-primary-key filter from #32400: convert components in probe-key order for each chunk, use the converted vectors for bounds and encoding, and turn an out-of-range optional filter into whole-filter PASS. A cancellation already observed at that fallback remains an error. Publish membership keys as one immutable, reference-counted payload and adapt the existing 4.2-dev IVF/fulltext consumers to visit all chunks. IVF may use a complete exact SQL predicate or a tagged reader filter, according to the existing key-type contract. Required non-integer IVF membership retains the 8 MiB global literal-list limit and fails rather than becoming partial or approximate. The release keeps its existing TVF architecture and native filter ABI. The rebase also adapts the #32243 optional-collection failure tests to the chunked owner, preserving PASS, complete JoinMap, wide-key lookup, and accounting checks. It retains the author's concurrent merge fixes and fixture cleanup. ## Validation of the rebased production tree - Normal and race suites for the 12 changed/affected CPU packages; HashBuild, runtimefilter and the planner were rerun after the last production change. The exact two-CN role-grant fixture was also run under `-race -short`. - Four focused lifecycle tests each passed 100 `-race` repetitions: ordered-run cancellation and cleanup, composite narrowing, next-chunk admission failure, and cross-chunk rollback. HashBuild also passed `-short -covermode=set` (74.7% of that package's statements; this is not changed-code coverage). - An embedded SQL differential test verified an actual `serial(cast(...), ...)` composite-PK runtime-filter plan with 9,000 build keys; enabled, disabled, out-of-range and NULL controls returned the same 9,000 matches. The input exceeded one chunk, but the SQL experiment did not instrument per-operator chunk count; white-box tests explicitly construct and validate multiple chunks. - The repository's IVF membership BVT ran twice in normal comparison mode on one isolated CN after SQL and ISCP readiness: 44/44 statements each time, zero ignored, with both test databases verified absent after each run. - Incremental `gofmt`, `molint`, and golangci-lint 2.6.2 passed over the changed package closure. The additional planner scan reports three `checkrecover` items at identical lines on the unmodified 4.2-dev baseline. Tests used Go 1.26.6 and CPU native libraries; a rebuild from the same tracked native sources produced an identical libmo executable-code section. ## Performance and limits In a local pinned-CPU microbenchmark comparing the rebased code immediately before and after the ordered-inline optimization, three-sample medians for ordered composite keys changed from 1.156/1.190 ms to 0.880/0.907 ms at 8,193 rows and from 10.341/10.101 ms to 7.537/7.755 ms at 65,536 rows (direct/cast respectively). Single-chunk controls also varied 4–8%, so these are local measurements, not a general speedup claim. Randomly interleaved 65,536-row cases changed by +2.4%/+1.4% in another three-sample comparison. Chunking still increases Go allocations: the 65,536-row cast fixture used about 111 allocations on the 4.2-dev baseline and 359 here. Go allocation figures exclude MPool/native memory. CUDA, mixed-version rollout, multi-gigabyte workloads, peak MPool/native memory and end-to-end OLAP performance were not independently validated in this run. The author previously reported full-repository SCA and additional 100-run ownership stress on the earlier PR revision; those reports are historical evidence, not new-head CI results. Design: [bounded HashBuild key collection and 4.2-dev integration](https://github.com/aunjgr/matrixone/blob/91c9bbf26c012fab1cc8a4a4e7bb2f73373d7977/docs/design/hashbuild-key-batches.md). --------- Co-authored-by: XuPeng-SH <[email protected]>
What type of PR is this?
Which issue(s) this PR fixes:
Fixes #32221
What this PR does / why we need it:
A point update of an indexed column can scan the full secondary-index table when default or stale statistics cause the runtime-filter cost heuristic to reject the maintenance join. With two maintained indexes, each scan can read all 50,000 rows even though the base primary-key lookup returns one row.
When an otherwise rejected broadcast INNER join has an ordered full-PK probe and its build is provably at most one row, admit the existing exact runtime filter without changing statistics or join placement. The proof supports a conservative chain of unique-key joins so multiple regular indexes can be maintained selectively. It verifies source index ownership and the full untruncated integer primary key, worker-invariant join expressions, and matching filter dependencies; unsupported shapes retain existing costing. The execution path, memory accounting, and PASS/error behavior remain owned by the existing runtime-filter implementation.
Historical feature validation on Go 1.26.4 with
GOEXPERIMENT=simdandGOAMD64=v3, before the CI repair follow-up:The live service experiments used the preceding candidate build. The final commit relaxes only a cross-table schema-version comparison; both scan references in those experiments use version zero, so their execution behavior is unchanged. The original feature validation below predates the CI repair follow-up.
pkg/sql/plantests and race tests; focused HashBuild optional-budget, cleanup, and reset race tests; focused compile broadcast/runtime-filter topology race tests.gofmt,go vet, and repository-pinnedgolangci-lintpass for the changed packages. The repository's custommolintalso reports three existing findings in untouchedexpr_opt.goandreturning.go.The proof deliberately falls back for unrecognized index metadata, unsupported predicates/types, partitioned sources, and other unproven join shapes. CI for the updated branch is pending.
CI reliability follow-up
The failed Ubuntu race job exposed a shutdown wait: the transaction trace watcher could enter a synchronous statistics lookup that did not wake when its caller was canceled. It also exposed timing-sensitive CDC and file-service tests. The arm64 static-analysis runner was OOM-killed at its 8 GiB limit while using the legacy full-check path.
CI repair validation
pkg/cdc,pkg/fileservice,pkg/txn/trace, andpkg/vm/engine/disttae: full package race tests; 13 named concurrency tests each repeated 100 times under race.pkg/embed.TestBasicCluster: race test using-short -tags matrixone_test.pkg/sql/plan: the full package now passes in a single-short -race -tags matrixone_testprocess (5.00 s). A previous full run before the fixture fix was OOM-killed at a 10 GiB cgroup limit; after the fix, a complete run peaked at 1,148,952,576 bytes (about 1.07 GiB). These are not two completed-run benchmarks.pkg/testutil,pkg/sql/plan/tools,pkg/sql/colexec/hashbuild, andpkg/sql/compile: full package race tests. Selected service-ownership, planner-context, and runtime-filter tests each passed 100 repetitions under race.gofmt,go vet, pinnedmolint, and configured golangci-lint across 11 changed or directly affected packages; full license header and dependency checks. The local x86_64 check ran in an 8 GiB cgroup, peaking at 6,646,784,000 bytes (about 6.19 GiB) with no OOM events. After the final fixture cleanup, planner vet, molint, and golangci were rerun.molintreported ten existing unsafe-recover diagnostics in seven files unchanged from the merge base; it reported none in changed files.make static-check-analysis GOLANGCI_LINT_CONCURRENCY=1withGOMEMLIMIT=3GiBexited 0; repository-configured golangci-lint reported 0 issues. The full molint run also emitted existing diagnostics in unchanged baseline files. The final planner-fixture follow-up was covered by the incremental checks above.The updated head's arm64 SCA and complete CI remain to be verified.