apache/cassandra · error · ConfigurationException

Disabling compaction by setting compaction thresholds to 0 h

Error message

Disabling compaction by setting compaction thresholds to 0 has been removed, set the compaction option 'enabled' to false instead.

What it means

Older Cassandra versions allowed disabling compaction by setting min/max compaction thresholds to 0. This behavior was removed; validate() now rejects any threshold <= 0 and directs users to the 'enabled' compaction option.

Source

Thrown at src/java/org/apache/cassandra/schema/CompactionParams.java:248

        String minThreshold = options.get(Option.MIN_THRESHOLD.toString());
        if (minThreshold != null && !StringUtils.isNumeric(minThreshold))
        {
            throw new ConfigurationException(format("Invalid value %s for '%s' compaction sub-option - must be an integer",
                                                    minThreshold,
                                                    Option.MIN_THRESHOLD));
        }

        String maxThreshold = options.get(Option.MAX_THRESHOLD.toString());
        if (maxThreshold != null && !StringUtils.isNumeric(maxThreshold))
        {
            throw new ConfigurationException(format("Invalid value %s for '%s' compaction sub-option - must be an integer",
                                                    maxThreshold,
                                                    Option.MAX_THRESHOLD));
        }

        if (minCompactionThreshold() <= 0 || maxCompactionThreshold() <= 0)
        {
            throw new ConfigurationException("Disabling compaction by setting compaction thresholds to 0 has been removed,"
                                             + " set the compaction option 'enabled' to false instead.");
        }

        if (minCompactionThreshold() <= 1)
        {
            throw new ConfigurationException(format("Min compaction threshold cannot be less than 2 (got %d)",
                                                    minCompactionThreshold()));
        }

        if (minCompactionThreshold() > maxCompactionThreshold())
        {
            throw new ConfigurationException(format("Min compaction threshold (got %d) cannot be greater than max compaction threshold (got %d)",
                                                    minCompactionThreshold(),
                                                    maxCompactionThreshold()));
        }
    }

    double defaultBloomFilterFbChance()

View on GitHub (pinned to 88fd0f6a0e)

Solutions

  1. Use compaction = {'class': '...', 'enabled': 'false'} to disable compaction instead of thresholds of 0
  2. Set both thresholds to valid positive integers (min >= 2, max >= min)
  3. Update migration/ops scripts written for legacy Cassandra versions

Example fix

// before
compaction = {'class': 'SizeTieredCompactionStrategy', 'min_threshold': '0', 'max_threshold': '0'}
// after
compaction = {'class': 'SizeTieredCompactionStrategy', 'enabled': 'false'}
Defensive patterns

Strategy: validation

Validate before calling

int min = Integer.parseInt(opts.getOrDefault("min_threshold", "4"));
int max = Integer.parseInt(opts.getOrDefault("max_threshold", "32"));
if (min <= 0 || max <= 0 && opts.containsKey("enabled") == false)
    throw new IllegalArgumentException("Use 'enabled':'false' to disable compaction, not 0 thresholds");

Try / catch

try { schemaChange(ddl); } catch (ConfigurationException e) { if (e.getMessage().contains("Disabling compaction")) { /* switch to enabled:false */ } throw e; }

Prevention

When it happens

Trigger: CREATE TABLE/ALTER TABLE with compaction thresholds set to 0 (e.g. {'min_threshold': '0', 'max_threshold': '0'}); migrating schemas from pre-3.x versions that relied on threshold-0 to disable compaction.

Common situations: Upgrading old clusters where disabling compaction via thresholds was a common workaround; ported ops scripts or documentation that predate the 'enabled' option.

Related errors


AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10). Data as JSON: /api/errors/baff444246111e9c. Report an issue: GitHub.