Skip to content

Conversation

@samueldlightfoot
Copy link
Contributor

@samueldlightfoot samueldlightfoot commented Feb 8, 2026

Summary:

Wire compaction_read_disk_access_mode through cursor compaction to enable direct IO reads, matching the existing support in the iterator-based compaction path.

Changes:

  • Thread DiskAccessMode from DatabaseDescriptor.getCompactionReadDiskAccessMode() through CursorCompactor.createCursors() → StatefulCursor → SSTableCursorReader → SSTableReader.openDataReader(DiskAccessMode)
  • Extract CursorCompactor.createCursors() with proper cleanup on partial construction failure via Throwables.closeNonNullAndAddSuppressed
  • Fix DirectThreadLocalReadAheadBuffer.cleanBuffer() to clean the backing buffer (attachment) rather than the aligned slice, preventing a native memory leak on close
  • Ensure SSTable scanners are closed prior to opening cursor readers (resolving readahead buffer interference and excessive fd usage)

patch by Sam Lightfoot reviewed by for CASSANDRA-21147

@samueldlightfoot samueldlightfoot force-pushed the CASSANDRA-21147-cursor-direct branch 3 times, most recently from fe9e9e6 to 245ac52 Compare February 8, 2026 11:37
@samueldlightfoot samueldlightfoot marked this pull request as draft February 9, 2026 18:09
@samueldlightfoot samueldlightfoot force-pushed the CASSANDRA-21147-cursor-direct branch 3 times, most recently from b6f0cb2 to ef6f3f0 Compare February 10, 2026 10:58
@samueldlightfoot samueldlightfoot marked this pull request as ready for review February 10, 2026 10:59
This change wires DiskAccessMode through cursor-based compaction, enabling
direct I/O reads for cursor compaction to match the existing support in the
iterator-based compaction path.

Key changes:
- Thread DiskAccessMode from DatabaseDescriptor.getCompactionReadDiskAccessMode()
  through CursorCompactor, StatefulCursor, and SSTableCursorReader
- Consolidate SSTableReader's openDataReader/openDataReaderForScan variants into
  a unified openDataReaderInternal with canReuseDfile guard
- Fix DirectThreadLocalReadAheadBuffer.cleanBuffer() to clean the backing buffer
  rather than the aligned slice
- Ensure SSTable scanners are closed before opening cursor readers (resolving
  readahead buffer interference and excessive fd usage)
@samueldlightfoot samueldlightfoot force-pushed the CASSANDRA-21147-cursor-direct branch from ef6f3f0 to 0d16207 Compare February 10, 2026 13:43
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