Repository navigation
Waits for resume in compaction and stops bad keys leaking io - #115
Merged
Merged
Conversation
tur-nr
force-pushed
the
feature/usage-api
branch
from
October 1, 2026 09:54
bcf6030 to
6a42e4a
Compare
Contributor
|
@tur-nr Is this something that should land? |
Contributor
Author
|
@kasperisager it is, however I need to clean it up as I believe there are some unnecessary code. Will do this now. |
tur-nr
force-pushed
the
feature/usage-api
branch
from
November 3, 2026 03:47
6a42e4a to
9ec4788
Compare
tur-nr
marked this pull request as ready for review
November 3, 2026 03:49
[Medium impact] The PR appears safe to merge. SummaryMoves repeated resume checks and
No actionable issues were found. Tests were not run.
|
kasperisager
approved these changes
Nov 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
approximateSizeandcompactRangeencode their keys afterio.inc()but outside theirtry. A key that fails to encode leaves io held, so the nextsuspend()never drains.compactandcompactRangealso don't wait for resume the wayflush()and the stats calls do. Called while suspended, they fail withEINVAL.Proposal
_runWithIO(fn), which takes io, waits for resume and releases io in afinallyaround the whole callflush,approximateSize,currentWalFile,getProperty,compactandcompactRangego through itbatch._flush()keeps its own check, because a failed resume there already releases io through_abort()and_onfinished(), and the wrapper would release it twiceTests
A key that fails to encode makes
approximateSizeandcompactRangereject, and asuspend()andresume()afterwards still complete. Before the fix, both hung on the suspend.Suspend, then call
compactandcompactRange: neither settles untilresume(), then both resolve. Closing while they wait rejects both with "RocksDB session is closed", same as a waitingflush(). Before the fix, both failed straight away withEINVAL.Notes
Compaction issued during suspend now waits for resume instead of failing straight away. Worth a line in the release notes, like #113.
This PR started out adding
getUsageandgetDiskUsage. They've moved to their ownrocksdb-usagemodule, built ongetPropertyandcurrentWalFile, so only the fix is left here.The
compactRangetest uses a string key becausecompactRangereads an objectendas options, so a Buffer end is taken as opts. That's left for a separate fix.