apache/cassandra · error · java.lang.RuntimeException

Error occurred during enabling auto-compaction

Error message

Error occurred during enabling auto-compaction

What it means

UpgradeSSTable (nodetool upgradesstables / --include-all-sstables flow) re-enables auto-compaction for the selected tables after the upgrade pass. If any exception escapes that re-enable step (after the bounded CASSANDRA-18635 retry spin), it is wrapped in a RuntimeException with this message and the original cause attached. The upgrade itself may have partially completed; the failure is in restoring auto-compaction.

Solutions

  1. Inspect the wrapped cause ('Caused by') to find the root failure.
  2. Re-run `nodetool enableautocompaction <ks> <table>` manually to restore compaction.
  3. Verify with `nodetool getcompactionthroughput`/status that the table is not left in a bad state, then re-run upgradesstables.
  4. Retry during lower load; ensure the table was not dropped concurrently.
Defensive patterns

Strategy: try-catch

Validate before calling

// before running, ensure no concurrent schema changes and compaction state is queryable
runNodetool("compactionstats"); // confirms JMX and compaction manager are responsive

Try / catch

try { runNodetool("upgradesstables"); }
catch (RuntimeException e) {
  if (e.getMessage() != null && e.getMessage().contains("Error occurred during enabling auto-compaction")) {
    runNodetool("enableautocompaction", keyspace, table); // restore state, log root cause e.getCause()
  } else throw e;
}

Prevention

When it happens

Trigger: Exception thrown by compactionManager.enableAutoCompaction for a table (e.g. JMX/remote error, table dropped mid-operation, interrupted compaction exhausting 4 retries).

Common situations: Running upgradesstables during a schema change/drop; node under heavy load with concurrent operations; intermittent JMX connection problems; CASSANDRA-18635 interrupted-compaction retries exhausted.

Related errors


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

Appendix: source

Thrown at src/java/org/apache/cassandra/tools/nodetool/UpgradeSSTable.java:91

        {
            for (int retries = 0; retries < 5; retries++)
            {
                try
                {
                    if (retries > 0)
                        Thread.sleep(500);
                    probe.upgradeSSTables(probe.output().out, keyspace, !includeAll, maxSSTableTimestamp, jobs, tableNames);
                    break;
                }
                catch (RuntimeException cie)
                {
                    // Spin retry. See CASSANDRA-18635
                    if (ExceptionUtils.indexOfThrowable(cie, CompactionInterruptedException.class) != -1 && retries == 4)
                        throw (cie);
                }
                catch (Exception e)
                {
                    throw new RuntimeException("Error occurred during enabling auto-compaction", e);
                }
            }
        }
    }
}

View on GitHub (pinned to 88fd0f6a0e)