Repository navigation
refactor(sql): consolidate active owners and retire obsolete paths - #29574
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? |
Refs matrixorigin#29249. Reject missing cleanup and retained-pointer mutations using existing overflow/reuse scenarios.
Refs matrixorigin#29249. Preserve 24 literal oracles and benchmark populations while removing redundant correctness work; record paired owning-package CPU, RSS and elapsed evidence.
Keep scenario assertions and production timeouts intact. Release fixture-owned atomic blockUnlock flags after the callback and before the existing reset, which retains generation invalidation and retained-worker joining. Stage evidence: 74 related tests pass in normal and race execution; both directly affected tests pass 100 individual race repetitions. Six serial full-package normal runs pass. Median wall time 11.750s -> 9.869s; CPU 2.081s -> 2.451s and RSS 209.7MiB -> 199.9MiB on this shared host. No CPU reduction claim. Full-package race is NOT green: the regexp admission control failed with an engine timeout. Clean baseline passed; direct causality is not established. Deterministic probes separately expose idle and concurrent deadline defects in the pinned dependency; its complete fix is follow-up work. No dependency or production code changes are included in this stage. Read-only gpt-6.1-sol/xhigh review APPROVE for this non-final checkpoint. Configured incremental lint: 0 issues. MO lint: no incremental diagnostics. Refs matrixorigin#29249
There was a problem hiding this comment.
Diagnosis follow-up — 2026-10-03
User scope: MatrixOne only; deliver diagnosis evidence first. No dependency fork, upstream mutation, v2 upgrade, timeout relaxation or fix PR has been made.
Conclusion: a pre-existing regexp2 deadline defect is confirmed, but it has not been established as the cause of #29574's historical Linux full-package race failure. The earlier P2 is a historical validation/attribution gap, not a verified code regression introduced by this PR.
Current main and reproducibility
Verified clean main b210a0a5fc878e1e7d04c371297687de003ba292, Go 1.26.4, Darwin/arm64, platform-matched native artifacts, GOMAXPROCS=2 and GOMEMLIMIT=2GiB:
- Complete
pkg/sql/plan/function,-race -tags matrixone_test -p=1 -count=1, without-short: PASS, 19.490s. - Exact
TestRegexp2EvaluationAdmissionRejectsUnboundedRunnerGrowth, same mode,-count=100: PASS, 3.985s.
These are new passing evidence, not reproduction of the original Linux host/load. They do not prove that the old failure never happened or was simply “base flaky”.
Independent dependency root-cause proof
The declared pre-PR base 9078a8bd... and current main have identical regexp implementation/tests and dependency inputs: regexp2 v1.10.0.
- On actual dependency tag v1.10.0 (
03d34d8...), a white-box stopped-clock state with a stale tick and an epoch one minute earlier produces an already-expired newly requested one-second deadline. The exact assertion fails: returned tick 954 versus actual elapsed tick 57220. No scheduling sleep is the oracle. - v1.11.5 (
bbde16d...) repairs the serial restart but fails two separate, barrier-controlled interleavings: (1) a competing caller restarts the clock while the first awaits the slow-path mutex; (2) the first samples old current before the competing caller publishes a new clockEnd. - Applying the complete clock correction in a private diagnostic copy makes both interleavings pass 100 race repetitions each. The independent serial idle control also passes. The correction snapshots clockEnd before current and recomputes the deadline after acquiring the mutex even when another caller already restarted the clock.
The pause hooks live only in the disposable dependency diagnostic copy, not MatrixOne, the module cache or a delivery patch. Existing upstream test configuration uses a 1ms clock period; it was retained, not used to relax the requested deadline.
Repair boundary
The complete concurrent correction is present in upstream v2 936b3813, not the inspected v1.11.5/v1.12.0 releases. It cannot be pinned through the v1 module path. A v1-API-compatible complete backport is the proportional repair route; copying an entire dependency into MatrixOne, installing a second clock/worker or merely upgrading to the incomplete v1 fix is not justified. No external repository work is authorized for this stage.
The confirmed dependency defect and the unassigned historical package failure remain separate claims. No new MatrixOne code defect or causal #29574 regression is being asserted.
Historical review record (preceding diagnosis)
Post-merge status update: this review was started at 0a73284. During submission the PR had already merged after 93f7a8c, a merge of main fcd9686 into that same branch. Verified that the PR's production/test delta against its refreshed base is unchanged, including the lock-fixture change, regexp test/dependency and unresolved checkpoint record. The finding below is a remaining validation concern after merge, not a claim that the merged PR can still be blocked. I am not asserting that the regexp failure was introduced by this PR.
Deep review of 0a73284 against 9078a8b. Decision: NOT READY / changes required for validation closure. This is a COMMENT review because the authenticated reviewer is the PR author; it is not an APPROVE. No subagents were used.
P2 — reconcile the observed complete-function race failure before final approval. The current versioned design (Lock-fixture checkpoint review) records a candidate failure in TestRegexp2EvaluationAdmissionRejectsUnboundedRunnerGrowth: an admitted positive control returns "regexp match timed out", while the verified clean baseline full race passes. It explicitly leaves overall readiness blocked and says the independent regexp2 deadline probes do not establish causality. Thus neither "base flaky" nor "the fixture caused it" is currently proved. The proposed dependency fix is follow-up work, not a required solution: first discriminate deadline accounting, package interaction and external load, then close the actual failing invariant without widening timeouts, retries, skipping the control or adding an unrelated dependency branch.
I verified the later exact-head CI run 37098322396 is successful, including function in the resource-heavy race stage (-short -tags matrixone_test), SCA, build and multi-CN BVT. The named regexp control itself has no short-mode skip. This is valid additional passing evidence, but one successful different-mode/package-load run does not explain or close the explicitly recorded candidate-only failure under the controlled local mode. The acceptance record must reconcile both results with a concrete cause/control and final evidence; a blind rerun or a speculative clock patch is insufficient.
Design and implementation: reused the complete cumulative review at e37f979 for unchanged production closures, and read all eight subsequently changed artifacts. Temporal adapters retain existing arithmetic, metadata, selection, NULL and per-row warning owners. Literal allocation cleanup and constructor transfer are unchanged since the prior review. There is no newly added runtime state machine, cache, execution framework or persisted format. The new lock-fixture defer releases simulated atomic blockers before the existing generation/reset/join owner, including assertion/panic exits; current consumers do not install unlockResume channels. This change does not claim to fix every pre-existing detached-worker teardown limitation.
QA/test quality: DATE_FORMAT keeps the 24 independent literal pairs and six formats while replacing 4.9M repeated UT rows with 24; per-row format, NULL, mask and zero-date controls remain. The benchmark keeps its previous population and iteration policy. Constructor/account cleanup is registered before assertions; failure oracles precede fallback teardown. Zonemap tests now independently observe native bytes, Go-heap ownership and cleared scratch slots; recorded free-with-stale-pointer and outer-cleanup mutants distinguish the two invariants. No actionable historical GitHub thread remains.
Cost and scope: implementation +257/-1189, tests +1899/-3939, documents +213/0. Reported DATE_FORMAT package savings and lock-fixture wall-time improvement are bounded local measurements; lock-fixture CPU actually increases 17.8%, and no whole-CI/query performance claim is justified. The expanded evidence documents contain checkpoint history; that history is evidence, not additional production design. Historical SQL/executor/benchmark evidence remains valid for unchanged production inputs. Data compatibility is preserved; mixed-version upgrade was not treated as a requested review gate.
No additional verified code blocker was found in the follow-up. Final approval remains withheld for the unresolved failed-validation record above, rather than for speculative design preferences.
Latest checkpoint: 0a73284 (2026-10-03)
Non-final checkpoint. Overall PR readiness remains blocked: full function race FAILED.
Read-only gpt-6.1-sol / xhigh approved committing/pushing this narrow stage
under the explicit staging request, with the failed gate left open.
then reuse the existing generation/reset/join owner. No production or dependency edit.
full-race run. The two benefited tests each pass 100 individual race repetitions.
medians: wall 11.750s → 9.869s (-16.0%), CPU 2.081s → 2.451s (+17.8%),
peak RSS 209.7MiB → 199.9MiB (-4.7%). No CPU-saving or whole-CI claim.
incremental findings; its two unchanged unsafe diagnostics match prior evidence.
TestRegexp2EvaluationAdmissionRejectsUnboundedRunnerGrowthwith an engine timeout on the admitted positive control. Verified clean baseline
full race passes. Separate dependency probes prove serial/concurrent clock defects;
they do not establish causality for the full-package failure. Complete compatible
clock backport and final race validation remain pending; v1.11.5 upgrade withdrawn.
Review/evidence summary is committed in
docs/design/20261003-expression-quality-consolidation.md.Refs #29249; continuous tracking remains open.
What type of PR is this?
Which issue(s) this PR fixes:
Refs #29249.
What this PR does / why we need it:
Consolidates expression execution around the existing production owners and removes retired implementations with their exclusive tests.
Against main
9078a8bd87af49ea06f52e09d64e7740122aea61: 27 files. Implementation +257/-1189, tests +1890/-3936, design documents +161/-0. Counts describe each increment; they do not establish correctness or imply an audit of every recently changed module.Current optimization validation
Local Go 1.26.4/Linux amd64 with fresh native CGo inputs, GOMAXPROCS=2, GOMEMLIMIT=2GiB, build concurrency1; heavy checks run sequentially on the shared machine.
func_datetime_timestampadd.test/.resultPASS: all56 statements, exact headers and rows, DATE/DATETIME/TIMESTAMP, NULL, overflow and WHERE controls. Uses the existing integration fixture and task-private temporary files; no new cluster fixture is shipped. This is the targeted SQL BVT, not a full multi-CN rerun.Expression CPU performance
Exact baseline, pre-optimization PR body and candidate run in the same binary on reused2048-row vectors; caller bound type reset each batch. Primary cases measured in both orders, five500ms samples each, unchanged allocations. Reverse-order medians (ns/batch):
First-order candidate deltas: DAY-4.79%, SECOND-0.87%, dynamic+0.88%. MICROSECOND, MONTH and dynamic DATE-only controls remain close to baseline (-0.87%..+0.32%). Scalar dates have no allocation increase. Partial masks/NULLs retain small differences (SECOND+1.08%, dynamic+1.27%). Seven-row SECOND remains299.5→322.3ns (+22.8ns/+7.61%) versus baseline, slightly faster than pre-optimization324.9ns. These limits are disclosed; the change does not claim every input is faster. Shared-machine microbenchmarks do not establish whole-query or TPCC speedup.
Overall review and historical evidence
CI at
f13510d9524284347ace0dd47884a43f58680262passed: SCA, normal UT, build, coverage and multi-CN proxy/pessimistic BVT (run 37079464383). Dedicated Iceberg E2E was skipped. This follow-up only deletes redundant tests; new-head CI remains pending after push and is not awaited.Actual gpt-6.1-sol/xhigh design and final overall review evidence: Design session
01a0fed4-73e0-72f2-a61c-a6e33e7cc7f6; final review session01a0ff00-0445-78f1-9eca-d5843f425059(APPROVE, no unresolved material blocker). Actual model and effort verified from both session contexts; final reviewed diff SHA-256f93173c32478b36d47ac9e920564d1846c8e057b5f9cf00181e5f5108e7bb070.Final test-quality cleanup
Remove three obsolete branch-oriented temporal tests (72 lines) whose nonzero/optional-error assertions allowed incorrect identity behavior. Exact calendar values and scaling overflow remain covered by
TestCalendarIntervalArithmetic; UTC conversion rejection and accepted neighbors remain covered byTestTimestampArithmeticUtcLowerBound; upper overflow, NULL and row isolation remain covered through the real adapters byTestTemporalMicrosecondBoundaryOverflowIsNull. No runtime code changes or replacement fixtures.These three retained suites passed once on Go 1.26.4/macOS arm64 with the native CGo wrapper (
-v -count=1, 0.762s); diff checks passed. Existing mutation evidence demonstrates the weak tests accepted a broken implementation while the canonical table rejected it; those unchanged tests required no repeat mutation or benchmark run.Follow-up design session
01a0ff65-e236-74e1-9b13-725a5ffcaddfand final overall review session01a0ff69-39f6-7ec2-8cf6-01a242b577a9, both verified actual gpt-6.1-sol/xhigh. Final review PASS, no actionable findings; the prior P3 is closed.Staged coverage and fixture-lifetime audit
Refs #29249 (ongoing tracking issue; remains open). This stage preserves the remote test retirement and changes four existing test files plus the existing expression design document; no production behavior, framework, heavyweight fixture or additional test is introduced. Stage delta: +174/-55.
docs/design/20261003-expression-quality-consolidation.md(revision 2).-race -tags=matrixone_test -count=1; complete owning packages pass (function 14.120s, colexec 0.171s). Heavy runs are serialized with GOMAXPROCS=2, GOMEMLIMIT=2GiB and-p=1.Stage design: actual gpt-6.1-sol/xhigh session
01a0ff9d-f447-7d91-9776-444b7e87a846(ACCEPT). Final stage/overall reconciliation: actual gpt-6.1-sol/xhigh session01a0ffb1-e7d3-73e2-85a8-5e68591d3792(APPROVE, no unresolved material blocker). Reviewed stage diff SHA-256c9c38795143cbcfb1a20a9deb7712efb26aaa48b4b286692ddc1fc9fbc814ee4. New-head CI is not awaited or claimed green.Follow-up: zonemap scratch cleanup oracle
Strengthen the two existing round/scalar overflow cleanup suites with pre-fallback Go-heap ownership baselines and explicit cleared-slot assertions (+10 test lines, +8 documentation lines; no production changes or new fixture).
CurrNB()alone observes native bytes and missed Go-heap operand ownership.01a0ffbe-f5b8-7890-adcc-c93a54702beb: APPROVE, no concrete blocker. Reviewed diff SHA-25627741a5b9941e2e5f01f6c06588b300334e82f577a28ab0b4c91ab580c8e31e0.The prior surviving-mutation boundary is now closed for these exact two errors; no arbitrary leak coverage, test-cost or new-head CI claim. #29249 remains open.
DATE_FORMAT fixture compression with measured owning-package savings
Replace seven obsolete initializers and repeated execution blocks with one explicit literal table and one DateFormat-specific adapter.
TestFormat's four duplicate pairs merge intoTestDateFormat/all_tokens; six named format subtests retain all 24 original date/result pairs byte for byte. Correctness workload falls from 600 cases / 4,915,200 rows to six cases / 24 rows. Existing per-row format, NULL, masked selection and zero-date oracles retain their behavior, with cleanup-only changes. Inputs and result wrappers now release before their process; native and Go-heap ownership are checked after case cleanup.Six existing benchmark names, format assignments, 100×8192 population and per-case
BenchMarkRun()→Run()sequence remain. Benchmark iteration/timing policy is unchanged; no production edit or new heavy fixture. The exact map and measurement limits are in the existing expression design document.Three serial, alternating measurements per compiled binary on identical runtime/native/dependency inputs, excluding compilation; all six complete function package runs PASS:
c161ffc580)Wall ranges: before13.573–13.697s, after11.825–11.850s. CPU ranges: before4.428–4.643s, after2.407–2.620s. RSS ranges: before478.9–491.4MiB, after200.4–215.7MiB. Runtime uses monotonic timing and terminated-child
wait4CPU/RSS. Source-derived input/result/bool backing arrays fall121.875MiB→624bytes; this excludes vector storage/allocator overhead and is distinct from process RSS. These results establish owning-package savings on this shared machine, not whole-CI or production-query speedup.Exact final source focused normal selection PASS; three focused suites race PASS1.165s including six format scenarios and unchanged edge suites. Configured incremental golangci:0issues; pinned molint exits0 with only two unchanged unsafe-import diagnostics; formatting/diff checks PASS. Six complete package cost runs are the normal full-package validation. No new BVT is required because public/product behavior is unchanged; existing real SQL evidence remains valid. Benchmark sources are compiled and shapes reviewed; their existing enormous iteration loop was not executed.
Actual gpt-6.1-sol/xhigh design session
01a0ffc9-3e70-7eb2-a11c-e7c0e7dd6e7b: ACCEPT. Final review session01a0ffdd-3e50-7a40-aafe-0dc8d39e1548: APPROVE, no verified material blocker. Exact reviewed stage diff SHA-25646fe5e0e6e19abd6b732366c7705e55a9ba54dd6b30dfffe6596c611b9e1f16e. New-head CI is not awaited or claimed green. Refs #29249; tracking issue stays open.