Skip to content

Commit

Permalink
Revert “Alternate method of ensuring no compacted SSTables left at st…
Browse files Browse the repository at this point in the history
…artup”
  • Loading branch information
wi11dey committed Sep 2, 2024
1 parent 56c007d commit 5134360
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions src/java/org/apache/cassandra/service/CassandraDaemon.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@
import com.codahale.metrics.jvm.GarbageCollectorMetricSet;
import com.codahale.metrics.jvm.MemoryUsageGaugeSet;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.collect.ImmutableMap;
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.Uninterruptibles;
Expand Down Expand Up @@ -260,21 +259,27 @@ private void completeSetupMayThrowSstableException() {
// load schema from disk
Schema.instance.loadFromDisk();

// clean up compaction leftovers
Map<Pair<String, String>, Map<Integer, UUID>> unfinishedCompactions = SystemKeyspace.getUnfinishedCompactions();
for (Pair<String, String> kscf : unfinishedCompactions.keySet())
{
CFMetaData cfm = Schema.instance.getCFMetaData(kscf.left, kscf.right);
// CFMetaData can be null if CF is already dropped
if (cfm != null)
ColumnFamilyStore.removeUnfinishedCompactionLeftovers(cfm, unfinishedCompactions.get(kscf));
}
SystemKeyspace.discardCompactionsInProgress();

// clean up debris in the rest of the keyspaces
for (String keyspaceName : Schema.instance.getKeyspaces())
{
// Skip system as we'll already clean it after the other tables
// Skip system as we've already cleaned it
if (keyspaceName.equals(SystemKeyspace.NAME))
continue;

for (CFMetaData cfm : Schema.instance.getKeyspaceMetaData(keyspaceName).values())
{
ColumnFamilyStore.removeUnfinishedCompactionLeftovers(cfm, unfinishedCompactions.getOrDefault(cfm.ksAndCFName, ImmutableMap.of()));
ColumnFamilyStore.scrubDataDirectories(cfm);
}
}
SystemKeyspace.discardCompactionsInProgress();

Keyspace.setInitialized();

Expand Down

0 comments on commit 5134360

Please sign in to comment.