src/java/org/apache/cassandra/db/Table.java
/**
     * Do a cleanup of keys that do not belong locally.
     */
Do a cleanup of keys that do not belong locally.
Do a cleanup of keys that do not belong locally .
public void forceCleanup(NodeId.OneShotRenewer renewer) throws IOException, ExecutionException, InterruptedException
    {
        if (name.equals(SYSTEM_TABLE))
            throw new UnsupportedOperationException("Cleanup of the system table is neither necessary nor wise");
        List<ColumnFamilyStore> sortedColumnFamilies = new ArrayList<ColumnFamilyStore>(columnFamilyStores.values());
        Collections.sort(sortedColumnFamilies, new Comparator<ColumnFamilyStore>()
        {
            @Override
            public int compare(ColumnFamilyStore cf1, ColumnFamilyStore cf2)
            {
                long diff = (cf1.getTotalDiskSpaceUsed() - cf2.getTotalDiskSpaceUsed());
                if (diff > 0)
                    return 1;
                if (diff < 0)
                    return -1;
                return cf1.columnFamily.compareTo(cf2.columnFamily);
            }
        });
        for (ColumnFamilyStore cfs : sortedColumnFamilies)
            cfs.forceCleanup(renewer);
    }
public void forceCleanup ( NodeId . OneShotRenewer renewer ) throws IOException , ExecutionException , InterruptedException { if ( name . equals ( SYSTEM_TABLE ) ) throw new UnsupportedOperationException ( "Cleanup of the system table is neither necessary nor wise" ) ; List < ColumnFamilyStore > sortedColumnFamilies = new ArrayList < ColumnFamilyStore > ( columnFamilyStores . values ( ) ) ; Collections . sort ( sortedColumnFamilies , new Comparator < ColumnFamilyStore > ( ) { @ Override public int compare ( ColumnFamilyStore cf1 , ColumnFamilyStore cf2 ) { long diff = ( cf1 . getTotalDiskSpaceUsed ( ) - cf2 . getTotalDiskSpaceUsed ( ) ) ; if ( diff > 0 ) return 1 ; if ( diff < 0 ) return - 1 ; return cf1 . columnFamily . compareTo ( cf2 . columnFamily ) ; } } ) ; for ( ColumnFamilyStore cfs : sortedColumnFamilies ) cfs . forceCleanup ( renewer ) ; }
Do a cleanup of keys that do not belong locally.
Do a cleanup of keys that do not belong locally .
// Sort the column families in order of SSTable size, so cleanup of smaller CFs // can free up space for larger ones // Compare first on size and, if equal, sort by name (arbitrary & deterministic). // Cleanup in sorted order to free up space for the larger ones