Conversation
Record the current output byte position after an offline cache-skip request so later partitions wait for the next preemptive interval. Exercise request ranges across populated and empty writer switches. CASSANDRA-19569 Generated-by: Claude (Anthropic)
cheeeee
force-pushed
the
CASSANDRA-19569-trunk
branch
from
September 11, 2026 22:50
db95802 to
adc1524
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.
CASSANDRA-19569 reports sstableupgrade running far below disk throughput, with a profile dominated by
posix_fadvise.
SSTableRewriter.maybeReopenEarly is called on every append and is meant to skip the page cache of the
source readers once per preemptiveOpenInterval bytes of output. The offline branch never updated
currentlyOpenedEarlyAt, so once the output exceeded the interval the condition held for every appended
partition, and each append performed an index lookup plus a POSIX_FADV_DONTNEED over [0, current
position) on every source file. The online branch already records the position when it reopens early.
Change: record writer.getFilePointer() after the offline cache skip, so the advice is issued once per
interval. One line, plus a corrected field comment (the value is a byte position, not MiB).
Testing:
NativeLibrary.trySkipCache(String, long, long) records every advised range while an offline rewriter
appends across three writers; asserts one advice per interval with the expected ranges. Without the fix
it fails with an extra advice on the partition after the interval is first exceeded.
~1 KB partitions takes 6980 ms (17.0 MB/s) without the fix and 1894 ms (62.6 MB/s) with it; with
~84 B partitions, 5.8 MB/s against 18.0 MB/s, since the cost is per partition. bpftrace shows
69,394 fadvise64 calls before against 3 after and 111,048 openat calls against 35,251, as
trySkipCache(String, long, long) reopens the data file per call; only 253 ms of the difference is
inside fadvise64. The ticket's ramdisk asymmetry did not reproduce: tmpfs is equally slow unpatched.
CASSANDRA-19569