{"record":{"id":"731d68a7909def13","repo":"apache/cassandra","slug":"if-the-s-option-is-set-to-false-no-other-option","errorCode":null,"errorMessage":"If the '%s' option is set to false no other options must be specified","messagePattern":"If the '(.+?)' option is set to false no other options must be specified","errorType":"validation","errorClass":"ConfigurationException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/schema/CompressionParams.java","lineNumber":98,"sourceCode":"                                                                       Collections.emptyMap());\n\n    private final ICompressor sstableCompressor;\n    private final int chunkLength;\n    private final int maxCompressedLength;  // In content we store max length to avoid rounding errors causing compress/decompress mismatch.\n    private final double minCompressRatio;  // In configuration we store min ratio, the input parameter.\n    private final ImmutableMap<String, String> otherOptions; // Unrecognized options, can be used by the compressor\n\n    public static CompressionParams fromMap(Map<String, String> opts)\n    {\n        Map<String, String> options = copyOptions(opts);\n\n        String sstableCompressionClass;\n\n        if (!opts.isEmpty() && isEnabled(opts) && !options.containsKey(CLASS))\n            throw new ConfigurationException(format(\"Missing sub-option '%s' for the 'compression' option.\", CLASS));\n\n        if (!removeEnabled(options) && !options.isEmpty())\n            throw new ConfigurationException(format(\"If the '%s' option is set to false no other options must be specified\", ENABLED));\n        else\n            sstableCompressionClass = removeSSTableCompressionClass(options);\n\n        int chunkLength = removeChunkLength(options);\n        double minCompressRatio = removeMinCompressRatio(options);\n\n        CompressionParams cp = new CompressionParams(sstableCompressionClass, options, chunkLength, minCompressRatio);\n        cp.validate();\n\n        return cp;\n    }\n\n    public Class<? extends ICompressor> klass()\n    {\n        return sstableCompressor.getClass();\n    }\n\n    public static CompressionParams noCompression()","sourceCodeStart":80,"sourceCodeEnd":116,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/schema/CompressionParams.java#L80-L116","documentation":"When compression is disabled via {'enabled': 'false'}, no other compression options may accompany it. CompressionParams.fromMap throws ConfigurationException if additional sub-options are present alongside enabled=false, because they would be silently meaningless.","triggerScenarios":"compression = {'enabled': 'false', 'chunk_length_in_kb': '16'} in CREATE/ALTER TABLE; programmatic maps where enablement is toggled but leftover tuning options remain.","commonSituations":"Scripts that flip enabled to false while keeping previous options; copying a disabled-compression template that still lists stale options.","solutions":["Remove all other keys, leaving compression = {'enabled': 'false'}","Re-enable compression instead if the options are still wanted","Scrub the option map of stale keys when toggling enabled"],"exampleFix":"// before\ncompression = {'enabled': 'false', 'class': 'LZ4Compressor', 'chunk_length_in_kb': '16'}\n// after\ncompression = {'enabled': 'false'}","handlingStrategy":"validation","validationCode":"if (\"false\".equalsIgnoreCase(opts.get(\"enabled\")) && opts.size() > 1)\n    throw new IllegalArgumentException(\"No other compression options allowed with enabled:false\");","typeGuard":null,"tryCatchPattern":"try { compressionParams = CompressionParams.fromMap(opts); } catch (ConfigurationException e) { if (e.getMessage().contains(\"set to false\")) { /* strip extra options */ } throw e; }","preventionTips":["When toggling enabled:false, clear all other compression keys","Rebuild compression maps from scratch rather than mutating old ones","Add config-generation tests for both enabled and disabled compression"],"tags":["cassandra","schema","compression"],"backgroundTag":"conflicting-config-options","analyzedSha":"88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1","analyzedAt":"2026-09-10T07:29:22.284Z","contentChangedAt":"2026-09-10T07:29:22.284Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}