Repository navigation
Consolidate remote expression send fences and version probes - #29576
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? |
XuPeng-SH
left a comment
There was a problem hiding this comment.
Deep review of ffee1890cc6c0d19e76621507437273638d21dde against base/merge-base 529ee099e32ed8c38d2806043bf1516ab0345e45: no blockers found; no-blocker / merge recommendation for this revision.
Current login XuPeng-SH authored this PR. This COMMENT is an author-account self-review record, not an independent formal APPROVE. No subagents were used; all 19 changed files/hunks were inspected.
Design / quality
The direction is appropriate: reuse existing compiler expression-analysis and capability owners, remove all eleven obsolete per-feature destination wrappers, and keep only a call-local raw worker-version observation. No cache, persistent field, duplicate state machine, wire/storage format, configuration or alternate execution path is added. Implementation +203/-599 (net -396), tests +183/-6, document +39 were reviewed separately.
The ordered gates retain individual floors and first-failure diagnostics. Source validation and independent receiver analysis remain intact. A later send recomputes/re-probes, including Scope/Compile reuse. Coordinator floor and cancellation remain live per enabled gate. Bound executable variables, string provenance, grouping's complete consumers (including pre-stripping root dispatch) and vector's actual-stream handshake keep their distinct responsibilities.
Unhappy / affected-path closure
| Boundary | Ownership, termination and boundedness |
|---|---|
| Single-worker probe | Exact pipeline address + optional identity; missing/stale/unknown/error evidence fails closed. Every nonnil response, including response+error, has one deferred release; scalar copied before release. Probe timer canceled. |
| Group helper / reverse consumers | Single group-wide five-second budget, coordinator precheck, low-version early exit and transient-error mapping retained. Placement/scheduling, grouping, vector, strict-write, group-concat timezone and fulltext2-tail consumers traced. Context/deadline continues through cluster lookup and MORPC queue/write/future waits; query client retains future cleanup ownership. |
| Sender / receiver / generation | No added goroutine, lock, queue or retained growth. Fixed gates and existing input-bounded traversal. Receiver independently analyzes decoded data. Distinct transport fences are not replaced by the expression observation. |
Verification
Fresh local Go1.26.4 darwin/arm64 Apple M4 evidence, exact-head native inputs built/matched:
- Complete
pkg/sql/compilenormal run, no run filter: terminal exit0, 7.793s, 2,784 product PASS identities, plus reviewer overlays. - Independent differential using verbatim base encoder/wrappers/group probe: 8 executable shapes × 19 distinct worker versions = 152 cells. Exact failure text/precedence or byte-identical successful pipeline; head probes <=1; release counts match. All pass.
- Four separately selected tests under
-race -count=100: send/Scope reuse, live guards, unknown evidence, and reviewer barrier-controlled cancellation during the actual send probe. All 400 top-level iterations pass, zero race reports. Cancellation returns response+error and verifies termination,context.Canceled, and one release. - Reused exact-head CI 37069556794, inspecting checkpoint/artifact evidence rather than badges alone: compile selected under race without run filter, actual multicn binary execution, successful related CONV/IP/generated-column/temporal/grouping/decimal BVT reports, SCA. Two-CN integration verifies the remote peer in an actual physical plan; individual small BVT SQL is not assumed to force remote execution.
- Exact-range
git diff --checkpasses; detached product worktree clean. Reviewer legacy/probe code lives only in temporary Go overlays, not PR edits.
Normal command: .agents/skills/mo-dev/scripts/mo-cgo-test -overlay=<reviewer-overlay.json> -v -count=1 -timeout=15m -p=1 ./pkg/sql/compile. Repeated targets add -race -count=100 -run '^<one named test>$'.
Performance / scope
Real send and serialization, zero-latency fake version client, normal build, GOMAXPROCS1, three legacy/head/head/legacy interleaved rounds, 500ms/sample:
| Shape | Base/head median ns/op (6 samples/mode) | Probes/op | Allocs/op | B/op |
|---|---|---|---|---|
| Plain | 2650 / 2160 | 0 / 0 | 9 / 9 | 1216 / 1216 |
| Mixed | 7543.5 / 4474.5 | 3 / 1 | 39 / 19 | 5528 / 2728 |
| Wide | 25333.5 / 15015 | 3 / 1 | 39 / 19 | 7416 / 4616 |
Initial grouped timings were noisy/contradictory; interleaving resolved the concern, with improvement in every round per shape. Fewer probes/allocations and no extra plain-path allocations are repeatable. These remain component measurements, not whole-query/CI speedup guarantees. The author's single issues-suite pair and higher peak RSS do not prove CI-minute or peak-memory improvement. Keep #29562 open: this is a bounded contribution, not fulfillment of its 600s target.
Comments / conclusion
Fresh complete query returns 0 review threads: no outstanding human comment requests to claim resolved. Existing fengttt approval is on this exact head.
Design, implementation, retained/new behavioral tests and document are aligned. No confirmed correctness, unhappy-path, affected-path, data-compatibility or engineering-quality blocker remains in this range. No product code was changed during review.
Remote expression send validation independently walked the same pipeline and queried the same destination for each enabled feature. This change analyzes expression requirements once and shares one raw destination version observation within a send, using the existing compiler capability owner.
The ordered gate preserves feature-specific version floors and diagnostics, checks live cancellation and coordinator protocol at each enabled gate, and releases responses on all paths. Receiver analysis, string provenance, vector stream handshakes and grouping consumer checks retain their independent responsibilities. Each subsequent send analyzes and probes afresh; no cache, new state machine or wire change is introduced.
Deletes 11 obsolete per-feature wrappers: production changes are 203 additions / 599 deletions (396 fewer lines); test changes are 183 additions / 6 deletions, retaining existing end-to-end cases and adding ordered-floor, cancellation, rollout, unknown/stale destination and response ownership coverage.
Design: approved exact revision. Related to #29562; this does not close the CI optimization goal.
Validation:
Matched local measurements use prebuilt race binaries, eight pinned CPUs and NVMe runtime storage. Whole issues wall time: 530.55 → 508.88 s (-21.66 s / -4.08%); CPU: 935.39 → 889.61 s (-4.89%); cumulative allocations: 43,441.55 → 42,361.31 MiB (-2.49%, about 1.05 GiB less). Peak RSS increased 3.65% (3,502,900 → 3,630,868 KiB). This single pair demonstrates neither peak-memory reduction nor minutes saved in CI.
Real send microbenchmark medians under race: mixed expressions -36.34%, wide expressions -37.85%; expression-destination probes 3 → 1 and allocations 39 → 19. These measurements use a zero-latency fake version client and are not extrapolated to CI duration.