Investigating compaction issues

If you notice an increase in the amount of data that Cassandra stores in SSTables, or if you receive error messages about failed compactions, check the time of the last successful compaction for selected SSTables.

Unsuccessful compaction might cause the disk that Cassandra uses to run out of free space.

  1. In the nodetool utility, run the nodetool compactionhistory command.
    Result: Nodetool returns a list of successfully completed compaction operations that is seven columns wide. The first three columns display the ID, keyspace name, and the table name of the compacted SSTable:
    Compaction History:
    id                                   keyspace_name columnfamily_name 
    7df0cad0-40f1-11ea-b458-8f3aac917931 system        sstable_activity  
    bd7e3b80-40e0-11ea-b458-8f3aac917931 system        size_estimates    
    589f9b30-40d8-11ea-b458-8f3aac917931 system        sstable_activity  
    9547ed50-40c7-11ea-b458-8f3aac917931 system        size_estimates    
    3352d860-40bf-11ea-b458-8f3aac917931 system        sstable_activity  
    6ff33b40-40ae-11ea-b458-8f3aac917931 system        size_estimates    
    0e0f8b70-40a6-11ea-b458-8f3aac917931 system        sstable_activity  
    The next four columns display the time of the compaction, the size of the SSTable before and after compaction, and the number of merged partitions.
    
    compacted_at            bytes_in bytes_out rows_merged
    2020-01-27T11:40:53.245 5465     1311      {1:12, 4:34}
    2020-01-27T09:40:58.424 1074759  266555    {4:9}
    2020-01-27T08:40:53.219 5389     1314      {1:8, 4:34}
    2020-01-27T06:40:53.541 1074527  266566    {4:9}
    2020-01-27T05:40:53.222 5463     1314      {1:12, 4:34}
    2020-01-27T03:40:53.492 1075043  266539    {4:9}
    
  2. In the compacted_at column, verify the last time a successful compaction was performed for the SSTables that experience an increase in data size, or are the subject of error messages.
  3. If the amount of time that elapsed from the last successful compaction for the selected SSTables is significantly higher than for other SSTables, investigate the source of the problem, for example, by performing other Cassandra troubleshooting procedures.
    For more information, see the Troubleshooting section of the Apache Cassandra documentation.