{"record":{"id":"34f18cc706e25933","repo":"apache/cassandra","slug":"commitlog-segment-size-must-be-smaller-than-2048","errorCode":null,"errorMessage":"commitlog_segment_size must be smaller than 2048, but was <value>","messagePattern":"commitlog_segment_size must be smaller than 2048, but was <value>","errorType":"validation","errorClass":"ConfigurationException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/config/DatabaseDescriptor.java","lineNumber":1126,"sourceCode":"\n        if (conf.user_defined_functions_fail_timeout.toMilliseconds() < conf.user_defined_functions_warn_timeout.toMilliseconds())\n            throw new ConfigurationException(\"user_defined_functions_warn_timeout must less than user_defined_function_fail_timeout\", false);\n\n        if (!conf.allow_insecure_udfs && !conf.user_defined_functions_threads_enabled)\n            throw new ConfigurationException(\"To be able to set enable_user_defined_functions_threads: false you need to set allow_insecure_udfs: true - this is an unsafe configuration and is not recommended.\");\n\n        if (conf.allow_extra_insecure_udfs)\n            logger.warn(\"Allowing java.lang.System.* access in UDFs is dangerous and not recommended. Set allow_extra_insecure_udfs: false to disable.\");\n\n        if (conf.scripted_user_defined_functions_enabled)\n            throw new ConfigurationException(\"JavaScript user-defined functions were removed in CASSANDRA-18252. \" +\n                                             \"Hooks are planned to be introduced as part of CASSANDRA-17280\");\n\n        if (conf.commitlog_segment_size.toMebibytes() == 0)\n            throw new ConfigurationException(\"commitlog_segment_size must be positive, but was \"\n                                             + conf.commitlog_segment_size.toString(), false);\n        else if (conf.commitlog_segment_size.toMebibytes() >= 2048)\n            throw new ConfigurationException(\"commitlog_segment_size must be smaller than 2048, but was \"\n                                             + conf.commitlog_segment_size.toString(), false);\n\n        if (conf.max_mutation_size == null)\n            conf.max_mutation_size = new DataStorageSpec.IntKibibytesBound(conf.commitlog_segment_size.toKibibytes() / 2);\n        else if (conf.commitlog_segment_size.toKibibytes() < 2 * conf.max_mutation_size.toKibibytes())\n            throw new ConfigurationException(\"commitlog_segment_size must be at least twice the size of max_mutation_size / 1024\", false);\n\n        if (conf.native_transport_max_message_size == null)\n        {\n            conf.native_transport_max_message_size = new DataStorageSpec.LongBytesBound(calculateDefaultNativeTransportMaxMessageSizeInBytes());\n        }\n        else\n        {\n            nativeTransportMaxMessageSizeConfiguredExplicitly = true;\n            long maxCqlMessageSize = conf.native_transport_max_message_size.toBytes();\n            if (maxCqlMessageSize > conf.native_transport_max_request_data_in_flight.toBytes())\n                throw new ConfigurationException(\"native_transport_max_message_size must not exceed native_transport_max_request_data_in_flight\", false);\n","sourceCodeStart":1108,"sourceCodeEnd":1144,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/config/DatabaseDescriptor.java#L1108-L1144","documentation":"Thrown when commitlog_segment_size is 2048 MiB or larger. Cassandra caps the segment size below 2 GiB to keep segments addressable with 32-bit offsets and bounded recovery replay; oversized values are rejected at startup.","triggerScenarios":"cassandra.yaml sets commitlog_segment_size >= 2048MiB, e.g. 'commitlog_segment_size: 4096MiB'.","commonSituations":"Operators on high-throughput clusters inflating segment size to reduce rotation; confusion with max_mutation_size sizing rules.","solutions":["Lower commitlog_segment_size below 2048MiB (e.g. 1024MiB).","If you need larger buffering, tune commitlog_sync settings instead of segment size.","Restart the node."],"exampleFix":"# before\ncommitlog_segment_size: 4096MiB\n# after\ncommitlog_segment_size: 1024MiB","handlingStrategy":"validation","validationCode":"Long mib = parseMebibytes(yaml.get(\"commitlog_segment_size\"));\nif (mib != null && mib >= 2048)\n    throw new IllegalArgumentException(\"commitlog_segment_size must be < 2048MiB\");","typeGuard":"boolean isValidSegmentSize(Object v) {\n    return v == null || (v instanceof Number && ((Number) v).longValue() < 2048);\n}","tryCatchPattern":"try {\n    DatabaseDescriptor.applySimpleConfig();\n} catch (ConfigurationException e) {\n    if (e.getMessage().contains(\"commitlog_segment_size must be smaller than 2048\"))\n        logger.error(\"Lower commitlog_segment_size below 2048MiB\");\n}","preventionTips":["Cap segment size at 1-2 GiB in config generators","Use commitlog tuning (sync period, max window) rather than giant segments","Range-check the value in pre-deploy linting"],"tags":["config","commitlog"],"backgroundTag":"value-out-of-range","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"}