Repository navigation
[4.2-dev] fix(plan): skip empty predicate deduction traversals - #31512
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.
Reviewed 71f28c2 against 4.2-dev 86a45d3. No blocking code findings.
The four guards match the existing main fix, preserve the normal child traversal and nonempty deduction paths, and add no state or execution mechanism. Production net +8 lines and test +165 lines are justified by the targeted regression coverage; no documentation/proof artifacts were added.
Independent local validation (Go 1.26.4, macOS arm64, branch-built native libraries):
- Focused planner selection: 48 top-level tests passed. Running the new 8-table regression against exact base production code fails as expected: 509 visits versus 15 on head.
- Same real PREPARE/BuildPlan entry, 16-table INNER chain with first-table filter, base/head/base: approximately 93ms / 138.5 MiB allocated on base versus 0.33ms / 0.59 MiB on head. Single-table allocation controls are unchanged; longer LEFT-chain controls show no stable regression. This measures planning, not query execution.
- Actual 3-CN SQL: 17 scenarios, each direct and PREPARE/EXECUTE, passed, covering duplicates, NULLs, outer/semi/anti joins, scalar subquery, CTE/UNION/LIMIT and invalid-PREPARE recovery.
Reused the exact-head successful CI UT/race and SCA runs. CI is still red: pessimistic BVT first fails ddl_atomicity.sql:123 with retry for CN rolling restart, causing subsequent DDL failures and blocking coverage aggregation. I did not reproduce that CI incident on base, so this approval does not assert it is proven unrelated or waive CI.
Scope is appropriately limited to empty-deduction amplification on 4.2-dev; it is not a general planner memory-budget guarantee.
|
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: 71f28c21fc9b417c18f9f7f9dc9da410ec3d0fb0
Assessment: approve
The complete two-file change removes empty deduction traversals while preserving ordinary child traversal and nonempty predicates. Regression coverage is appropriate. No actionable defects remain; later successful CI supersedes the earlier red-CI status note.
Model: gpt-6-astra / xhigh
Session: 01a13dcf-1586-7a01-9000-d45e20995cf8 · slot 1 · generation 1
Validation:
-
Reused exact-head reports covering focused/full planner tests, baseline regression controls, comparative performance measurements, and 17 direct/PREPARE SQL scenarios on three CNs.
-
Frozen CI records successful UT, SCA, BVT, coverage and required-gate checks.
-
Local source, patch, formatting and discussion-coverage audit passed; source unchanged. Receipt/log correlation: /home/xupeng/.local/state/mo-bot/jobs/1cad8cf223a493e3f2d26a8e/attempt-1/validation-receipt-index.json.
Limitations:
-
No new Go tests were run. Reused execution reports remain attributed evidence; their raw logs were not supplied.
-
This fixes empty-deduction amplification, not general planner memory bounds. The production SQL remains unknown.
What type of PR is this?
Which issue(s) this PR fixes:
Related to #31502.
What this PR does / why we need it:
Minimally backport the non-empty predicate-deduction guards from main commit
5d6f921345(#26927). Skip the extra child traversal when no predicates were deduced, while preserving normal pushdown and non-empty deduction. No UPDATE alias, DEDUP, cancellation, or other changes from that PR are included.Add deterministic regression coverage for both chain directions and all six affected JOIN types, non-empty deduction semantics, and an eight-table PREPARE through the real planner entry point. The unpatched eight-table INNER chain performs 509 visits for 15 nodes; the guarded version performs 15. Independently reverting any of the four guards is caught by the regression.
Validation on this target branch (Go 1.26.4, macOS arm64, branch-local native libraries):
pkg/sql/plantests,go vet, and incremental golangci-lint 2.6.2 pass.This addresses empty-deduction traversal amplification, not a general planning-memory budget or a proof of linear planning cost for every SQL shape. No changes to main are included.