Search code examples
cassandraamazon-ami

Cassandra - Unable to find compaction strategy class 'org.apache.cassandra.db.compaction.DateTieredCompactionStrategy '


When trying to change compaction strategy to DTCS, invoking:

ALTER TABLE sp.table WITH compaction = {
    'class' :  'DateTieredCompactionStrategy ',
    'base_time_seconds':'3600',
    'max_sstable_age_days':'7'
};

Ends up with:

ConfigurationException: <ErrorMessage code=2300 [Query invalid because of configuration issue] message="Unable to find compaction strategy class 'org.apache.cassandra.db.compaction.DateTieredCompactionStrategy '">

My environment:

  • cqlsh 5.0.1 | Cassandra 2.2.3 | CQL spec 3.3.1 | Native protocol v4
  • default configuration from Amazon DataStax Auto-Clustering AMI 2.6.3-1404-pv

Solution

  • It looks like you have a space at the end of the compaction strategy string. Try:

    ALTER TABLE sp.table WITH compaction = {
        'class' :  'DateTieredCompactionStrategy',
        'base_time_seconds':'3600',
        'max_sstable_age_days':'7'
    };