Repository navigation
Optimize wide scans for MARK joins under OR - #32607
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: 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: b41c17f371e857ac8deb636065867cd19c7cd8d7
Assessment: request_changes
The new MARK-to-scan guard coherently reuses exact runtime filters and late materialization, but its cross-owner execution dependency and resource policy trigger the repository's design-first gate. No exact versioned design revision or traceable approval is supplied.
Model: gpt-6.1-sol / max
Session: 01a1a004-9884-72c0-ad39-f096c4209c4a · slot 1 · generation 0
- P2
pkg/sql/compile/mark_guard.go:51: This new physical optimization adds compiler-owned guard/wait/reuse state and hashbuild key-admission policy across compiler, planner and scan owners; the new guard and key-admission files alone add 531 production lines.
Impact: The mandatory design-first contract is unmet. Provide or link a stable versioned design and its reviewed revision/approval covering the producer-consumer lifecycle, fallback, bounds and cost/reuse decisions before implementation approval. An RFC or a particular human approver is not required.
Evidence: .agents/skills/mo-self-review/SKILL.md:114 and .agents/skills/mo-dev/references/feature-design-review.md:22,42,63,79,93 require this gate. Both files are unchanged from merge-base. Frozen PR/discussion evidence supplies no reviewed design artifact; design-gate-evidence.json and change-map.md record scope and applicability.
Validation:
-
Read the complete 15-file delta, relevant runtime-filter/hashbuild/scan integration, all three discussion entries and linked issue #32552.
-
Bounded source/policy audit passed: exact clean head, changed-file fingerprints, 635 changed production lines and design policy unchanged from merge-base. Shared receipt and log retained.
-
Saved discussion-assessment.json with every nonempty discussion key covered exactly once.
Limitations:
-
Full implementation/lifecycle and runtime/performance validation were deferred at the repository's mandatory design gate; no Go tests or benchmarks were run locally.
-
SQL/race/performance results in PR prose are author reports; local_validation is empty and relevant frozen CI remained in progress. This finding is a design-contract gap, not a demonstrated production failure.
b41c17f to
2365d77
Compare
|
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: 2365d77973c05edacebf2dee8ca8bac8f1731d0e
Assessment: approve
The prior design-artifact finding is resolved by the exact versioned document and recorded independent approval. The main-branch implementation preserves the original MARK/OR/locking path, reuses complete exact-key production and late materialization, and bounds the additional local state. Conservative lineage, collation, topology and fallback checks justify the mechanism without another subquery, worker or wire format. The documented broad-alternative overhead is an accepted tradeoff; no actionable finding remains.
Model: gpt-6.1-sol / max
Session: 01a1a004-90c3-73b1-acc9-3d4636452003 · slot 0 · generation 0
Validation:
-
Completed the full 17-file delta and main-branch producer/consumer, SQL NULL/locking, bounds, wait, cleanup, clone/reset and prepared-cache review. Inspected the shared SQL fixture and nearby existing tests; the new public SQL case supplies distinct guarded-wide-scan and B-only locking oracles.
-
Read all five discussion entries. discussion-assessment.json accounts for each exactly once and resolves review 5870427146 against the current exact-hash design and recorded approval. The linked issue context was reused only after exact content comparison.
-
Verified design revision 0931537 and checked-in SHA256 3d8e73a63d1e352475c47cb937380b936409be96ac7fa56d55060aa79a888fca. Reviewed reuse, alternatives, publication/ownership, conservative fallback and broad-B cost decisions against the applicable design gate.
-
Local isolation preflight passed (checks/1794478485407766253-3.json; preflight.log). Frozen head, clean source, complete patch map, diff whitespace, Go formatting, design revision/hash and exact discussion coverage passed (checks/1794478803547278876-4.json; static-check.log; reviewed-inputs.json). Final audit reconciled receipts, retained logs and current input hashes.
-
Supplied current-head PR evidence reports Go1.27.1 affected hashbuild/table_scan/compile/plan race suites, individually focused 100-repeat tests, real single-CN SQL race and same-version two-CN SQL, plus molint/golangci-lint 2.14.0. Same-plan interleaved guard-off/on measurements report the selective gain and broad-B overhead. These are author-reported executions, not locally rerun tests.
Limitations:
-
No Go package, SQL, race or performance execution was independently rerun. local_validation is empty and this task has no matching retained native/runtime artifacts; runtime validation relies on the detailed frozen current-head report.
-
Relevant frozen CI remains in progress; skipped and pending checks are not treated as passes.
-
The accepted design records nonzero broad-B overhead and an unresolved 4.2 QA base/head regression with different INDEX plans. Current same-plan samples do not explain that comparison or establish universal production latency or peak-memory bounds. No cross-PR execution was treated as this main head's validation.
|
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: ee530ac97ea8d7b01fad27f64c9e2cdec41f1a81
Assessment: approve
The versioned design and recorded approval resolve the earlier design-gate finding. The local guard preserves MARK/OR/locking, reuses exact filters and late materialization, and bounds added state; the shared constructor preserves dependency short-circuiting. The documented broad-match cost is an accepted tradeoff. No actionable finding remains.
Model: gpt-6.1-sol / max
Session: 01a1a004-9884-72c0-ad39-f096c4209c4a · slot 1 · generation 0
Validation:
-
Reviewed the complete 17-file delta, actual planner/hashbuild/scan/compiler consumers, failure/retry/clone/cleanup paths, all seven discussion entries and linked issue #32552. discussion-assessment.json accounts for every key exactly once.
-
Verified approved design revision 0931537 and checked-in SHA256 3d8e73a63d1e352475c47cb937380b936409be96ac7fa56d55060aa79a888fca. Ownership, reuse, bounded state, fallback and cost decisions match the accepted design; no new wire or persisted format is introduced.
-
Local isolation preflight and frozen-input/design/policy/format/diff/discussion audits passed (checks/1794493300855997890-2.json and checks/1794493498429069259-2.json). The preflight's Git fingerprint timed out; its unchanged receipt is reconciled with the complete static receipt and frozen hashes in review-validation.json. Final audit passed.
-
Frozen PR evidence reports full affected hashbuild/table_scan/compile/plan race-short runs at 37d03ed, targeted 100-repeat tests, SQL race and same-version two-CN checks, and negative lock/order controls. Git confirms only the SQL regression test changed afterward; the final test is separately reported revalidated. These are author-reported executions.
-
Assessed the reported same-plan selective gains and broad-alternative overhead against the documented scope and bounded mechanism. Confirmed the original MARK/filter/lock remain authoritative, the producer is independent and local, and the consumer installs only a row predicate. review-closure.md records the source evidence and limits.
Limitations:
-
No Go package, SQL, race or performance execution was independently rerun for this PR. local_validation is empty; runtime validation relies on the detailed frozen author reports with the source and mode limits above.
-
Frozen CI remains pending. Earlier x86 failures and timeout remain unattributed; individually passing reruns do not explain the original CI load.
-
Warm local measurements do not establish universal latency or peak-memory bounds. The design records accepted broad-alternative overhead and an unresolved 4.2 QA comparison with differing INDEX plans; no main-head regression is inferred from that comparison alone.
|
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: d41f70eb6b5e7c97e6fd706d154b7be6e137f36f
Assessment: approve
The bounded local guard reuses existing exact-filter and scan owners while preserving MARK/OR/locking semantics. The restore probe now inherits the operation deadline without increasing budgets. The approved design and documented broad-match tradeoff remain satisfied; no actionable finding remains.
Model: gpt-6.1-sol / max
Session: 01a1a004-90c3-73b1-acc9-3d4636452003 · slot 0 · generation 0
Validation:
-
Reviewed all 18 changed files and relevant consumers, all nine discussion items and both linked issues.
-
Verified the approved design revision/hash and its two current validation-wording corrections.
-
Confirmed feature implementation, SQL regression and dependencies match ee530ac; reused frozen reports of affected race suites, SCA, coverage and BVT.
-
Reused the author's reported two-CN restore-root race run and incremental static checks; independently traced deadline, cancellation and retained assertions.
-
Local source/design/evidence audit passed: checks/1794507314476304282-3.json, exit 0; report and stdout/stderr retained.
Limitations:
-
Follow-up CI is pending. Runtime validation relies on qualified frozen reports; no Go/native, race or benchmark execution was rerun locally.
-
The loaded-CI 180-second restore timeout remains unexplained. This correction removes only the premature probe deadline.
-
Historical warm measurements do not establish production latency bounds; production replay and the differently planned 4.2 broad-match comparison remain unresolved.
What type of PR is this?
Which issue(s) this PR fixes:
Related to #32552
Related to #28742 (restore regression test deadline ownership)
What this PR does / why we need it:
For a conservative local MARK-join shape, a bounded optional
(probe IN complete_exact_keys) OR alternativerow guard lets the existing late-materialization reader defer wide columns. The original MARK join, OR filter, tenant residual and lock operator remain authoritative. Empty builds retain the alternative; unsupported, failed or oversized filters use the original plan. No wire or storage format changes.Eligibility and lineage checks are separate from final producer/consumer attachment. Conflicting terminal messages already visible in one receive batch decline the guard; exactly-once complete publication remains a producer requirement, and later duplicates cannot be detected by that check. The shared exact-filter constructor resolves planner dependencies lazily at the original short-circuit points, preserving rejected-candidate allocations and process-access behavior.
The restore regression also gives its metadata probe the restore operation's existing deadline. Previously, the probe had its own 120-second deadline while deliberately waiting behind a restore allowed 180 seconds. It now inherits the bounded operation context and retains separate cancellation. The 180-second operation and 300-second test budgets, deterministic lock/barrier checks, rollback checks and restored subscription/privilege assertions remain in place.
Design and bounds
The reviewed design revision has SHA-256
3d8e73a63d1e352475c47cb937380b936409be96ac7fa56d55060aa79a888fca. Initial design review was local before implementation; the public revision was added later and does not independently timestamp that earlier phase. GPT-6.1 Terra/max reviewed this revision and the complete implementation. The follow-up corrects validation wording and has a separate design and overall review for the deadline correction.The guard requires proven local independent build ownership, safe direct column lineage and bounded exact VARCHAR equality. Limits are 128 keys, 512 actual bytes per key, 128 KiB serialized payload and eight scan workers. The 64 KiB live-key bound excludes vector capacity, metadata, serialization and per-worker overhead.
Validation
ee530ac9, based on mainb9c06b27: SCA, x86 Coverage, PROXY BVT and pessimistic multi-CN BVT passed. Full race owning-package runs passed forhashbuild,table_scan,compile,planandsqlintegration.FOR UPDATEfails the waiter assertion. Those manual runs were not independently repeated in this follow-up. Producer, eligibility, conflicting-message and cancellation tests passed in the exact-head race CI; earlier author evidence also reports bounded repetitions. Exact-filter tests preserve dependency evaluation order and protocol/type rejection.-race -short -tags matrixone_test -p=2 -parallel=2. A temporary assertion in the real helper distinguishes the old prematurely shortened probe deadline from the corrected inherited deadline. Existing context-ownership race tests also cover bounded/unbounded callers, cancellation and original executor errors.make static-check-selectedforpkg/tests/issues/isolatedpassed: repository-pinned molint and golangci-lint 2.14.0, including govet and formatting, with zero issues. Unchanged feature static analysis is covered by the completed exact-head CI.The completed full race UT had one failing root:
TestIssue26640ClusterRestoreRebindsSubscriptionPrivileges, whose restore exceeded its 180-second operation deadline. Its trace confirms the probe expired at 120 seconds while restore still progressed. The correction addresses that premature probe expiry; it does not establish the cause or resolution of the separate 180-second restore timeout. Both original and corrected roots pass locally, which does not reproduce loaded CI. CI for the follow-up commit is pending.Performance and limitations
Earlier warm single-CN measurements on
2365d779used 61k rows, two 512-byte payloads and eight interleaved executions per mode. Guard installation, result cardinalities and matching physical operator sequences were checked. Complete-result times were:These historical samples are not a production latency bound. The independent 4.2 QA report measured a repeatable +22.1% broad-match base/head regression with different INDEX-join plans. Its cause remains unresolved; same-plan local comparisons do not disprove it. Existing estimates do not reliably capture tenant-specific alternative selectivity, so no unverified selectivity gate is added. The lazy planner follow-up restores zero allocations for the rejected scaled-FLOAT32 path; no end-to-end gain is claimed for that extraction. Production workload replay remains outstanding.