Skip to content

fix: reject Floor in pinned mode instead of leaking GC-pool segments - #490

Open
thweetkomputer wants to merge 1 commit into
mainfrom
fix/floor-pinned-mode-guard
Open

fix: reject Floor in pinned mode instead of leaking GC-pool segments#490
thweetkomputer wants to merge 1 commit into
mainfrom
fix/floor-pinned-mode-guard

Conversation

@thweetkomputer

@thweetkomputer thweetkomputer commented Jul 10, 2026

Copy link
Copy Markdown
Collaborator

Problem

A FloorRequest resolves a large-value floor entry into its own IoStringBuffer (floor_req->large_value_). In KV Cache pinned mode, GetGlobalRegisteredMemory() returns the shard-private GC pool, whose segments no public API can Recycle. So every Floor that lands on a large-value entry permanently drains num_segments from that pool. Once it empties, background segment compaction spins on YieldToLowPQ forever (space reclamation halts) and later large-value Floors hang.

Read already rejects its IoStringBuffer overload in pinned mode for exactly this reason (pinned callers must use the pinned-destination overloads). Floor has no pinned-destination variant, and its dispatch was missing the equivalent guard.

Fix

Reject FloorRequest in pinned mode (pinned_memory_chunks non-empty) with InvalidArgs, mirroring the Read guard.

Test

large_value_e2e [pinned]: a Floor against a pinned-mode store now returns InvalidArgs; without the guard it returns NoError (leaking the segments). Full suite passes (448 assertions).

Summary by CodeRabbit

  • Bug Fixes

    • Invalid Floor requests involving large values in pinned-memory mode are now rejected with a clear InvalidArgs error instead of being processed unsuccessfully.
  • Tests

    • Added coverage verifying that pinned large-value Floor requests are rejected as expected.

A FloorRequest resolves a large-value floor entry into its own
IoStringBuffer. In KV Cache pinned mode GetGlobalRegisteredMemory()
returns the shard-private GC pool, whose segments no public API can
Recycle, so each large-value Floor permanently drains it -- eventually
stalling segment compaction and hanging later large-value Floors. Read
already rejects its IoStringBuffer overload in pinned mode for the same
reason; Floor has no pinned-destination variant, so reject it too.

Regression test issues a Floor against a pinned-mode store and expects
InvalidArgs (returns NoError, leaking, without the guard).
@coderabbitai

coderabbitai Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: ee7a5970-b43b-4187-aaf6-4b81ba24aa62

📥 Commits

Reviewing files that changed from the base of the PR and between 51dc37d and ebd356d.

📒 Files selected for processing (2)
  • src/storage/shard.cpp
  • tests/large_value_e2e.cpp

Walkthrough

Floor requests now return InvalidArgs when pinned-memory chunks are enabled. A pinned-mode end-to-end test verifies this behavior after writing a large value.

Changes

Pinned-mode Floor rejection

Layer / File(s) Summary
Floor guard and end-to-end validation
src/storage/shard.cpp, tests/large_value_e2e.cpp
Shard::ProcessReq rejects pinned-mode Floor requests with InvalidArgs; the new test verifies rejection for a pinned large value and performs cleanup.

Estimated code review effort: 2 (Simple) | ~10 minutes

Poem

I’m a rabbit guarding the shard,
Pinned floors now fail before they start.
A large value hops into place,
Then InvalidArgs wins the race.
Tests tidy the burrow with grace.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and accurately summarizes the main change: rejecting Floor in pinned mode to avoid GC-pool leaks.
Description check ✅ Passed The description covers the problem, fix, and test, but it omits the issue reference requested by the template.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/floor-pinned-mode-guard

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant