Repository navigation
perf: bound regular-index backfill work - #32039
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: "interrupted" |
|
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: 7e99ea5afa1739611588372c3582e5ddd33f651f
Assessment: approve
Exact IN matching, packed-key ownership, reader cleanup and planner admission controls are preserved. The documented performance tradeoffs are acceptable; no actionable unresolved findings remain.
Model: gpt-6-astra / xhigh
Session: 01a1869d-999c-7481-b340-ae4a63e8cee4 · slot 1 · generation 2
Validation:
-
Executor preflight and native build passed; 193 native input files matched the frozen head.
-
Normal short-mode readutil and planner suites passed. Focused CDC/ISCP ownership tests and public TestIntegerIndexAccess passed.
-
Three interleaved workspace benchmark rounds confirmed lower construction time and allocations, with slower probing in the 1,000-key workspace cases.
-
Verified source unchanged, patch consistency, all three discussion keys, command receipts and retained logs. Evidence is recorded in review-plan.md, discussion-assessment.json and validation-summary.json under the assigned diagnostic directory.
Limitations:
-
Two unrelated planner subtests were skipped.
-
Author-reported race and two-CN performance checks were not independently rerun; relevant CI was pending in the supplied evidence.
-
Workspace component probes with 1,000 keys were 31–44% slower when scanning batches, while construction was about twice as fast. This is an accepted memory-saving tradeoff, not an end-to-end SQL latency measurement.
|
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: 2dc705f6f342405fbb4ff4bc554cd35af003f972
Assessment: approve
Complete review found no actionable defects. The added BVT coverage checks broad AUTO scans, selective AUTO backfills and small-table behavior while retaining FORCE controls. Production code and previously validated Go tests are unchanged.
Model: gpt-6-astra / xhigh
Session: 01a1869d-820c-7212-9788-aecfb86a4141 · slot 0 · generation 2
Validation:
-
Reviewed all 17 changed files, the design, linked issue and seven discussion entries.
-
Receipt-backed source audit verified the four-file additive BVT delta, preserved earlier statements, formatting and unchanged source.
-
Independently verified all 134 new expected rows and metadata, plus AUTO/FORCE plan expectations. Evidence: source-bvt-audit.json and validation-summary.json.
-
Reused source-matched coverage from the two supplied prior reviews. The author reports two updated BVT passes, 201/201 each.
-
Saved review-plan.md and discussion-assessment.json; final receipt and discussion-coverage audit passed.
Limitations:
-
No Go or SQL tests were rerun locally. Prior execution coverage and updated BVT results were reused from supplied reports; raw execution logs are absent.
-
Relevant CI remained pending in frozen evidence.
-
The previously accepted workspace tradeoff remains: slower 1,000-key probing in exchange for faster construction and lower allocation.
|
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: d94103eca7ebcd41956ccf0679234b599d036d53
Assessment: approve
No actionable unresolved findings. Exact membership, retained-key ownership, concurrent lookup initialization, workspace cleanup and planner controls are preserved.
Model: gpt-6-astra / xhigh
Session: 01a1869d-820c-7212-9788-aecfb86a4141 · slot 0 · generation 2
Validation:
-
Reviewed all 18 changed files, affected consumers, design, linked issue and all ten discussion entries.
-
Isolation preflight and native build passed; 193 native input files matched the frozen head.
-
Full readutil suite passed normally and under race detection: 131 top-level tests, no skips. Concurrent first-use test passed 100 additional race repetitions.
-
CDC/ISCP retained-key ownership tests and public TestIntegerIndexAccess passed normally and under race detection.
-
Verified 134 added BVT expected rows, formatting, patch consistency and unchanged source.
-
Receipts and retained logs reconciled in validation-audit.json; review-plan.md and discussion-assessment.json completed.
Limitations:
-
Relevant CI remained pending in the frozen evidence.
-
Distributed BVT and two-CN performance checks were not independently rerun. Matching prior-review and author reports were reused; their raw execution logs were unavailable.
…#32039 visitEncodedPrimaryKeyVector took over the switch from EncodePrimaryKeyVector, so its baseline key no longer matched. Low-precision floats and VECTOR columns are rejected as primary key columns at DDL; tag the switch and drop the stale baseline entries. Co-Authored-By: Claude Opus 5.5 <[email protected]>
What type of PR is this?
Which issue(s) this PR fixes:
Fixes #32015
What this PR does / why we need it:
A noncovering secondary-index query on a table without an explicit primary key can spend almost all CPU comparing every base key against every candidate key. On a flushed 1M-row table with 1,000 matches, the automatic index plan took about 201 ms while the same SQL with IGNORE INDEX took about 2 ms. Broad real-PK lookups also paid substantial per-reader candidate preparation cost that automatic admission did not account for.
Previously validated local warm-cache SQL results (unchanged block-search and planner paths):
Representative results (2 CNs, 1M rows, matching SQL/results, nine interleaved samples per decision workload):
The DOP-1 broad lookup also selects scan (4.58 ms vs 4.74 ms with IGNORE INDEX). A clustered wide-column control retains the beneficial index plan (0.92 ms vs 2.12 ms scan). Forced no-PK backfill drops from about 193 ms to 5.92 ms, independently confirming the execution improvement. Encoder calibration at 100k integer keys reduces allocated bytes/key from about 162 to 56 after descriptor preallocation. These are local warm-cache measurements; locality, statistics and hardware still affect plan quality.
Final workspace component measurement, including candidate encoding and filter construction (1,000 integer candidates, 8,192 rows/batch, three 300 ms repetitions): baseline to final medians are 68.5 to 34.3 μs for construction, 448.6 to 275.1 μs for one batch, and 6.17 to 3.52 ms for 16 repeated batches. Sixteen-batch allocated bytes fall from 12.63 MB to 0.116 MB. These are component measurements, not transactional SQL latency claims. Additional narrow/128-byte key checks cover K=8/1,000/100,000 and N=1/8,192. Lazy maps retain the original hash implementation's candidate-memory cost after initialization: 100,000 wide keys across eight filters retain about 278 MB of Go heap in both versions (GC heap delta, not RSS). Candidate/reader fan-out still matters. The O(K) first-use map build runs under the existing workspace transaction lock and is not interruptible; no universal cancellation-latency or optimal-plan claim is made.
Validation (Go 1.27.1, -short, matrixone_test): full normal tests for readutil, plan, blockio, disttae, compile, cdc, iscp and logtailreplay; public TestIntegerIndexAccess covers both PK layouts, persisted/workspace data, prepared reuse, duplicate rows and rollback. Affected nine-package vet, pinned molint and configured incremental golangci pass. All eight owning packages and the public SQL regression also pass under -race. The workspace amendment additionally passes six affected owning packages normally and under race, public transaction SQL normally/under race, final encoder boundary regression normal/race, and affected nine-package incremental SCA with a final readutil delta check. Concurrent IN first use/replacement, fixed/variable constant ownership and shortened-constant failure contracts are covered. Remote CI is separate from these local checks.
Design. Design and independent final overall review use gpt-6.1-terra/max. The workspace amendment was designed before implementation and reconciles the entire PR with the preserved block/planner evidence.
CI regression coverage: unhinted broad-range EXPLAIN cases assert the cost-based scan choice, while selective unhinted OR ranges and a small clustered fake-PK range assert automatic non-covering index selection and full query results. Separate FORCE INDEX controls retain broad-range index-plan coverage. The clustered positive exercises small-table access-shape policy; it does not establish large-table cost admission or a performance win. The sequence retry late-join test uses virtual time while retaining exact deadline, probe, lock and terminal assertions. Both affected BVT scripts passed twice on the CI merge build (201/201 combined per run: 75/75 and 126/126); the compile package passed normally and under race, including 100 race repetitions of the late-join case.