use of org.apache.cassandra.db.lifecycle.View in project cassandra by apache.
the class IndexSummaryManager method getCompactingAndNonCompactingSSTables.
/**
* Returns a Pair of all compacting and non-compacting sstables. Non-compacting sstables will be marked as
* compacting.
*/
@SuppressWarnings("resource")
private Pair<List<SSTableReader>, Map<TableId, LifecycleTransaction>> getCompactingAndNonCompactingSSTables() {
List<SSTableReader> allCompacting = new ArrayList<>();
Map<TableId, LifecycleTransaction> allNonCompacting = new HashMap<>();
for (Keyspace ks : Keyspace.all()) {
for (ColumnFamilyStore cfStore : ks.getColumnFamilyStores()) {
Set<SSTableReader> nonCompacting, allSSTables;
LifecycleTransaction txn = null;
do {
View view = cfStore.getTracker().getView();
allSSTables = ImmutableSet.copyOf(view.select(SSTableSet.CANONICAL));
nonCompacting = ImmutableSet.copyOf(view.getUncompacting(allSSTables));
} while (null == (txn = cfStore.getTracker().tryModify(nonCompacting, OperationType.UNKNOWN)));
allNonCompacting.put(cfStore.metadata.id, txn);
allCompacting.addAll(Sets.difference(allSSTables, nonCompacting));
}
}
return Pair.create(allCompacting, allNonCompacting);
}
Aggregations