Source:
public void forceUserDefinedCleanup(String dataFiles) { String[] filenames = dataFiles.split(","); HashMap<ColumnFamilyStore, Descriptor> descriptors = Maps.newHashMap(); for (String filename : filenames) { Descriptor desc = Descriptor.fromFilename(filename.trim()); if (Schema.instance.getTableMetadataRef(desc) == null) { logger.warn("Schema does not exist for file {}. Skipping.", filename); continue; } ColumnFamilyStore cfs = Keyspace.open(desc.ksname).getColumnFamilyStore(desc.cfname); desc = cfs.getDirectories().find(new File(filename.trim()).getName()); if (desc != null) descriptors.put(cfs, desc); } if (!StorageService.instance.isJoined()) { logger.error("Cleanup cannot run before a node has joined the ring"); return; } for (Map.Entry<ColumnFamilyStore,Descriptor> entry : descriptors.entrySet()) { ColumnFamilyStore cfs = entry.getKey(); Keyspace keyspace = cfs.keyspace; Collection<Range<Token>> ranges = StorageService.instance.getLocalReplicas(keyspace.getName()).asRangeSet(); boolean hasIndexes = cfs.indexManager.hasIndexes(); SSTableReader sstable = lookupSSTable(cfs, entry.getValue()); if (sstable == null) { logger.warn("Will not clean {}, it is not an active sstable", entry.getValue()); } else { CleanupStrategy cleanupStrategy = CleanupStrategy.get(cfs, ranges, FBUtilities.nowInSeconds()); try (LifecycleTransaction txn = cfs.getTracker().tryModify(sstable, OperationType.CLEANUP)) { doCleanupOne(cfs, txn, cleanupStrategy, ranges, hasIndexes); } catch (IOException e) { logger.error("forceUserDefinedCleanup failed: {}", e.getLocalizedMessage()); } } } }

Target:
public void forceUserDefinedCleanup(String dataFiles) { String[] filenames = dataFiles.split(","); HashMap<ColumnFamilyStore, Descriptor> descriptors = Maps.newHashMap(); for (String filename : filenames) { Descriptor desc = Descriptor.fromFilename(filename.trim()); if (Schema.instance.getTableMetadataRef(desc) == null) { logger.warn("Schema does not exist for file {}. Skipping.", filename); continue; } ColumnFamilyStore cfs = Keyspace.open(desc.ksname).getColumnFamilyStore(desc.cfname); desc = cfs.getDirectories().find(new File(filename.trim()).getName()); if (desc != null) descriptors.put(cfs, desc); } if (!StorageService.instance.isJoined()) { logger.error("Cleanup cannot run before a node has joined the ring"); return; } for (Map.Entry<ColumnFamilyStore,Descriptor> entry : descriptors.entrySet()) { ColumnFamilyStore cfs = entry.getKey(); Keyspace keyspace = cfs.keyspace; Collection<Range<Token>> ranges = StorageService.instance.getLocalReplicas(keyspace.getName()).asUnmodifiableRangeCollection(); boolean hasIndexes = cfs.indexManager.hasIndexes(); SSTableReader sstable = lookupSSTable(cfs, entry.getValue()); if (sstable == null) { logger.warn("Will not clean {}, it is not an active sstable", entry.getValue()); } else { CleanupStrategy cleanupStrategy = CleanupStrategy.get(cfs, ranges, FBUtilities.nowInSeconds()); try (LifecycleTransaction txn = cfs.getTracker().tryModify(sstable, OperationType.CLEANUP)) { doCleanupOne(cfs, txn, cleanupStrategy, ranges, hasIndexes); } catch (IOException e) { logger.error("forceUserDefinedCleanup failed: {}", e.getLocalizedMessage()); } } } }