{"record":{"id":"bb36e5e6ecfb8095","repo":"apache/cassandra","slug":"the-warn-threshold-s-for-s-warn-threshold-should","errorCode":null,"errorMessage":"The warn threshold %s for %s_warn_threshold should be lower than the fail threshold %s","messagePattern":"The warn threshold (.+?) for (.+?)_warn_threshold should be lower than the fail threshold (.+?)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/config/GuardrailsOptions.java","lineNumber":1616,"sourceCode":"    }\n\n    /**\n     * A {@code null} size disables a size threshold, and a size of zero bytes is a valid threshold meaning \"any\n     * value above zero bytes triggers the guardrail\", so the only thing left to check is the relative order of the\n     * two thresholds. {@link DataStorageSpec} already rejects negative sizes when parsing.\n     */\n    private static void validateSizeThreshold(DataStorageSpec.LongBytesBound warn, DataStorageSpec.LongBytesBound fail, String name)\n    {\n        validateWarnLowerThanFail(warn, fail, name);\n    }\n\n    private static void validateWarnLowerThanFail(DataStorageSpec.LongBytesBound warn, DataStorageSpec.LongBytesBound fail, String name)\n    {\n        if (warn == null || fail == null)\n            return;\n\n        if (fail.toBytes() < warn.toBytes())\n            throw new IllegalArgumentException(format(\"The warn threshold %s for %s_warn_threshold should be lower \" +\n                                                      \"than the fail threshold %s\", warn, name, fail));\n    }\n\n    private static Set<String> validateTableProperties(Set<String> properties, String name)\n    {\n        if (properties == null)\n            throw new IllegalArgumentException(format(\"Invalid value for %s: null is not allowed\", name));\n\n        Set<String> lowerCaseProperties = properties.stream().map(String::toLowerCase).collect(toSet());\n\n        Set<String> diff = Sets.difference(lowerCaseProperties, TableAttributes.allKeywords());\n\n        if (!diff.isEmpty())\n            throw new IllegalArgumentException(invalidValueMessage(name, diff, \"table\"));\n\n        return lowerCaseProperties;\n    }\n","sourceCodeStart":1598,"sourceCodeEnd":1634,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/config/GuardrailsOptions.java#L1598-L1634","documentation":"Byte-based 'max-style' guardrail thresholds (DataStorageSpec.LongBytesBound) must satisfy warn <= fail. The DataStorageSpec overload of validateWarnLowerThanFail() compares toBytes() and throws IllegalArgumentException when the fail bound is smaller than the warn bound; null on either side means disabled and skips the check.","triggerScenarios":"Setting byte-sized guardrail pairs (e.g. table/partition size thresholds expressed with units like 10MiB) such that the fail bound parses to fewer bytes than the warn bound, e.g. warn 1GiB vs fail 500MiB, in cassandra.yaml or via live update.","commonSituations":"Unit confusion across mixed units (1GiB warn vs 1000MiB fail where fail ends up larger/smaller than intended); copy-paste swaps of warn/fail values; typos in unit suffixes (MiB vs GiB).","solutions":["Normalize both thresholds to the same unit and ensure warn <= fail in bytes.","Set one bound to null (comment it out / omit) to disable that side.","Double-check unit suffixes (KiB/MiB/GiB) in cassandra.yaml values."],"exampleFix":"// before\nguardrail_warn_threshold: 1GiB\nguardrail_fail_threshold: 500MiB\n// after\nguardrail_warn_threshold: 500MiB\nguardrail_fail_threshold: 1GiB","handlingStrategy":"validation","validationCode":"if (warn != null && fail != null && fail.toBytes() < warn.toBytes())\n    throw new IllegalArgumentException(\"byte-bound warn \" + warn + \" must be <= fail \" + fail);\n// normalize units first: warn.toBytes() vs fail.toBytes()","typeGuard":null,"tryCatchPattern":"try { validateSizeThresholds(warnBound, failBound); } catch (IllegalArgumentException e) { log.error(\"Size guardrail thresholds invalid: {}\", e.getMessage()); throw e; }","preventionTips":["Write both thresholds in the same unit (e.g. both MiB) to avoid conversion surprises.","Compare in bytes, not in the raw strings.","Watch unit suffix typos (MiB vs GiB) in cassandra.yaml."],"tags":["config","guardrails","thresholds","cassandra"],"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-14T16:17:12.679Z"}