Repository navigation
perf(spill): amortize bounded writes and incremental recovery projection - #30284
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? |
b992aed to
eaf1a84
Compare
|
mo-bot review · Commit: Review completed. Read the assessment. |
|
Fixed in The cross-owner counterexample is valid. I withdrew cross-write FD caching from this PR instead of adding a shared eviction/lease mechanism. HashBuild now uses main's per-physical-write open/close lifetime, and The accounted larger write-cache window, batched/all-tail writeback and incremental GROUPING projection remain. This gives up FD-reopen savings; the PR body now removes the combined writer benchmark as evidence for the remaining implementation and explicitly labels earlier SQL runs as historical, not current-head results.
Validation: 8 related packages passed normal tests with vet; 4 passed race; the new regression passed 100 race repetitions; incremental lint reported 0 issues. Native artifacts were rebuilt after rebase. Existing handoff/cache/cancellation/error-path assertions remain, except descriptor-reuse assertions that no longer describe the implementation. Remote CI for this revision is pending. |
|
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: ca3fda5588a96685e053d7faca2550b1921d444e
Assessment: approve
Reviewed the complete eight-file delta and affected ownership chains. The design reuses existing spill and budget owners, releases optional cache charges before recovery, and replaces repeated GROUPING scans with bucket-local state. Both prior FD-pressure findings are resolved. No actionable findings remain.
Model: gpt-6-astra / xhigh
Session: 01a13dcf-1586-7a01-9000-d45e20995cf8 · slot 1 · generation 1
Validation:
-
All 180 tests in hashbuild, spillio and spillutil passed in normal and race modes. Five writer-lifecycle tests each passed 100 race repetitions, covering shared FD pressure, cancellation, failed handoff and resource cleanup. Targeted go vet passed.
-
Base/head component measurements: 8,192 growing recovery prefixes improved from 172.881 ms to 0.126 ms with zero allocations. Small-file writing/handoff improved from 4.180 ms to 2.923 ms; streaming writes were approximately unchanged at 33.392 ms versus 33.158 ms.
-
Measured handoff costs explicitly: small-file allocations increased from 2,031 to 2,671 per operation. Optional cache capacity is fully charged and bounded at 128 MiB per 32-bucket bundle.
-
Reconciled native provenance, commands, source fingerprints, terminal results, logs and benchmark overlays in /home/xupeng/.local/state/mo-bot/jobs/c86aa077f948c1e09688477a/attempt-1/validation-audit.json. Final audit receipt: checks/1792123117270679951-4.json, exit 0. Source remains unchanged.
-
Frozen current-head CI records successful build, Ubuntu unit tests, static analysis and multi-CN BVT checks.
Limitations:
-
Component benchmarks used three samples of three iterations on Linux/amd64; they do not establish end-to-end SQL performance or statistical significance.
-
No exact-head BigData, TPCH or TPCDS run was available. The linked issue body was absent, and the PR explicitly claims only a partial optimization, not closure of the broader performance regression.
Merge Queue Status
This pull request spent 3 hours 24 minutes 12 seconds in the queue, with no time running CI. ReasonPull request #30284 has been merged manually at 2305954 HintYou were too fast! Waiting for any of
All conditions
Tick the box to put this pull request back in the merge queue (same as
|
What type of PR is this?
Which issue(s) this PR fixes:
Related to #29755. This is a partial performance repair, not a claim that the remaining BigData regression is fully resolved.
What this PR does / why we need it:
Reduce repeated writeback work in bounded HashBuild spill writes and repeated metadata scans in JOIN recovery without removing memory, disk, or FD admission.
Cross-write FD reuse, the conditional post-copy-check optimization, and all newly added sampled diagnostics/worker logs have been removed from this PR. Recovery retains main's per-input pre-copy AND post-copy budget checks. Physical allocation admission remains authoritative. No cross-owner reclamation mechanism or new FD admission API is introduced.
No planner, statistics, SQL, spill-record format, DOP, benchmark-input, or resource-limit changes. The legacy varlena-copy optimization is already on main through #30114 and is not duplicated here. The experimental EXPLAIN build repair is also excluded. Diagnostic fixtures, raw profiles, investigation documents, and harness changes stay outside this PR. Logical spill-record coalescing remains a future experiment and is not included.
Historical measurements from the unchanged TKE I3 + Q7 workload, not current-head results (3 CNs, each 14 CPU / 55 GiB; original SQL/data/concurrency and default spill settings):
d9b972252b, 383798994433331b03b279316d94277The latest run passed I3 result comparison and all 60 Q7 checks. Relative to the earlier experimental revision, I3 elapsed time decreased by 9.9%; relative to the original baseline, I3 remains 8.02% slower and Q7 is 6.27% faster. The 153.63-minute I3 result reported in #29755 is historical context, not a matched control for this PR. I3 and Q7 overlap, so these durations must not be added as suite wall time.
These are single-run historical comparisons, not isolated speedups attributable entirely to this diff: the earlier-to-latest improvement also includes the varlena repair now in main. The final redundant-check change alone produced no meaningful whole-query speedup (I3 5762.514 -> 5756.537 seconds). The remaining I3 regression is still under investigation.
Component evidence: incremental projection over 8192 retained prefixes reduced 106.458 ms to 0.120 ms with zero allocations. This establishes the local mechanism, not a predicted SQL percentage. The earlier combined writer benchmark included FD reuse and is no longer presented as evidence for the remaining writeback implementation.
Delivery is based on main
76deafc806. Only bounded writeback amortization and incremental recovery projection remain. The full-workload numbers above were collected on the named experimental revisions, which included FD reuse and diagnostic instrumentation, before this delivery cleanup. They are not an exact-current-head full-workload measurement or a fresh comparison against today's main. Removing FD reuse gives up its potential reopen/seek/close savings; current-head end-to-end BigData/TPCH/TPC-DS performance has not been measured.The retained tests cover finite shared query/CN FD caps across spill owners, optional cache-memory fallback, cancellation and failed handoff, exact read-back and terminal charges, and late GROUPING sentinels with per-bucket reset. Diagnostic-only assertions/benchmarks, optional-FD admission tests and the test specific to conditional post-copy checks have been removed with their implementations. Main's mandatory FD admission tests remain. No benchmark wall-time assertions or large diagnostic fixtures were added to unit tests.
Review repair (
ca3fda5588): cross-owner FD caching is withdrawn, rather than introducing a shared eviction mechanism. Both same-generation and cross-generation pressure regressions failed before the repair withrequested=1 used=2 cap=2and pass afterward. The tests retain a real active-reader FD, exercise both writers and handoff, and verify exact bytes and resource charges. HashBuild's physical-write path and mandatory FD admission are restored to main; batch writeback and incremental projection remain.Current validation: native artifacts rebuilt successfully through the repository build owner; 8 owning/consumer packages passed normal tests with vet; 4 related packages passed race; the new cross-owner regression passed 100 race repetitions; incremental lint reported 0 issues. New remote CI is pending. No exact-head whole-workload performance result is claimed.