Repository navigation
Measure segment liveness in bytes - #21
Merged
Merged
Conversation
Stored references now carry the image size, so the liveness walk sums real bytes without reading pages, and compaction_live_ratio compares live bytes with allocated bytes instead of counting node images. Background passes relocate only the emptiest qualifying segment so a single pass can't hold the commit lock for too long. The storage format moves to 3 because every reference gained the size field.
venkat1701
force-pushed
the
fix/compaction-live-bytes
branch
from
October 4, 2026 08:13
dda6661 to
04c15d7
Compare
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.
Closes #7
Compaction used to count live node images, but images range from 64 bytes to a whole page, so a segment full of dead big leaves could look half alive. Stored references now carry the image size in 64-byte units (one varint, at most 3 bytes per reference). The liveness walk sums real bytes from the references alone, without reading any page, and
compaction_live_rationow compares live bytes with allocated bytes.With an honest measure more segments qualify, and relocating several at once held the commit lock long enough to visibly slow ingest. So the background pass now relocates only the emptiest qualifying segment per pass.
COMPACTstill does all of them.This changes the on-disk format (every reference gained a field), so FORMAT goes to 3 and older directories are refused with the usual message. Nothing is released yet, so I didn't write a migration.
Numbers, scale 4 async with only HStore running:
ingest.nodes, which never compacts, came out at half its usual rate. Worth rerunning on a quiet box before reading anything into ingest speed.The compaction test now also checks that liveness comes back in bytes, as whole 64-byte units and never more than the segment's allocation. Full
./mvnw installpasses locally.