{"record":{"id":"b83c76266647d214","repo":"apache/cassandra","slug":"compressed-read-ahead-buffer-size-in-kb-must-be-at","errorCode":null,"errorMessage":"compressed_read_ahead_buffer_size_in_kb must be at least 256KiB (set to 0 to disable)","messagePattern":"compressed_read_ahead_buffer_size_in_kb must be at least 256KiB \\(set to 0 to disable\\)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/config/DatabaseDescriptor.java","lineNumber":3106,"sourceCode":"    public static void setConcurrentViewBuilders(int value)\n    {\n        conf.concurrent_materialized_view_builders = value;\n    }\n\n    public static int getCompressedReadAheadBufferSize()\n    {\n        return conf.compressed_read_ahead_buffer_size.toBytes();\n    }\n\n    public static int getCompressedReadAheadBufferSizeInKB()\n    {\n        return conf.compressed_read_ahead_buffer_size.toKibibytes();\n    }\n\n    public static void setCompressedReadAheadBufferSizeInKb(int sizeInKb)\n    {\n        if (sizeInKb < 0 || (sizeInKb > 0 && sizeInKb < 256))\n            throw new IllegalArgumentException(\"compressed_read_ahead_buffer_size_in_kb must be at least 256KiB (set to 0 to disable)\");\n\n        conf.compressed_read_ahead_buffer_size = createIntKibibyteBoundAndEnsureItIsValidForByteConversion(sizeInKb, \"compressed_read_ahead_buffer_size\");\n    }\n\n    public static long getMinFreeSpacePerDriveInMebibytes()\n    {\n        return conf.min_free_space_per_drive.toMebibytes();\n    }\n\n    public static long getMinFreeSpacePerDriveInBytes()\n    {\n        return conf.min_free_space_per_drive.toBytesInLong();\n    }\n\n    @VisibleForTesting\n    public static long setMinFreeSpacePerDriveInMebibytes(long mebiBytes)\n    {\n        conf.min_free_space_per_drive = new DataStorageSpec.IntMebibytesBound(mebiBytes);","sourceCodeStart":3088,"sourceCodeEnd":3124,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/config/DatabaseDescriptor.java#L3088-L3124","documentation":"setCompressedReadAheadBufferSizeInKb enforces that the compressed read-ahead buffer is either 0 (feature disabled) or at least 256 KiB. Values in (0, 256) are rejected with IllegalArgumentException because sub-256KiB buffers are not meaningful for the compression read-ahead path.","triggerScenarios":"Calling DatabaseDescriptor.setCompressedReadAheadBufferSizeInKb(sizeInKb) with sizeInKb < 0, or with 1..255 (e.g. 128).","commonSituations":"Operators tuning compressed read-ahead with a too-small value assuming KiB was bytes or that any positive value is legal; automation deriving a small percentage-based buffer; typo'd yaml values.","solutions":["Use 0 to disable read-ahead, or a value >= 256 KiB.","Clamp: if (sizeInKb > 0 && sizeInKb < 256) sizeInKb = 256;","Fix the source calculation producing the small/negative value."],"exampleFix":"// before\nDatabaseDescriptor.setCompressedReadAheadBufferSizeInKb(128); // rejected\n// after\nDatabaseDescriptor.setCompressedReadAheadBufferSizeInKb(256); // minimum allowed, or 0 to disable","handlingStrategy":"validation","validationCode":"if (sizeInKb == 0 || sizeInKb >= 256) DatabaseDescriptor.setCompressedReadAheadBufferSizeInKb(sizeInKb); else sizeInKb = sizeInKb > 0 ? 256 : 0;","typeGuard":"boolean isValidReadAheadKb(int v) { return v == 0 || v >= 256; }","tryCatchPattern":"try { DatabaseDescriptor.setCompressedReadAheadBufferSizeInKb(v); } catch (IllegalArgumentException e) { log.warn(\"read-ahead must be 0 or >=256KiB, got {}\", v); }","preventionTips":["Remember the legal domain is {0} ∪ [256, ∞)","Use 0 explicitly to disable the feature","Check unit assumptions (the setter takes KiB)"],"tags":["configuration","compression","validation"],"backgroundTag":"invalid-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"}