Repository navigation
fix(sql): report group concat truncation warnings - #28504
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? |
80a95c5 to
6336beb
Compare
XuPeng-SH
left a comment
There was a problem hiding this comment.
Force review of fcb9206 against base/merge-base 7c643f4. COMMENT only (self-authored PR).
P1 — Provide the traceable design-first artifact for the execution-diagnostics lifecycle refactor before implementation approval.
This is no longer only a local GROUP_CONCAT warning fix. The new warningAttempt in pkg/sql/compile/warning_attempt.go owns and replaces the diagnostic destination across processes; Compile.Run now seals/discards/rebinds generations around retries and publishes only after successful completion; remote callbacks capture the generation sink; scalar TIME/numeric conversions also move from direct Session diagnostics to that sink. The planner additionally changes aggregate identity/alias reuse to preserve independent diagnostic side effects. This materially changes cross-subsystem ownership, retry and lifecycle contracts. The production diff is 651 added/deleted lines across frontend, planner/function, aggregate operators, compile and process, so the major-refactor size and complexity triggers apply.
The repository feature-design-review contract requires a stable, versioned design and a traceable approval of its exact revision, linked from the implementation PR. The current body says 'GPT-6 medium design and final review passed', but supplies neither the design revision nor its review decision. The PR comments/reviews, linked issues #28252/#28253 and current docs tree do not provide that artifact. The nearby JSON_TABLE RFC is explicitly drafted, belongs to #28036, and is not an approved design for this PR. Please link the actual reviewed artifact and decision if they already exist; otherwise complete the distinct design phase. It should specify the statement/attempt publication boundary (including terminal errors and nested execution), old-callback ownership, prepared floor/reparse/migration policy, distributed warning count/row-number meaning, and bounded retention independently of count.
This is an objectively missing repository gate, not a demand to wait for CI or repeat long tests, and not a claimed new runtime counterexample. Per mo-self-review, I stopped the downstream implementation-approval pass once the gate was established; this comment does not claim a complete numerical/concurrency implementation PASS. Source inspection shows concrete repairs for the previous prepared-floor and aborted-attempt findings, but those do not substitute for the required design record.
Evidence: live head/base and all existing PR/issue comments inspected; affected ownership and retry/remote/scalar consumers inspected; git diff --check passed. Author reports exact-head owning-package Linux and focused race passes. Current ordinary Ubuntu UT, coverage, SCA and BVT remain in progress; the previous head's suite-level timeout/light-stage failure is not established as caused or fixed by this PR. No long tests, live AP/mixed-CN test or new benchmark was run.
Lifecycle scope checked for the gate: aggregate diagnostics are retained to 64 records and consumed/freed; attempt collector sealing uses a bounded critical section and no downstream wait; process/scope bindings are restored on retry and terminal completion. These observations identify the proposed Q1/Q2/Q3 model, not an independent acceptance of every lifecycle path.
fcb9206 to
3711da2
Compare
XuPeng-SH
left a comment
There was a problem hiding this comment.
Follow-up force review: COMMENT only (self-authored PR). Reviewed head 3711da2, live base 401b967, merge-base fc621e3.
Conclusion: the previous P1 design-artifact gate is resolved; no new concrete blocker found in this pass. Design revision 1 is linked at a fixed commit and its current blob is exactly a2d2e634ab5179aaa88ce1c289cab96d299a6dc8, matching the independent design decision. The separate review record also covers the internal-SQL handoff amendment. This establishes the required renewed design/implementation sequence without rewriting the history of the earlier blocked review.
The previous prepared-limit and failed-attempt findings remain addressed: the logical PrepareStmt owns the immutable floor, fresh/cached/retry compiles receive it, and larger executions do not mutate it. Aggregate finalization clears stale diagnostics, records one truncation per finalized group, and consumes records once. Empty/NULL groups bypass truncation reporting. Existing byte-limit/UTF-8/binary prefix logic is retained; separator and payload truncation paths both report the contributing row. Independent GROUP_CONCAT calls keep independent slots while alias/ordinal references reuse their selected slot. GROUP_CONCAT truncation remains a warning rather than introducing a strict-mode error; scalar conversion strict-mode decisions remain separate.
Attempt lifecycle: append/seal is mutex-linearized; failed retries seal before cancellation, restore before pooled retry release, and install a fresh collector before retry compilation. RPC senders retain their captured sink rather than consulting a rebound process. Successful publication follows allocation finalization, result sealing and final plan work; error/panic outcomes discard. The new internal executor and SqlHelper bridges capture explicit WarningSink into context and install it before child planning without replacing Session. Explicit nil masks inherited stale context; old contexts remain tied to the old generation. Real internal SQL outcome tests complement the existing real Run retry/error/panic tests; they are not misrepresented as a complete ALTER failure-injection test.
Q1/Q2/Q3: aggregate records are consumed/freed; attempt bindings are restored and sealed collectors become inert; collector locks do not span downstream publication or RPC waits. Retained record count is capped at 64 independently of total count, binding maps scale with plan processes/scopes, and old callback references expire with the existing RPC lifecycle. Variable-length scalar message bytes and duplicate aggregate evaluation costs are expressly documented, not claimed to have a universal byte bound or measured speedup.
Accepted scope limits remain explicit: successful Run is not transaction commit; initial compile diagnostics have a different boundary; migration reparses PREPARE; old producers cannot send missing warnings; distributed sample ordering/row numbers are not globally stable. No new counterexample was found that invalidates those recorded decisions.
Validation: exact design blob, live PR comments/revisions, current changed contracts and terminal consumers inspected; git diff --check passed. Reviewed author evidence includes full relevant package runs and focused/full race runs, including the real internal SQL test at -race -count=100 on macOS/arm64. No fresh native suite, live AP/mixed-CN BVT or benchmark was run by this reviewer, and CI was not awaited. Earlier cancelled/timed-out CI runs are not green evidence and this review does not claim to resolve their unidentified suite-level failures.
Fixes #28252
Fixes #28253
Summary
GROUP_CONCATreports MySQL warning 1260 when its result is truncated. Preparedstatements use
max(prepare_time_limit, execution_time_limit): lowering thesession limit preserves the prepared floor, while a larger execution does not
permanently raise it.
The logical prepared statement owns that immutable floor. Fresh AP/specialized
compiles, cached Reset, and ordinary/definition-change retries receive it
explicitly. Group, MergeGroup, Window, and TimeWin share the refresh rule.
Warning lifetime and bounds
Aggregate finalization maintains the total count separately from at most 64
retained records. Group, window, time-window, scalar conversions, and remote
terminal diagnostics use an execution-attempt sink without replacing Session.
Failed attempts are sealed before cancellation. Late remote callbacks keep the
old sealed sink; retry compilation receives a fresh sink. Successful
Compile.Runpublishes after finalization, result sealing, and final planprocessing. Errors and panic discard the attempt. Nested success publishes to
the parent attempt; parent failure discards it. No diagnostic destination means
no attempt collector.
Independent aggregate calls preserve independent warnings; aliases reuse their
bound aggregate. Retained warning order can depend on fragment arrival order.
Warning row numbers describe aggregate contribution order, not global table
positions. Record count is bounded, but variable-length scalar messages are not
subject to a universal byte cap. No performance improvement is claimed.
Design review follow-up
Review 5161993522
identified a missing versioned design and traceable approval, not a new executed
runtime counterexample. This follow-up adds those artifacts:
The review record identifies the exact document blob and reviewed revision.
This establishes a distinct design decision now; it does not retroactively
claim that the earlier implementation satisfied design-first review.
The subsequent independent implementation check found a genuine missing
handoff: same-session internal SQL created a new Process with Session but no
parent attempt sink. A successful internal statement could publish warnings
before a later outer failure/retry. The fix captures the explicit sink in a
small context value and installs it before child planning, for both internal
executor and SqlHelper background execution. Session identity is unchanged.
An explicit nil masks inherited old context bindings; contexts retain the old
generation, not a mutable Process pointer. No goroutines, waits, retries or
per-row work are added; only constituent internal SQL calls carry the value.
TestInternalSQLWarningAttemptOutcomesexecutes real internal GROUP_CONCAT SQLthrough
runSqlWithResultAndOptions -> sqlExecutor -> txnExecutor -> Compile.Runand checks no early Session publication, parent success/failure, child failure,
and retry without duplicate counts. Context tests cover old/new generations
and explicit-nil masking; frontend binding tests preserve both the parent sink
and backSession's metadata behavior. This is not an end-to-end ALTER failure
injection; the real internal execution boundary is the deterministic oracle.
Parent outcomes use collector transitions; the invalid-cast child may fail
during planning. Existing real Run tests separately cover runtime failure.
Accepted limits: successful Run is not a transaction-commit publication
boundary; migration reparses PREPARE and starts a new floor lifetime; mixed
versions with old producers cannot supply diagnostics those producers never
send. These limits remain owned by the PR author and are detailed in the design.
Validation
Previous implementation evidence recorded for
fcb92061cf:function, and frontend.
remote callbacks, nested execution, concurrent sealing, fresh/retry prepared
compiles, and child inheritance.
fresh and both retry-generation paths. This is not a live AP-cluster BVT run.
Current follow-up rebases onto main
fc621e3616d229c7a29d0c80e73ed8eb1997459c.git range-diffreports all six replayed patches unchanged; there were noconflicts. The later internal-SQL correction is an additional commit.
Current macOS/arm64, Go 1.26.4 validation (native artifacts built through
make -j8 cgo, tests throughmo-cgo-test):-race.-race -count=100(4.909s packageruntime). Other unchanged focused collector tests retain their earlier evidence.
aggexec, group, window, timewin and frontend against
origin/main.An earlier ordinary process run observed
TestHarvestExternalCounterSetAndTerminalWaitfailing its positive-durationassertion around an empty function. Final ordinary/race process runs passed;
this follow-up neither changes that test nor claims to fix it. A new context
test's incorrect pointer-only assertion was corrected before the final runs.
The first SCA load timed out; a parallel retry was intentionally stopped to
reduce memory pressure before low-concurrency validation.
CI evidence and limitations
Run 34427084870
at
fcb92061cfwas cancelled as a whole. Retrieved SCA, ordinary UT and Composelogs end with
The operation was canceled; they are not passing evidence anddo not establish a new code failure. BVT intermediate
wait_expectmismatchesmust not be confused with a terminal failed assertion.
The preceding
55c74dbeb2ordinary UT runreached the 70-minute overall limit during embedded tests after light UT had
returned status 1. The retained log does not identify the failing light test and
no ordinary-UT report was uploaded. The active test at cancellation does not
prove causality. Coverage, SCA, Compose Proxy and Pessimistic BVT passed on that
preceding head. This documentation/rebase follow-up does not claim to resolve
that suite-level failure; new CI is not awaited for delivery.