Skip to content

fix(objectio): recycle merge buffer when streaming spill fails - #31634

Merged
XuPeng-SH merged 2 commits into
matrixorigin:mainfrom
MatrixAdventurer:fix/sinker-merge-buffer-31622
Oct 29, 2026
Merged

XuPeng-SH merged 2 commits into
matrixorigin:mainfrom
MatrixAdventurer:fix/sinker-merge-buffer-31622

Conversation

@MatrixAdventurer

Copy link
Copy Markdown
Contributor

What type of PR is this?

  • BUG

Which issue(s) this PR fixes:

Fixes #31622

What this PR does / why we need it:

When a streaming merge spill's file sinker fails, its callback returns a nil buffer. MergeSortBatches then loses the buffer and the Sinker cannot recycle it, leaving its vector allocations charged to the memory pool. Return the buffer along with the error so the existing cleanup path can put it back.

Regression tests exercise successful and failed writes with partial and full blocks, using both on-heap and off-heap buffers. The failure cases leak 96 KiB on the base revision and return to their original accounting after the fix.

Validation

  • go test -p 4 -count=1 ./pkg/objectio/ioutil (passed).
  • git diff --check (passed).

@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 →

@XuPeng-SH

XuPeng-SH commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

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

Commit: 4fd15aea4c0eff5d32ab07131831b1ef6d71e203

Review completed. Read the assessment.

@XuPeng-SH XuPeng-SH 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.

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

Commit: 4fd15aea4c0eff5d32ab07131831b1ef6d71e203

Assessment: approve

The fix preserves merge-buffer ownership on Sink failure, allowing existing cleanup to reclaim it while retaining the original error. Reviewed the complete delta, consumers, regression oracles and discussion; no actionable findings remain.

Model: gpt-6-astra / xhigh

Session: 01a13dcf-1586-7a01-9000-d45e20995cf8 · slot 1 · generation 1

Validation:

  • Traced full-block and partial-block failures through both merge algorithms and pool cleanup.

  • Reused supplied frozen-head CI successes for build, UT, SCA, coverage and multi-CN BVT.

  • Static audit passed: source unchanged, exact delta, diff whitespace and complete discussion coverage. Receipt: checks/1793241389758059560-4.json; log: static-audit.log.

  • Saved review-plan.md, review-evidence.md, discussion-assessment.json and validation-summary.json.

Limitations:

  • No local Go tests or S3 fault injection performed. Supplied CI statuses lack per-test logs; author baseline and race claims were not independently reproduced.

@mergify mergify Bot added the queued label Oct 29, 2026
@mergify

mergify Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

🚫 Left the queue

20 min in the queue, with no time running CI.

So far

  • ✅ Entered the queue Thu 29 Oct, 02:38 · rule main · triggered by rule Automatic queue on approval for main
  • ⏹️ Testing stopped · in place
  • 🚫 Left the queue 02:58 · a6b08c4

Reason

Pull request #31634 has been dequeued

Pull request from fork cannot be queued. This pull request comes from a fork, and Mergify needs the author's permission to update its branch.

The author needs to enable "Allow edits from maintainers" on this pull request.

Hint

You should look at the reason for the failure and decide if the pull request needs to be fixed or if you want to requeue it.
If you do update this pull request, it will automatically be requeued once the queue conditions match again.
If you think this was a flaky issue instead, you can requeue the pull request, without updating it, by posting a @mergifyio queue comment.

Merge conditions: 2 of 3 met

This pull request

Condition Required by
✅ #review-threads-unresolved = 0 GitHub branch protection
✅ github-review-approved GitHub branch protection

The batch, tested in place

Condition Required by
❌ any of: check-neutral = CI Required, check-skipped = CI Required, check-success = CI Required GitHub branch protection

Tick the box to put this pull request back in the merge queue (same as @mergifyio queue).

  • Requeue this pull request

Times in UTC · dashboard · how the merge queue works

This branch was previously deployed

1 inactive deployment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dequeued 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.

[Bug]: streaming merge spill abandons its merge buffer when the file sinker fails, leaking mpool capacity

3 participants