Repository navigation
fix: preserve prefix predicates through pruning and row reordering - #32825
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? |
|
This pull request is merged. |
|
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: 9393b21b4c5589ef5cde1baf6c1be541f7783371
Assessment: approve
The prior raw-prefix defect is resolved. Shared checked preparation and reuse of existing scan scratch preserve prefix semantics with bounded ownership and justified pruning gains. No actionable findings remain.
Model: gpt-6.1-sol / max
Session: 01a1a004-90c3-73b1-acc9-3d4636452003 · slot 0 · generation 0
Validation:
-
All six owning packages passed build, vet and normal tests. Both colexec packages passed full race runs; four focused lifecycle tests each passed 100 race repetitions. Receipt/log mappings are retained in validation-summary.json.
-
All 12 focused tests passed. The baseline production overlay fails overlap and encoded-order cases while empty/NUL controls pass; the candidate passes all cases.
-
Independent SQLite/scalar evaluation verified 15 added SQL fixture results; this does not exercise MatrixOne flush/restart.
-
Final audit passed: checks/1794884002491722949-2.json matches review-source-audit.log, verifying frozen sources, 15 patch/blob indexes, formatting, discussion coverage, native provenance and validation receipts.
Limitations:
-
The original macOS persisted dataset was unavailable. No local MySQL/restart/BVT or benchmark campaign was run; author-reported lifecycle and performance results remain attributed evidence.
-
Owning CI checks were pending in the supplied snapshot and were not counted as passes.
Invalidate ascending metadata only for successful disordered selections. Consume selection-derived metadata and bitmaps before replacing input data. Cover scalar prefix results after ORDER BY, shared selections and failed admission.
|
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: f502da16296fde9fd103df45dd3e4a6b1e1de8a7
Assessment: approve
The prior raw-prefix defect is resolved. Shared checked preparation and existing scan scratch preserve prefix semantics with bounded ownership; shuffle corrections keep sortedness and row bitmaps consistent. No actionable findings remain.
Model: gpt-6.1-sol / max
Session: 01a1a004-9884-72c0-ad39-f096c4209c4a · slot 1 · generation 0
Validation:
-
All 24 focused test functions passed. Twelve affected owner/dependent packages passed build, vet, full normal tests and full race tests. Eight suite tests skipped in each mode; none were focused tests.
-
Four lifecycle tests each passed 100 race repetitions; measured T/B/N and logs are retained.
-
The merge-base vector.go control failed the three intended regression tests; the candidate passed. An independent scalar oracle verified 18 SQL expectations.
-
Isolation preflight, formatting, diff-check and frozen-source/native/receipt audit passed. Final receipt: checks/1794889237428385852-2.json; detailed reconciliation: validation-summary.json.
Limitations:
-
The original macOS dataset was unavailable. No local MySQL/BVT, restart or benchmark campaign ran; author-reported results remain attributed evidence.
-
Owning CI checks were pending in the supplied snapshot.
|
mo-bot review · Commit: "interrupted" |
## 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 #30420 (native-reset fix on main: #30426) and #28452 (related HAKeeper transport recovery). Related: #32825 and its [failed UT run](https://github.com/matrixorigin/matrixone/actions/runs/44011324458/job/133798814581). ## What this PR does / why we need it: A native connection reset can escape HAKeeper recovery during ID allocation, making an operation such as CREATE DATABASE fail. Recognize wrapped `ECONNRESET` and the relevant typed backend connection errors in the existing retry path; preserve the MORPC backend-creation timeout sentinel as a non-retryable result. Keep client ownership in the managed client: closing it now ends admission and wakes retry waiters, and a late failure only resets the client generation that actually failed. This prevents a retry from recreating a client after `Close` and prevents a stale failure from closing its replacement. Honor cancellation before issuing cached IDs or publishing a newly constructed client, and pass the caller context through reverse-proxy discovery while retaining discovery's own RPC options. For callers with an explicit MORPC backend-wait deadline, newly retryable transport failures return their original error after the current failed attempt rather than starting another HAKeeper-level dial. Existing EOF/NoHAKeeper retry behavior is preserved. An already-running synchronous dial or client cleanup can still overrun a caller or backend-wait deadline; this PR does not claim a hard end-to-end timeout. Lost allocation responses can still produce ID gaps, and the initiating server-side reset in the reported CI run is not established. Validation on 10.222.1.57, Linux/amd64, Go 1.26.4 and matching CPU CGo libraries: - Reproduced retry after `Close` and late-generation failure; regression coverage exercises terminal close, concurrent callers, cleanup errors, context cancellation and recovery, including a real MORPC backend-creation timeout. - `pkg/logservice` in normal and race modes (`-short -tags matrixone_test -count=1`): 307 passing root tests / 463 named passes, zero failures and one existing skip in each mode. Each of 17 changed/new roots also passed 100 race repetitions. - Existing three-CN `TestTableFeatures` passed with race and its original topology and assertions; existing MORPC backend-wait and HAKeeper ID-state-machine controls passed under race. - Formatting/diff checks, vet, pinned molint and incremental golangci-lint passed for the owner and direct constructor/consumer closure (nine packages). The logservice suites used isolated user/network namespaces after a pre-existing host listener prevented an unrelated Gossip test from binding its port; no test assertion or port was changed. Cached ID admission adds a context/close check under the existing lock; a single-CPU microbenchmark measured roughly 2 ns/op extra and zero allocations, not an end-to-end throughput measurement. CI for the updated head is pending.
What type of PR is this?
Which issue(s) this PR fixes:
Fixes #32822.
What this PR does / why we need it:
Persisted prefix-IN pruning needs ordered, nonoverlapping candidates before binary membership and first/last bounds are safe. Encoded NULL bytes can disturb that order. Treating every empty or zero-leading payload as NULL also discards valid raw prefixes and produces false negatives after flush.
No SQL syntax, persisted format or protocol change. No new cache, worker or per-permutation allocation.
Validation on host 10.222.1.57, Go 1.26.4, matching CPU CGo libraries:
Same-machine pruning benchmarks against base
fc6c7fee10f1, five samples:The scan allocates about 99 KB versus 885 KB. Prepared ZoneMap probes remain allocation-free, with about 1–4 ns added for guards. Cold verification is retained because the sorted flag does not prove order or prefix freedom. Safe seek is linear: about 33 µs for 4,096 skipped blocks; the previous binary seek was unsafe with unknown summaries. Complete traversal measured about 32 µs with safe seek versus 79 µs without it for a late match. These measurements cover pruning, not whole-query throughput.
The final row-permutation correction was measured separately against published
9393b21b4c55: pinned CPU, single thread, bounded ABBA order and six samples per variant. Across 16 three-column shuffle cases (128/8,192 rows, buffered/allocating, sorted/unproven, ordered/permuted), median changes range from -3.9% to +9.3%, with no added allocations. The 8,192-row/128-prefix ordered pipeline is 141.62 → 143.45 µs (+1.3%); always clearing sortedness instead takes 356.10 µs. The corrected permuted pipeline takes 351.19 µs; the previous incorrect output is excluded from performance comparisons.The original preserved macOS dataset was unavailable. Validation uses constructed persisted data and deterministic metadata counterexamples. Updated-commit remote CI remains pending.