{"record":{"id":"fecbc3e80f83c94d","repo":"apache/cassandra","slug":"a-hints-file-cannot-be-configured-for-both-compres","errorCode":null,"errorMessage":"a hints file cannot be configured for both compression and encryption","messagePattern":"a hints file cannot be configured for both compression and encryption","errorType":"validation","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/hints/HintsDescriptor.java","lineNumber":112,"sourceCode":"    HintsDescriptor(UUID hostId, int version, long timestamp, ImmutableMap<String, Object> parameters)\n    {\n        this.hostId = hostId;\n        this.version = version;\n        this.timestamp = timestamp;\n        hintsFileName = hostId + \"-\" + timestamp + '-' + version + \".hints\";\n        crc32FileName = hostId + \"-\" + timestamp + '-' + version + \".crc32\";\n        compressionConfig = createCompressionConfig(parameters);\n\n        EncryptionData encryption = createEncryption(parameters);\n        if (encryption == null)\n        {\n            cipher = null;\n            compressor = null;\n        }\n        else\n        {\n            if (compressionConfig != null)\n                throw new IllegalStateException(\"a hints file cannot be configured for both compression and encryption\");\n            cipher = encryption.cipher;\n            compressor = encryption.compressor;\n            parameters = encryption.params;\n        }\n\n        this.parameters = parameters;\n    }\n\n    HintsDescriptor(UUID hostId, long timestamp, ImmutableMap<String, Object> parameters)\n    {\n        this(hostId, CURRENT_VERSION, timestamp, parameters);\n    }\n\n    HintsDescriptor(UUID hostId, long timestamp)\n    {\n        this(hostId, CURRENT_VERSION, timestamp, ImmutableMap.<String, Object>of());\n    }\n","sourceCodeStart":94,"sourceCodeEnd":130,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/hints/HintsDescriptor.java#L94-L130","documentation":"HintsDescriptor's constructor throws IllegalStateException when an encryption config is present but a compression config is also present. A hints file may be either compressed or encrypted (or plain), not both; the two options are mutually exclusive in the descriptor's parameter space.","triggerScenarios":"Deserializing/constructing a HintsDescriptor from a file name+parameters map (or programmatically) where both 'compression' and 'encryption' parameter entries exist — e.g. hints written by a config that had compression, then encryption was added on top without removing compression settings in cassandra.yaml (hints_compression plus encryption options).","commonSituations":"Config merge accidents where hints_compression was never removed after enabling hint encryption (企业 encryption-at-rest rollout); upgrading versions where the old compression option lingers in cassandra.yaml; automated config tooling combining both settings.","solutions":["Remove hints_compression from cassandra.yaml when hint encryption is enabled, then restart.","Delete or migrate the conflicting hints file (its descriptor parameters cannot be honored).","Keep either compression or encryption for hints, not both; encryption provides confidentiality, compression interplay is unsupported.","Audit config management templates to ensure the two options are never set together."],"exampleFix":"# before (cassandra.yaml)\nhints_compression:\n  - class_name: LZ4Compressor\n# plus encryption enabled\n# after\n# hints_compression removed; encryption-only hints config","handlingStrategy":"validation","validationCode":"# validate cassandra.yaml before startup: hints compression XOR encryption\nassert not (config.get('hints_compression') and encryption_enabled), \\\n    \"hints_compression and hint encryption are mutually exclusive\"","typeGuard":null,"tryCatchPattern":"try { HintsDescriptor.deserialize(input); } catch (IllegalStateException e) { logger.error(\"Hints config conflict: {}\", e.getMessage()); }","preventionTips":["When enabling encryption-at-rest for hints, remove hints_compression from cassandra.yaml.","Add config-lint checks in CI/CD that reject both options together.","After upgrading, diff cassandra.yaml against the new defaults and drop legacy options.","Document the XOR constraint in your config-management module."],"tags":["java","hints","configuration","encryption"],"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"}