Skip to content

Fix 4.1.6 fixture cleanup, test endpoints and WAL replay ordering - #32629

Merged
XuPeng-SH merged 4 commits into
matrixorigin:4.1.6-hotfixfrom
XuPeng-SH:codex/4.1.6-ut-issues
Nov 12, 2026
Merged

XuPeng-SH merged 4 commits into
matrixorigin:4.1.6-hotfixfrom
XuPeng-SH:codex/4.1.6-ut-issues

Conversation

@XuPeng-SH

@XuPeng-SH XuPeng-SH commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Problem and resulting behavior

Failed fixture initialization, shared fixed ports, and an asynchronous WAL truncate made release-branch tests fail outside their intended assertions.

  • Partition initialization now caches its original error instead of completing sync.Once with a nil shared cluster. Failed cleanup retains its owner for a final retry. Package cleanup has an independent watchdog after m.Run stops Go's test alarm; expiry fails with all goroutine stacks. Removed the unused non-reuse mode, options and always-nil return.
  • NewTestService allocates all RPC/Raft/gossip endpoints, derives its seed and client addresses from the successful configuration, and reuses the existing startup retry. Bind conflicts are bounded to eight attempts; other failures return immediately. Tests cover actual RPC/Raft/gossip TCP/UDP conflicts and release of failed listeners. Removed a discarded random-generator allocation.
  • The WAL replay test gates actual mock-client truncation, proves that the intent is visible while the remote PSN has not advanced, then waits for the requested physical PSN before close/replay. Existing exact replay-map assertions remain. This changes the test precondition, not the production WAL close contract.
  • HAKeeper configuration coverage checks normalized defaults and preserved explicit options without making a network request to an ambient default service. Existing client integration tests continue to cover successful connections and non-HAKeeper failures.
  • Transaction-executor and object-count tests close their complete owned clusters, including returned startup failures. The transaction callback releases its result and returns errors so rollback runs. Logservice setup stops immediately on failure.

Addresses #32621, #32622, and the replay-test ordering in #32262. The ownership corrections relate to #32614, whose original bootstrap timeout is still undiagnosed. No assertion, timeout in a business test, or production service configuration was weakened.

Validation

On 57, Linux/amd64, Go 1.26.4, matching CGo artifacts, -short -tags matrixone_test; live sockets ran in isolated user/network namespaces:

  • On preceding head d11afb21, full pkg/logservice race passed with 250 passing test events and full pkg/tests/partition race passed. The follow-up changes retry-exhaustion error construction and its regression test.

  • Focused race repetitions: startup retry 90, exhaustion/non-bind failure 100, independent clients 4, partition failed/successful initialization 100 each, actual package-shutdown subprocess cases 18, WAL replay 100.

  • Two independent package processes (TestReplay1, TestNewClientFailed) concurrently passed 10 repetitions each while the historical RPC/Raft/gossip TCP+UDP ports were occupied.

  • New regressions with old implementations restored via Go overlays fail as intended: blocked package shutdown and the two-service fixed-port client case. An injected assertion with pending gated WAL truncate exits promptly rather than hanging.

  • On d11afb21, seven affected packages passed go vet, pinned molint, and incremental golangci-lint; production packages built and test-only packages compiled through their test runs. Relevant transaction/object-count race evidence is also retained.

  • On SCA-fix head 85717270, actual make err-check, changed-file license headers, and logservice vet, pinned molint and incremental golangci-lint passed. TestNewServiceRetry and TestNewServiceRetryStops passed under race; the latter passed 10 repetitions and checks RPC bind error identity via errors.Is.

  • On current head f6d1e308, pkg/logservice passed two full race runs (255 passing test events each, no race warning) while TCP 32001 and TCP/UDP 32002 were occupied in an isolated network namespace. The reported configuration test also passed 100 race repetitions. Logservice vet, pinned molint, incremental golangci, make err-check, and both modified license headers passed.

The other WAL/store tests that hardcode /tmp were not run under the machine's explicit /tmp restriction; named WAL and direct consumer checks above were run.

Remaining issue scope

#32615, #32623, #32624, #32433, #32620, #32474, #32323, and the primary bootstrap failures in #32614 still require root-cause evidence. This PR does not claim those independent incidents are solved, and no issue was closed merely because related changes exist.

@matrix-meow matrix-meow added the size/M Denotes a PR that changes [100,499] lines label Nov 12, 2026
@XuPeng-SH
XuPeng-SH marked this pull request as ready for review November 12, 2026 11:25
@qodo-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@mergify

mergify Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

This pull request is merged.

@XuPeng-SH XuPeng-SH left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Request changes. I reviewed commit 2ec2123d75309a367f7cef9cfa3b9e6b5f9eb9e2 against 4.1.6-hotfix at bf18d1090466825da1d1c67742491af5c1da2605, independently of CI status.

  1. [P1] Bound shared-fixture shutdown after m.Run. In TestMain, m.Run() stops Go's test timeout alarm before returning, so the new synchronous cluster.Close() is outside go test -timeout. This is a real wait boundary: embed.cluster.Close reaches CN/TN/LOG service Close, which calls stopper.Stop; its timeout only logs and the wait continues until all tasks exit. A blocked shutdown can therefore leave the package and UT lane waiting indefinitely. I injected a fixture whose Close takes 2 seconds: go test -timeout=500ms still printed PASS and exited successfully after 2.06 seconds. Please keep shutdown under an effective bounded guard that fails with useful diagnostics, and exercise the slow/blocked close in a subprocess so the actual package exit path is covered.

  2. [P2] The requested #32622 endpoint-isolation fix is still missing. The change to initTest correctly stops the secondary retry/nil panic, but NewTestService still binds the fixed gossip port. In a separate network namespace, holding TCP/UDP 32002 makes both TestReplay1 and TestNewClientFailed fail immediately; releasing it makes both pass. This is an outstanding requirement from the assigned issue, not a regression introduced by this PR. Please complete endpoint ownership/isolation and test the concurrent-process case before treating that issue or the requested set as fixed. The PR correctly notes the current limitation; keep it open until the root cause is addressed.

  3. Make the WAL timing regression deterministic. The physical-watermark wait is directionally correct for this fixture. With a 300 ms delayed mock truncate, the base reproduced client pool closed and the wrong replay mapping, while this commit passed. Without that fault, the original base passed 30/30 runs, so the committed test can still pass after its synchronization is accidentally removed. Please add a small channel-controlled slow-truncate scenario that proves the intent is visible while the remote truncate is held, and that reopen waits for the durable operation; release the gate on every failure path. Preserve the existing replay-map assertions.

Design/cleanup: runPartitionClusterTestWithReuse is called only once, always with reuse=true; the new reuse=false cleanup branch has no caller. Please remove that unused mode and associated dead machinery rather than expanding it. The existing embed.RunBaseClusterTests is not a drop-in substitute here: it has different cluster preparation and no equivalent package-owned cleanup, so forcing reuse would change the fixture contract.

Independent checks: partition full package -race -short -tags matrixone_test passed in an isolated network namespace; partition fixture tests each passed 100 race repetitions; WAL replay passed 100 race repetitions; Test_TxnExecutorExec followed by TestPreparedParams, and TestCalculateObjectCount, passed under race. Normal WAL test median was approximately 60 ms at base versus 70 ms here across 30 runs each; this is a small test-only cost, not a database hot-path regression. No existing actionable review comments were present; the two conversation comments are bot status notices.

@XuPeng-SH XuPeng-SH changed the title Fix 4.1.6 test fixture cleanup and WAL replay ordering Fix 4.1.6 fixture cleanup, test endpoints and WAL replay ordering Nov 12, 2026

@XuPeng-SH XuPeng-SH left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approve for the declared scope at d11afb21ad41b7d49c17ef745153908f19929da8, compared with 4.1.6-hotfix / merge-base bf18d1090466825da1d1c67742491af5c1da2605. CI failures were excluded from this assessment. I found no remaining merge-blocking defect in this diff.

The four items in my previous review are addressed:

  • Package-owned shutdown now has an independent bounded watchdog after m.Run, with all goroutine stacks on expiry. The real TestMain subprocess cases cover successful cleanup, returned cleanup errors, and a blocked close. The existing owner retains a failed-close cluster without publishing it to callers.
  • All three test-service endpoints are allocated and the seed/client addresses follow the successful configuration. Actual bind remains admission; the existing retry owner handles bind conflicts with an eight-attempt bound and immediately returns other errors. Tests exercise RPC, Raft, gossip TCP and UDP conflicts, and check failed listeners are released. No extra retry subsystem or production shutdown path was added.
  • The WAL test positively establishes that checkpoint intent is visible while remote truncation is held, waits for the requested physical PSN after release, and retains the exact replay-map assertions. Its abort path releases gates before closing the WAL; the injected-fatal validation terminates promptly.
  • The unused non-reuse mode, options, always-nil return and unreachable constructor-partial-handle handling are removed. Keeping this fixture local is justified: the existing base-cluster helper has different preparation and no equivalent package-owned cleanup contract.

Additional independent QA in this review: 16 concurrent first callers, across success and combined startup/cleanup failure, passed 100 race repetitions; the shutdown subprocess test passed with race plus atomic coverage of pkg/embed; eight independent processes, alternating the two affected packages, passed 24 race cases while the historical endpoints were occupied and all processes used the same random seed. I also checked the complete implementation/test/documentation increment and reused the unchanged final-head full-package race and static-analysis evidence rather than rerunning the same suite without a new concern. No subagents were used.

Measured nonblocking tradeoff: alternating three samples of 20 service create/close operations each gave median 13.30 ms before endpoint isolation and 31.60 ms now, with approximately 1.59 MB and 26.7k additional allocations per fixture. The existing port selector scans /proc three times. This is a test-fixture cost with few active call sites, not a SQL/data-path change; the absolute cost is acceptable for the correctness benefit and does not block this PR. Any future allocator cleanup should stay at that existing owner.

This approval assessment covers #32621, #32622, the test-ordering part of #32262, and the documented fixture cleanup. The other bootstrap/progress incidents explicitly retained in the PR are still unresolved; this review does not establish that all originally listed issues are fixed.

@matrix-meow matrix-meow added size/L Denotes a PR that changes [500,999] lines and removed size/M Denotes a PR that changes [100,499] lines labels Nov 12, 2026
@XuPeng-SH
XuPeng-SH merged commit 1cbdb44 into matrixorigin:4.1.6-hotfix Nov 12, 2026
XuPeng-SH pushed a commit that referenced this pull request Nov 14, 2026
…#32520)

## What type of PR is this?

- [ ] API-change
- [x] BUG
- [ ] Improvement
- [x] Documentation
- [ ] Feature
- [ ] Test and CI
- [x] Code Refactoring

## Which issue(s) this PR fixes:

Fixes #32265

## What this PR does / why we need it:

Restore consistent grouping-extension results and nullability across
SELECT, views, CTAS, and repeated planning on `4.1.6-hotfix`.

**Design documentation — maintainer approval pending.** This is now a
grouping-planner ownership restructuring, not just a localized
CTAS/formatter fix. The current hand-written production Go diff is 655
additions + 38 deletions (693 lines), plus five grammar lines; generated
parser and tests are excluded. Before this follow-up it was 686 lines;
the earlier 786-line estimate was incorrect.

- [Versioned design v3 at
`0e711ba98e`](https://github.com/matrixorigin/matrixone/blob/0e711ba98e4005b868b94af4305c02bbe2091a16/docs/design/CLAUDE_32265_grouping_ownership.md):
compares scope reduction, outer-AST normalization, typed internal
transport, and native grouping aggregation; defines ownership,
expression identity, branch/union nullability proofs, lineage,
SAMPLE/windows/subqueries, cost, release compatibility and
counterexample validation. This edition refines the public summary while
retaining the technical design contracts.
- [Design-review record at
`0e711ba98e`](https://github.com/matrixorigin/matrixone/blob/0e711ba98e4005b868b94af4305c02bbe2091a16/docs/design/CLAUDE_32265_grouping_design_review.md):
records the exact historical v1 REQUEST_CHANGES and v2 design-only PASS
revisions. No new independent review was performed for this editorial v3
update. This is retrospective design documentation, **not** evidence of
pre-implementation approval, current implementation acceptance or GitHub
maintainer approval. Maintainer approval of the exact design revision is
pending.
- The latest merge incorporates target `9937f1b74a`
(#32609/#32596/#32591) without conflicts. This follow-up implements the
two contracts requested in [review
5887871372](#32520 (review)):
branch-output proof publication before HAVING consumers (§4.6/D8), and
uniform DISTINCT GROUPING admission (§4.7/D7). The versioned v3
design/review documents are unchanged. Fresh validation for the listed
affected boundaries appears below; historical results are not
automatically promoted to this target. Actual multi-CN and
release-source compatibility validation remain unverified.
- No new GitHub review request/comment, CI monitoring, or
`mo-self-review` was performed. The following implementation/evidence
history does not substitute for maintainer review.

- Format ROLLUP, CUBE, and GROUPING SETS as reparsable SQL, preserving
explicit empty and duplicate sets rather than flattening or
deduplicating them.
- Keep ROLLUP/CUBE expansion and the derived HAVING marker local to each
planning invocation. Rebinding a source AST no longer adds subtotal
levels or loses CUBE keys; CTAS retains the original grouping syntax for
its generated INSERT.
- Publish omitted-key nullability when HavingBinder/ProjectionBinder
first bind grouping output references, before branch HAVING subquery
flattening can consume the proof. Reuse the same output-type rule in
remapping/transport; preserve the evaluated AGG inputs and raw SAMPLE
value types. Parent functions and quantified operands bind bottom-up
from the correct child proof; retain the post-UNION refresh as a
separate boundary. Ordinary/common keys, COUNT and proven COALESCE
fallbacks retain NOT NULL. MARK/ANTI algorithms are unchanged.
- Accept qualified column names in GROUPING so that binding-generated
`GROUPING(table.column)` survives the CTAS format/reparse boundary.
Regenerate the MySQL parser through the repository Makefile; the large
generated diff is parser tables and line directives, with only the
corresponding GROUPING semantic action changed. Repeated generation
produces identical output.
- Apply SELECT DISTINCT to the combined grouping-set result, not
separately to its UNION ALL branches. Deduplicate before hidden ORDER BY
expressions and LIMIT/offset are introduced; ordinary grouping sets
still preserve duplicate rows.
- Mark grouping-set membership only for complete root grouping
expressions with a successful key lookup. Recursive operands of
arithmetic/function keys must not accidentally mark key zero present.
- Retain subtotal aggregates when any key is omitted, even if the
evaluated input contains a primary key. Ordinary PK grouping retains its
existing effectless-aggregate optimization.
- Give an explicit empty grouping set a hidden COUNT when neither an
aggregate nor SAMPLE owns its cardinality, so each set produces one
global row on populated or empty input. Preserve its HAVING boundary,
reject ungrouped source columns, and leave ordinary constant scans
unchanged.
- Preserve predicates on omitted grouping keys above the aggregate
instead of replacing output NULLs with input values. Keep output
predicates above keyless global aggregates as well: filtering their
input to zero rows still produces a global aggregate row. Predicates on
present/common grouping keys retain safe pushdown.
- Split expanded grouping queries into a branch-local grouping stage and
a single combined-result stage. Carry only grouping/aggregate inputs
consumed by the final/window/order/post-window-HAVING expressions
through UNION ALL; evaluate windows and final projection once over that
complete result, then DISTINCT, ORDER BY and LIMIT. Rebind through a
private slot map rather than assuming all group keys are present.
Internal homogeneous transport bypasses SQL common-type coercion,
preserving BINARY/VARBINARY grouping bitmaps; public set-operation
coercion is unchanged. This also supports windows used only in ORDER BY,
partitioning, ranking, aggregate-over-aggregate windows, and reused
CTAS/prepared ASTs without text rewriting.
- Rebind quantified subqueries' outer operands, including
`SubqueryRef.Child`, to the combined grouping output. Flatten scalar and
quantified subqueries before constructing the DISTINCT key projection,
not only in the ordinary final projection; preserve the existing
unsupported-left-subquery rejection.
- Keep SAMPLE branch-local and materialize its selected post-sample
outputs, including already-supported input passthrough. Omitted keys
become independently typed NULL grouping expressions, so subtotal
branches really sample the correct group; branch-local GROUPING masks
distinguish omitted keys from actual NULLs. Preserve physical
group-column ordinals when unused group outputs are pruned. Reconstruct
legal hidden ORDER BY expressions (including `chosen+1`) from selected
results after DISTINCT, without transporting unused computed sort
columns or sampling again. Serialize the complete SAMPLE call for CTAS,
retaining columns/star, percentage precision, row count, and row/block
unit.
- Refresh WINDOW arguments/results from their actual remapped child
types before publishing their nullable proofs. FIRST/LAST_VALUE now see
synthesized grouping NULLs, including view/CTAS consumers;
partition-only keys retain their upstream PARTITION coordinate
ownership. COUNT/ranking and proven literal fallbacks retain their
non-null guarantees.
- Validate every DISTINCT sort dependency recursively, including
expression lists/tuples. Match exact selected slots or safe complete
selected expressions first; reject any remaining GROUPING invocation
with error 1149, uniformly for AGG and SAMPLE. Do not reconstruct
lineage from deduplicated key values or add hidden markers to DISTINCT
keys. Selected GROUPING aliases/complete expressions and ordinary value
expressions remain supported; admission does not depend on primary keys,
NOT NULL, current data or whether a particular grouping set omits a key.
Unselected dependencies fail before SELECT execution or CTAS target
creation.
- Preserve SAMPLE sort dependencies before branch-local GROUPING
folding. A detail-arm zero must not be promoted into a global constant
or confused with a literal zero. For non-DISTINCT SAMPLE sorting, hidden
GROUPING (including when its key is selected) stays in the branch
payload unless the complete GROUPING result is already
selected/materialized; ordinary value expressions still reconstruct from
selected outputs. This fixes subtotal-first LIMIT selection and the
corresponding silent CTAS writes while retaining legal `chosen+1`
sorting.
- Recompute composite expression proofs bottom-up immediately after
rebinding to merged grouping outputs, before quantified-subquery
flattening/MARK optimization. A nullable `g+0` must not retain its old
NOT NULL promise and become a NULL-unaware ANTI filter; explicit
non-null COALESCE controls retain their guarantee.
- Bind grouping DISTINCT/SAMPLE ORDER BY aliases to exact
selected-output references, not copies of their expression trees,
retaining alias names in the source AST for CTAS/repeated planning. Map
the selected tag and ordinal explicitly across projection boundaries;
independent structurally identical volatile outputs `a`/`b` retain their
own identity in nested sorting expressions. Structural fallback reuse
rejects volatile/real-time calls, including under deterministic
wrappers. Resolve DISTINCT sort dependencies before subquery flattening
replaces expression identity with join tags. Independent selected
subqueries are not merged by SQL text, aliases are not re-executed for
sorting, and unselected dependencies still raise syntax errors.
- Split mixed SAMPLE sort dependencies recursively rather than falling
back to an entire branch PROJECT expression. Selected aliases consume
their already-materialized outputs; branch-only GROUPING/column
dependencies are transported separately and folded only at their branch
owner. Evaluate the combined arithmetic/CASE/list expression after
UNION; keep scalar and quantified subqueries at that global consumer
boundary, including their selected outer operands. This prevents
future-output/self references in SELECT and CTAS without
copying/re-executing volatile selected expressions, and preserves
DISTINCT dependency rejection.
- Resolve GROUPING's alias arguments to their bound projection origins
during initial function-argument binding. Unlike ordinary ORDER BY value
functions, GROUPING describes grouping-key lineage and must not consume
future selected-output slots. Preserve the source alias AST for
CTAS/rebinding; ordinary volatile aliases retain exact output
references, and actual NULL values are not used to infer subtotal
membership.
- Keep transport-column type/provenance separate from the user
projection. A literal NULL in a user output slot must not cause an
unrelated transport aggregate at the same slot to be retyped as text;
restore bare-NULL provenance for enclosing set operations.
- Add focused parser/planner regressions and a small SQL case covering
rows, schema, NULL insertion constraints, empty inputs, actual versus
synthesized NULLs, duplicate sets, views, CTE reuse, prepared execution,
HAVING, and projection pruning. Correct only the five duplicate
subtotal/grand-total expectations in the existing hint CTE fixture after
independently verifying its ten correct rows.

**Latest review-follow-up validation** (implementation `28da04af7e`;
local darwin/arm64, Go 1.26.4, matching native/module inputs, target
`9937f1b74a`):

- Frozen pre-fix `0e711ba98e` reproduces the extra `(NULL,10)` in SAMPLE
HAVING SELECT and administrator CTAS readback, and wrongly accepts
hidden-GROUPING DISTINCT SELECT/CTAS. New typed planner tests fail
before repair and pass afterward; they check real binding/MARK
consumers, immutable input proofs, and BuildPlan admission for both
SELECT and CTAS.
- Fresh full planner/function/loopjoin/sample/window/group runs: **4,875
test/subtest passes**, three unchanged planner skips. Fresh tree/MySQL
parser/readutil/pSpool packages add 1,060 passes; selected compiler
grouping/window/receiver/scalar-CTE boundaries add 44 passes, not a full
compile-package claim.
- Independent SQL/value/metadata/CTAS/error-cleanup checks pass twice,
including ordinary AGG, common keys, CUBE, CAST/ANY/ALL,
empty/NULL/matching RHS, COALESCE, actual NULL, PK/NOT NULL admission,
selected markers/composites/aliases, and normal SAMPLE value sorting.
All nine earlier review oracles and the original multiset/constraint
oracle pass again.
- Grouping CTAS BVT: **345/345 twice**, metadata enabled, no ignores.
Generated results append 45 statements without changing the previous 300
expectations. Existing SAMPLE suites pass 78/78 and 51/51; ROLLUP 107
with two unchanged ignores, hint CTE 65/65, scalar CTE 41/41,
non-primary ZoneMap 60/60.
- Matching build/gofmt/vet, pinned molint and golangci-lint 2.6.2, and
err-check pass. Changed production statements in this increment: **27/29
(93.10%)**; full PR: **375/388 (96.65%)**, reusing only the unchanged
tree coverage. The initial validation-command/setup errors remain in
local evidence and are not counted as passes.
- Only these listed current checks are claimed; the historical results
below retain their original revision scope. No re-review request, GitHub
comment, CI monitoring, `mo-self-review`, multi-CN acceptance or
release-upgrade approval is claimed.

**Historical implementation validation** (recorded at `0a88c1d8cd`, not
a fresh validation of the documentation/new-target head; local
darwin/arm64, Go 1.26.4, matching worktree-built native libraries;
validated target base `af531771cc`, merged without rebasing; previous
result-proof base `bf18d10904`; original reproduction base
`cbb7da471a`):

- Baseline regressions reproduce CTAS error 3819, CUBE rebinding errors,
lost duplicate empty sets, and repeated expansion. Qualified GROUPING
parser tests fail before the grammar correction.
- The first review's four defects and the second review's three
operator-boundary defects fail focused planner tests before their
respective repairs and pass afterward. Controls cover safe common-key
pushdown, hidden sort keys, PK optimization retention, constant HAVING,
projection provenance, and plain scans.
- Third-review quantified and SAMPLE binding failures are recorded
before repair. A single-owner revert reproduces residual subqueries in
published DISTINCT projections and the missing flattener rejection; the
strengthened UT checks executable IR rather than only successful
binding. SAMPLE format/reparse tests also fail with the original
formatter.
- Fourth-review typed tests and SQL witnesses fail on the frozen
`512f10f324` source/binary, covering binary markers, SAMPLE subtotal
grouping, stale window metadata, tuple-order acceptance, unnecessary
transport columns, and rejected computed sample ordering. The exact
`54feca6423` Go source was independently built via an audited overlay
with unchanged module/native inputs; the same computed SAMPLE ordering
SELECT completes there. Its known old duplicate-DISTINCT rows are not
used as the new result oracle.
- At `0a88c1d8cd`, the full `pkg/sql/plan`, `pkg/sql/plan/function`,
`pkg/sql/colexec/sample`, `pkg/sql/colexec/loopjoin`,
`pkg/sql/colexec/group`, and `pkg/sql/colexec/window` tests pass (4,753
test/subtest pass events; three existing planner skips, no new skipped
regression). That planner evidence was refreshed after the `af531771cc`
base merge and includes GROUPING-alias key origins, mixed SAMPLE
branch/global dependencies, exact volatile alias output slots,
independent-call structural fallback, compound-operand proofs,
selected-subquery identity and repeated-CTAS regressions; the five
unchanged owning/consumer package runs reuse sixth-review evidence. The
unchanged tree/MySQL parser suites reuse third-review evidence. Build,
matching gofmt, vet, and affected-package golangci-lint 2.6.2 pass.
- Changed handwritten production statements across the PR: 373/384
covered (97.14%); the latest review-fix increment covers 3/3 (100%).
Unchanged tree coverage is explicitly reused; current planner coverage
is newly collected. Generated parser tables are excluded from that
denominator and validated through parser and SQL consumers.
- Independent manual-multiset SQL checks pass for the original controls
and all four review witnesses: arithmetic-key CUBE has eight rows, PK
ROLLUP/CUBE has `(NULL),(1),(2)`, DISTINCT removes only result
duplicates, and each explicit empty set contributes one constant row on
either empty or populated input. SELECT and CTAS agree, including
LIMIT/offset and nullability/insertion constraints; original explicit
INSERT and literal fallback controls remain green.
- Independent second-review checks verify that outer `g=1` excludes
synthesized NULL, an outer false predicate over an explicit empty set
returns zero rows, and COUNT OVER sees all three grouped rows in both
SELECT and CTAS. Ranking, partitioning, nested aggregates, HAVING/window
ordering, DISTINCT/LIMIT, empty/duplicate sets, actual/synthesized NULLs
and view consumers have additional value controls. The separate generic
ordered-SUM write failure is explicitly excluded below, not recorded as
a pass.
- Independent third-review SELECT/CTAS checks verify IN/NOT IN/ANY/ALL,
expression/tuple operands, synthesized NULL and empty/NULL-containing
RHS three-valued logic, scalar/functional/DISTINCT/window combinations,
multirow-scalar error propagation and CTAS rollback, and complete
deterministic SAMPLE output. SAMPLE checks use 100 percent or a budget
exceeding the fixture, with duplicate/empty sets, empty input, zero
percent, multiple columns, supported passthrough, DISTINCT, and
enclosing bare-NULL numeric UNION controls. These pass twice;
prior-review and original value/constraint oracles also pass again.
- Independent fourth-review SELECT/CTAS/view checks pass twice: binary
actual/subtotal NULL markers, SAMPLE ROLLUP/CUBE/mixed sets and nullable
keys, non-prefix group outputs, FIRST/LAST_VALUE and partition-only
keys, COUNT/literal-fallback metadata, tuple-order syntax rejection and
CTAS rollback, and computed SAMPLE ordering. All earlier review/original
value and constraint oracles pass again.
- Transport-pruning UT and EXPLAIN verify count-only AGG/UNION output
without unused keys. A separate 20,000-row/two-2-KiB-key local check
returns 60,000 on both base and candidate; five alternating warm runs
have medians 50.2 ms / 51.2 ms respectively (client-inclusive local
sanity measurements, not a performance threshold or cluster claim).
Large data is not added to BVT.
- Fifth-review frozen-head SQL reproduces the wrong `5,5,7` LIMIT result
and identical CTAS rows. Old-owner overlay UT rejects the same
hidden-marker transport loss and literal-to-flag dependency
substitution. Final independent ordered-result/CTAS checks pass twice
for hidden, selected and wrapped markers, actual NULL, mixed sets,
int/bigint samples, literal zero, DISTINCT, and computed-order controls.
- Sixth-review frozen `a2103870aa` reproduces a NULL row from `NOT flag`
over `g+0 IN (...)`, including the same incorrect CTAS write, plus 1149
for the legal scalar-subquery alias ordering SELECT/CTAS. Exact
`bf18d10904` independently confirms the alias SELECT/CTAS control
succeeds. Final ordered/value oracles pass twice for IN/NOT IN/ANY/ALL,
compound/cast operands, empty/NULL RHS, non-null fallback,
scalar/count/wrapped aliases, multiple independent aliases, repeated
source binding and CTAS cleanup. All earlier review/original oracles
pass again.
- Seventh-review frozen `bcec0af15d` fails deterministic typed
slot-ownership tests and six public nested-`b` ordering witnesses (plain
DISTINCT, DISTINCT SAMPLE and ordinary SAMPLE); three `a` controls
remain ordered. Exact `bf18d10904` passes all nine SELECT ordering
controls. The candidate passes all nine SELECT/CTAS checks twice,
comparing actual returned values rather than fixed random strings. CTAS
records row ordinals before storage and verifies them when read back;
nested wrappers, reverse order and SAMPLE LIMIT are covered. All six
earlier review/original result oracles pass again. The exact base's
volatile-alias CTAS has a separate 1149 format/rebind limitation, so it
is not claimed as a successful CTAS oracle.
- Eighth-review frozen `7674e4e2c4` reproduces 1064 column-remapping
failures for mixed selected-alias/branch-marker sorting, in both SELECT
and CTAS; typed tests directly reject the branch PROJECT's reference to
its own future output. Frozen `bcec0af15d` passes the same eight
deterministic SELECT/CTAS controls. The candidate passes them twice
(arithmetic, reverse direction, CASE, multiple CUBE masks, literal zero,
scalar/quantified subqueries), plus mixed volatile alias/hidden GROUPING
ordering, selected-marker DISTINCT and unselected-marker rejection/CTAS
rollback. All earlier review/original oracles pass again.
- Ninth-review frozen `f0b27a96ed` fails GROUPING-alias key-origin
assertions and the public alias SELECT/CTAS controls; frozen
`bcec0af15d` passes the same deterministic controls. The candidate
passes eight SELECT/CTAS shapes twice: aliases, source-name shadowing,
quoted names, nested CASE/arithmetic, multiple CUBE arguments, qualified
sources, selected-marker SAMPLE DISTINCT and ordinary aggregate
DISTINCT. Additional checks cover actual NULL versus subtotal lineage,
GROUPING(alias) mixed with independently selected volatile `b`, and
unselected-marker 1149/CTAS rollback. All earlier review/original
oracles pass again.
- Expanded grouping CTAS BVT passes twice on the same isolated single-CN
instance: 300/300 each, no skips, including metadata comparison. The
prior 289 results are unchanged; eleven statements add hand-computed
GROUPING-alias lineage/order results, CTAS, shadowing, CUBE and DISTINCT
controls. Its only pre-existing expectation changes are two SUM
nullability rows (`NO` to `YES`) required by #32519; the same metadata
is independently verified on exact `bf18d10904` and candidate controls.
Existing SAMPLE BVT passes unchanged: 78/78 and 51/51. Existing hint CTE
passes: 65/65. Existing ROLLUP passes with 107 successes and two
unchanged skips; existing CTAS passes with 1,284 successes and 30
unchanged skips (including the new target-base cases). Generated results
were reviewed against independent expected values before normal
comparison runs.
- CI run `43223581993` at `f14f314d58`: arm64 SCA failed because its
self-hosted runner lost communication (check annotation), not because of
a reported lint finding. Ubuntu race UT reports twelve failed roots
across checkpoint quiescence, ISCP watermarks and embedded bootstrap/RPC
paths. The target update brings #32629 fixture/endpoint corrections and
#32550 scalar-CTE/ZoneMap changes; these are merged, not reimplemented
in this PR.
- After the new-base merge, all twelve original failed roots pass
locally in Go 1.26.4 `-race -short -tags matrixone_test` mode; an
audited exact-`af531771cc` Go-source overlay passes the same twelve
roots. These Darwin/arm64 focused checks do not reproduce the concurrent
Linux lane or establish that its causes are fixed/pre-existing/harmless.
Snapshot checkpoint waiting is tracked separately in #32640; the
ten-root bootstrap/RPC episode in #32641; ISCP watermark timing already
has #32636/#32639. No assertions, timeouts or test-body retries are
weakened here.
- New-base planner, pSpool and readutil packages pass. The full compile
package has three Parquet fanout-fixture failures, identically
reproduced at exact target source; its new scalar-CTE tests pass. These
are not masked or claimed as a whole-package pass (related historical
CPU-capacity tracker #29637). Matching build, affected-package vet,
pinned molint, incremental golangci-lint and `make err-check` pass. The
initial local embedded run exceeded Darwin's Unix-socket path limit
before SQL; a short task-owned TMPDIR fixes that precondition, and only
the subsequent completed runs are counted.
- Grouping BVT is rerun twice after this merge: 300/300 each, metadata
enabled and no skips. All nine review/original result oracles pass
again. No remote CI recovery is claimed; pushing this merged head
schedules fresh CI rather than treating an isolated local pass as
approval.
- Test database cleanup is verified, and all task-owned services are
stopped.

**Review coordination:** Per request, the previous re-review request was
withdrawn. This update does not request another review. Historical AI
design review of v2 is recorded above; the editorial v3 update adds no
approval claim. Maintainer design approval and independent acceptance
remain pending.

**Previously tracked limitation:** #32531 recorded the generic
ordered-SUM CTAS failure on the earlier source baseline. After merging
#32519, the exact `bf18d10904` and candidate controls both write the
correct `(NULL,21,21),(1,12,33),(2,9,42)` rows. This improvement comes
from the target base, not an extra generic SUM repair in this PR; the
historical failing probes remain retained.

**Separate known limitation:** #32549 tracks the pre-existing grouped
SAMPLE passthrough-column execution panic. `SELECT g,h,SAMPLE(v,100
PERCENT) FROM src GROUP BY g` fails without any grouping extension on
the original source baseline; the generic passthrough-input offset
remains outside this repair (the required group-output ordinal
correction does not repair that separate path). This is not counted as a
passing test, nor fixed through a generic SAMPLE runtime/remapping
change. Already-supported nongrouped passthrough is covered through
repeated empty sets.

**Separate known limitation:** #32595 tracks the generic binder
selecting the wrong expression after SAMPLE (`SELECT SAMPLE(v,100
PERCENT),7 ...` repeats `v`). It independently reproduces without
grouping on exact `bf18d10904`; the reversed projection order is a
successful control. It is not repaired here. New literal/marker
regressions place SAMPLE last so they test this PR's sort-origin
boundary rather than that separate binder defect.

**Scope and limits:** The PR diff does not include #32263's MARK
optimization or #32264's general function/aggregate/window nullability
redesign. The latest base includes #32315 and #32519; merge conflict
resolution retains upstream's explicit nullability proofs plus the
grouping/window consumer boundary, with no additional MARK changes here.
Empty-input ROLLUP retains the existing zero-row behavior, cross-checked
against MySQL 8.4.11. No operator lifecycle, wire/catalog format, or
distributed-protocol changes are introduced. Validation is
single-CN/local; no production replay, multi-CN/race claim, or remote CI
result is claimed.

This branch was previously deployed

1 inactive deployment
ci — f6d1e308 Deployed Nov 12, 2026 by XuPeng-SH
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/L Denotes a PR that changes [500,999] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants