Skip to content

fix(pSpool): reuse exact-fit buffers on 4.2-dev - #32752

Merged
XuPeng-SH merged 1 commit into
4.2-devfrom
codex/32751-exactfit-42
Nov 14, 2026
Merged

XuPeng-SH merged 1 commit into
4.2-devfrom
codex/32751-exactfit-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 (P1; the broader memory-amplification tracker remains open).

What this PR does / why we need it:

Accept compatible exact-fit buffers in both pSpool best-fit searches, matching the rule already present in main (#31409). Previously an exact-sized TEXT payload buffer could be assigned to a tiny descriptor request, forcing another payload allocation. A 4 KiB value reproduces the extra 4 KiB allocation on the second copy; the neighboring 4097 B control passes before and after the fix.

The production change is two comparison operators. Bring main's nine selection boundary cases to 4.2-dev and add a small real-Vector reuse regression that checks values, row count, zero post-warmup native allocation, stable retained bytes, and final pool cleanup. Existing provenance/ownership guards and fallback behavior remain in place.

Validation on Linux amd64, CPU-only, Go 1.26.4 with fresh native artifacts:

  • Before the fix: five exact-fit selection cases and the 4 KiB copy case fail; neighboring controls pass. All new cases pass after the fix.
  • Full pSpool, connector and dispatch tests pass in normal and race modes (-count=1), including allocation-failure, consumer completion and abort/cleanup paths. All three packages build.
  • Scoped go vet, configured incremental golangci-lint (zero issues), gofmt and git diff --check pass.
  • Main already includes the correction and corresponding selection/stable-retention/payload-lifetime tests; those existing tests pass normal and race locally with Go 1.27.1. Main needs no duplicate change for this step.

This PR establishes the exact-fit reuse invariant. Whole-batch assignment, mixed-size cache retention and end-to-end CN peak reduction remain follow-up work in #32751; this is not a production OOM or overall RSS-gain claim.

@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

This pull request is merged.

@XuPeng-SH

XuPeng-SH commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor Author

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

Commit: 264933a8fe45610074627c5e0ef4f479df14184e

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: 264933a8fe45610074627c5e0ef4f479df14184e

Assessment: approve

The exact-fit fix preserves existing selection, provenance and cleanup mechanisms without adding state. Complete source and regression-oracle review found no actionable defect.

Model: gpt-6.1-sol / max

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

Validation:

  • Reviewed the complete delta, linked issue, discussion and affected lifecycle consumers; discussion ledger saved.

  • Isolation preflight, patch identity, clean-source verification, gofmt, diff checks and receipt/log reconciliation passed.

  • Author reports baseline controls and successful pSpool, connector and dispatch normal/race runs.

  • Frozen CI records a successful shared MatrixOne build.

Limitations:

  • Focused local tests stopped before compilation because cgo/libmo.so is missing; no local native test binary ran.

  • Raw author runtime logs were unavailable. Relevant hosted tests and Go analysis remain pending, not passes.

  • The scoped allocation improvement does not establish full-CN RSS or OOM reduction.

This branch was previously deployed

1 inactive deployment
ci — 264933a8 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.

2 participants