CASSANDRA-21085 Preserve offsets when splitting cache eviction requests larger than 2 GiB - #5134
Open
cheeeee wants to merge 1 commit into
Open
CASSANDRA-21085 Preserve offsets when splitting cache eviction requests larger than 2 GiB#5134cheeeee wants to merge 1 commit into
cheeeee wants to merge 1 commit into
Conversation
cheeeee
force-pushed
the
CASSANDRA-21085-trunk
branch
from
September 11, 2026 22:50
39b4689 to
e657cd2
Compare
Advance the offset after each bounded native request and preserve the requested starting offset when length zero means the remainder of a file. Cover multi-chunk ranges and the zero-length boundary at the native call interface. CASSANDRA-21085 Generated-by: Claude (Anthropic)
cheeeee
force-pushed
the
CASSANDRA-21085-trunk
branch
from
September 12, 2026 02:49
e657cd2 to
46d7230
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-21085 reports "Failed trySkipCache on file: ... Error: Invalid argument" during compaction.
NativeLibrary.trySkipCache(fd, offset, len, path) splits a request into int-sized chunks for the native
binding. After the first chunk it subtracted the chunk length from the offset instead of adding it, so
every following chunk was issued with a negative offset and posix_fadvise returned EINVAL. This can only
happen when the requested range exceeds Integer.MAX_VALUE bytes, i.e. on data files larger than 2 GiB.
Separately, a zero-length request (meaning "to end of file") dropped its starting offset and was issued
from 0.
Changes:
POSIX_FADV_DONTNEED only drops pages fully covered by the range, so an unaligned chunk boundary leaves
the page that straddles it resident; a boundary that is a multiple of every common page size
(4K, 16K, 64K) does not.
Testing:
tuples for a range of 2 * FADVISE_MAX_CHUNK + 17 bytes, three calls), testSkipCacheZeroLength (offset
preserved), testSkipCache.
Integer.MAX_VALUE chunks leaves the page straddling the first chunk boundary resident (mincore: 1 page);
issued in FADVISE_MAX_CHUNK chunks it is evicted (0 pages).
CASSANDRA-21085