Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CASSANDRA-17537: nodetool compact should support using a key string to find the range to avoid operators having to manually do this #1567

Closed
wants to merge 13 commits into from

Conversation

dcapwell
Copy link
Contributor

No description provided.

// we check index file instead.
if (sstable.getBloomFilter() instanceof AlwaysPresentFilter && sstable.getPosition(key, SSTableReader.Operator.EQ, false) != null
|| sstable.getBloomFilter().isPresent(key))
if (sstable.isPresent(key))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

moved this logic into the sstable so it can be reused

@@ -928,10 +929,10 @@ protected void runMayThrow()
return futures;
}

public void forceCompactionForTokenRange(ColumnFamilyStore cfStore, Collection<Range<Token>> ranges)
public void forceCompaction(ColumnFamilyStore cfStore, Supplier<Collection<SSTableReader>> sstablesFn, com.google.common.base.Predicate<SSTableReader> sstablesPredicate)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is slightly weird to have both the Supplier and the Predicate here - but i guess its needed due to that sstablesInBounds method. Maybe we should add an assertion that sstablesPredicate.test(..) returns true for sstables from sstablesFn

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure about this one, sstablesFn is called when compaction is paused, so if I call earlier than that could that not cause problems? Unless I call early not sure how to get access to the SSTables

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I meant that after calling sstablesFn.get() in taskCreator we just assert sstables.stream().allMatch(sstablesPredicate);

but its fine leaving out as well

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added

List<SSTableReader> sstablesNotInPredicate = sstables.stream().filter(a -> ! sstablesPredicate.test(a)).collect(Collectors.toList());
            assert sstablesNotInPredicate.isEmpty() : String.format("Attempted to force compact %s, but predicate does not include", sstablesNotInPredicate);

I prefer it show which sstables not included than existence

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this check broke some tests due to (32, 31] finding files that had bounds (32, 32]

src/java/org/apache/cassandra/dht/Splitter.java Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants