Skip to content

fix(pSpool): reserve cached backing across batch columns on 4.2-dev - #32753

Merged
mergify[bot] merged 1 commit into
4.2-devfrom
codex/32751-batch-cache-42
Nov 14, 2026
Merged

mergify[bot] merged 1 commit into
4.2-devfrom
codex/32751-batch-cache-42

Conversation

@XuPeng-SH

Copy link
Copy Markdown
Contributor

What type of PR is this?

  • API-change
  • BUG
  • Improvement
  • Documentation
  • Feature
  • Test and CI
  • Code Refactoring

Which issue(s) this PR fixes:

Related to #32751 (P2; the tracker remains open).

What this PR does / why we need it:

Per-column cache selection can give a small TEXT column the only large cached payload block and force a later large column to allocate another block, even with exact-fit acceptance. With cached [empty, 128 MiB] followed by [1 MiB, 128 MiB], the target can hold two 128 MiB areas instead of 1 MiB plus 128 MiB.

Prepare unique destinations, reserve compatible exact matches across the batch, then match remaining requests largest-first before undersized fallback. Size descriptor/fixed backing from live rows instead of historical spare capacity. Payload and metadata copies retain source-column order. Remove duplicated searches and route the existing selection/provenance tests through the common matcher. All production changes stay in pSpool; existing ownership, allocation-account checks and terminal cleanup remain with their current owners.

Validation on Linux amd64, CPU-only, Go 1.26.4:

  • Small real-Vector regressions fail on the unmodified base and pass after the fix. Cover exact/padded needs, column order, aliases, spare descriptor backing, nil/NULL/constants, 40-column scratch growth, allocation failure, slot return and successful retry. Existing boundary oracles are retained.
  • Full pSpool, connector and dispatch normal/race suites and builds pass; scoped vet and configured incremental golangci-lint report zero issues. Final NULL test changes reran pSpool normal/race/static; unchanged consumer evidence is reused.
  • Separate diagnostic overlays with 1 MiB + 128 MiB values measure target native backing/peak and owned large-mapping present pages falling from about 256 MiB to 129 MiB, saving 127 MiB. Contents match and final pool balances are zero. These large probes are outside CI/source delivery; maintained regression data are KiB-scale.
  • Alternating six-sample microbenchmarks keep Go bytes/allocation counts unchanged for the tested one-, two- and 20-column shapes. Accepted narrow-path cost: +26 ns (+6.3%) for two columns and +38 ns (+4.1%) for a single fixed column; 20 columns improve 13%. Wider calls can use transient O(columns) heap scratch beyond the local workspace.

This proves the component reuse improvement, not a whole-CN RSS reduction, production OOM fix or universal SQL speedup. Mixed-history cache retention and full-query working-set budgets remain follow-up work.

@qodo-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@mergify

mergify Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Queue requested — the merge queue status continues in this comment ↓.

@XuPeng-SH

XuPeng-SH commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor Author

mo-bot review · mo-bot-local · done

Commit: 81e66c3b2999f817f6882a10ce74736463f47d90

Review completed. Read the assessment.

@XuPeng-SH XuPeng-SH left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mo-bot review · mo-bot-local · review

Commit: 81e66c3b2999f817f6882a10ce74736463f47d90

Assessment: approve

The common matcher reserves backing across columns while preserving provenance and cleanup owners. Its per-call planning and pending sort replace duplicated selection logic and are justified by the scoped allocation saving. No actionable finding remains.

Model: gpt-6.1-sol / max

Session: 01a1a004-90c3-73b1-acc9-3d4636452003 · slot 0 · generation 0

Validation:

  • Reviewed the complete four-file delta, all three discussion entries and tracker #32751; closed logical sizing, aliases, compatibility, partial failure, slot reuse and connector/dispatch terminal ownership.

  • Local isolation preflight, frozen source/patch identity, gofmt, diff checks, unchanged owner fingerprints, preservation of existing assertions and receipt/log reconciliation passed.

  • Reused attributed author reports for baseline-failing real-Vector regressions, full pSpool/connector/dispatch normal/race/build/static checks, large-backing probes with zero balances and alternating microbenchmarks.

Limitations:

  • The local focused test stopped before compilation because cgo/libmo.so is missing; no native test binary ran. Raw author execution logs were unavailable.

  • Shared build, UT, SCA, coverage and Go analysis remain pending in the frozen CI snapshot, not passes.

  • Accepted costs include transient O(columns) scratch and reported 26–38 ns increases on narrow shapes. Component backing/resident-page savings do not establish whole-CN RSS or universal SQL improvement.

@iamlinjunhong iamlinjunhong left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

审查结论:APPROVE。已审查当前精确 head 81e66c3b2999f817f6882a10ce74736463f47d90 相对 4.2-dev 基准 405195b4a8529a6f032ea74ab71037509050d20d 的全部四文件变更,未发现可证实的范围内问题。

范围依据为 #32751 中的整批缓存匹配子项。核对了精确匹配预留、剩余需求降序分配、逻辑 descriptor/fixed 大小、别名和 nil/NULL/常量处理、allocation-account/data-area 兼容性,以及复制失败、slot 返回、重试和 connector/dispatch 消费者清理链路。新增小规模回归保留了既有选择和所有权断言。本轮是首次 review,无待逐项复核的上轮意见;现有机器人 review 未提出问题。缓存保留策略及整个 CN 的 RSS/工作集优化属于 tracker 的后续子项,不作为本 PR 验收条件。

验证:本轮完成源码及测试审查,git diff --check 和 Loom check-pr-artifacts 均通过,源码工作区保持干净。未运行本地定向测试:提供的精确 head CI 已有 UT、coverage、构建及 SCA 成功结果,当前代码核对未留下必须本地复现的不确定性;作者报告的 normal/race 与内存/性能测量未在本轮独立重跑,不将其表述为本轮实测。

CI 以本轮 review-context.json 为准:本次 Actions 等共 34 个 checks,19 success、13 skipped、2 neutral;并非全部 success,但无 failure 或 pending,CI Required 为 success。

@mergify mergify Bot added the queued label Nov 14, 2026
@mergify
mergify Bot merged commit 85f2eba into 4.2-dev Nov 14, 2026
@mergify

mergify Bot commented Nov 14, 2026

Copy link
Copy Markdown
Contributor

✅ Merged into 4.2-dev as 85f2eba at 23:21 UTC

Less than a minute in the queue, with no time running CI.

So far

  • ✅ Entered the queue Sat 14 Nov, 23:21 · rule release-4.2 · triggered by rule Automatic queue on approval for release-4.2
  • ✅ Checks skipped · PR is already up-to-date
  • ✅ Merged 23:21 · 85f2eba · squash
3 merge conditions met
  • #review-threads-unresolved = 0 · required by GitHub branch protection
  • github-review-approved · required by GitHub branch protection
  • any of · required by GitHub branch protection:
    • check-success = CI Required
    • check-neutral = CI Required
    • check-skipped = CI Required

Times in UTC · dashboard · how the merge queue works

This branch was previously deployed

1 inactive deployment
ci — 81e66c3b Deployed Nov 14, 2026 by XuPeng-SH
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/bug Something isn't working size/M Denotes a PR that changes [100,499] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants