CASSANDRA-21605 Improve algorithmic complexity for finding intersecting SSTables for LCS compaction candidates - #5061
Open
alanwang67 wants to merge 10 commits into
Open
CASSANDRA-21605 Improve algorithmic complexity for finding intersecting SSTables for LCS compaction candidates#5061alanwang67 wants to merge 10 commits into
alanwang67 wants to merge 10 commits into
Conversation
krummas
requested changes
Aug 26, 2026
krummas
left a comment
Member
There was a problem hiding this comment.
looks good to me, very small comments inline
| SSTableReader start = sstablesNextLevel.floor(sstable); | ||
| Iterator<SSTableReader> it = sstablesNextLevel.tailSet(start != null ? start : sstablesNextLevel.first(), true).iterator(); | ||
|
|
||
| while (it.hasNext()) { |
| return Collections.emptyList(); | ||
| } | ||
|
|
||
| public static Set<SSTableReader> getIntersectingSSTablesFromTreeSet(SSTableReader sstable, TreeSet<SSTableReader> sstablesNextLevel) |
Member
There was a problem hiding this comment.
can be package protected and @VisibleForTesting
| @@ -592,6 +596,26 @@ private Collection<SSTableReader> getCandidatesFor(int level) | |||
| return Collections.emptyList(); | |||
| } | |||
|
|
|||
Member
There was a problem hiding this comment.
maybe add some javadoc to describe that sstable will be included in the result
Contributor
Author
There was a problem hiding this comment.
Refactored this so that we add the sstable outside of getIntersectingSSTablesFromTreeSet to make it less confusing.
| ColumnFamilyStore cfs = MockSchema.newCFS(); | ||
| List<SSTableReader> sstables = new ArrayList<>(); | ||
|
|
||
| long seed = System.currentTimeMillis(); |
Contributor
Author
There was a problem hiding this comment.
Did this within the assert when it fails.
dcapwell
reviewed
Aug 31, 2026
dcapwell
reviewed
Aug 31, 2026
dcapwell
reviewed
Aug 31, 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.
For LCS, SSTables in levels 1 through level 8 are already stored in a tree set and are disjoint. However when we look for compaction candidates we do a linear scan of the entire set to find intersecting SSTables. We can instead just take the floor of the tree set and iterate forwards until we no longer find any intersections.
patch by Alan Wang;
reviewed by for CASSANDRA-21605
Co-authored-by: Name1
Co-authored-by: Name2