{"record":{"id":"baff444246111e9c","repo":"apache/cassandra","slug":"disabling-compaction-by-setting-compaction-thresho","errorCode":null,"errorMessage":"Disabling compaction by setting compaction thresholds to 0 has been removed, set the compaction option 'enabled' to false instead.","messagePattern":"Disabling compaction by setting compaction thresholds to 0 has been removed, set the compaction option 'enabled' to false instead\\.","errorType":"validation","errorClass":"ConfigurationException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/schema/CompactionParams.java","lineNumber":248,"sourceCode":"        String minThreshold = options.get(Option.MIN_THRESHOLD.toString());\n        if (minThreshold != null && !StringUtils.isNumeric(minThreshold))\n        {\n            throw new ConfigurationException(format(\"Invalid value %s for '%s' compaction sub-option - must be an integer\",\n                                                    minThreshold,\n                                                    Option.MIN_THRESHOLD));\n        }\n\n        String maxThreshold = options.get(Option.MAX_THRESHOLD.toString());\n        if (maxThreshold != null && !StringUtils.isNumeric(maxThreshold))\n        {\n            throw new ConfigurationException(format(\"Invalid value %s for '%s' compaction sub-option - must be an integer\",\n                                                    maxThreshold,\n                                                    Option.MAX_THRESHOLD));\n        }\n\n        if (minCompactionThreshold() <= 0 || maxCompactionThreshold() <= 0)\n        {\n            throw new ConfigurationException(\"Disabling compaction by setting compaction thresholds to 0 has been removed,\"\n                                             + \" set the compaction option 'enabled' to false instead.\");\n        }\n\n        if (minCompactionThreshold() <= 1)\n        {\n            throw new ConfigurationException(format(\"Min compaction threshold cannot be less than 2 (got %d)\",\n                                                    minCompactionThreshold()));\n        }\n\n        if (minCompactionThreshold() > maxCompactionThreshold())\n        {\n            throw new ConfigurationException(format(\"Min compaction threshold (got %d) cannot be greater than max compaction threshold (got %d)\",\n                                                    minCompactionThreshold(),\n                                                    maxCompactionThreshold()));\n        }\n    }\n\n    double defaultBloomFilterFbChance()","sourceCodeStart":230,"sourceCodeEnd":266,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/schema/CompactionParams.java#L230-L266","documentation":"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.","triggerScenarios":"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.","commonSituations":"Upgrading old clusters where disabling compaction via thresholds was a common workaround; ported ops scripts or documentation that predate the 'enabled' option.","solutions":["Use compaction = {'class': '...', 'enabled': 'false'} to disable compaction instead of thresholds of 0","Set both thresholds to valid positive integers (min >= 2, max >= min)","Update migration/ops scripts written for legacy Cassandra versions"],"exampleFix":"// before\ncompaction = {'class': 'SizeTieredCompactionStrategy', 'min_threshold': '0', 'max_threshold': '0'}\n// after\ncompaction = {'class': 'SizeTieredCompactionStrategy', 'enabled': 'false'}","handlingStrategy":"validation","validationCode":"int min = Integer.parseInt(opts.getOrDefault(\"min_threshold\", \"4\"));\nint max = Integer.parseInt(opts.getOrDefault(\"max_threshold\", \"32\"));\nif (min <= 0 || max <= 0 && opts.containsKey(\"enabled\") == false)\n    throw new IllegalArgumentException(\"Use 'enabled':'false' to disable compaction, not 0 thresholds\");","typeGuard":null,"tryCatchPattern":"try { schemaChange(ddl); } catch (ConfigurationException e) { if (e.getMessage().contains(\"Disabling compaction\")) { /* switch to enabled:false */ } throw e; }","preventionTips":["Never set thresholds to 0; use the 'enabled' option to disable compaction","Audit legacy schemas/scripts from pre-3.x Cassandra for threshold-0 usage","Document the enabled:false replacement in team runbooks"],"tags":["cassandra","configuration","compaction","deprecated"],"backgroundTag":"unsupported-config-value","analyzedSha":"88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1","analyzedAt":"2026-09-10T07:29:22.284Z","contentChangedAt":"2026-09-10T07:29:22.284Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}