{"record":{"id":"e76a9b0141647c46","repo":"apache/cassandra","slug":"concurrent-counter-writes-must-be-at-least-2-but","errorCode":null,"errorMessage":"concurrent_counter_writes must be at least 2, but was ${conf.concurrent_counter_writes}","messagePattern":"concurrent_counter_writes must be at least 2, but was (.+?)","errorType":"validation","errorClass":"ConfigurationException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/config/DatabaseDescriptor.java","lineNumber":737,"sourceCode":"        /* phi convict threshold for FailureDetector */\n        if (conf.phi_convict_threshold < 5 || conf.phi_convict_threshold > 16)\n        {\n            throw new ConfigurationException(\"phi_convict_threshold must be between 5 and 16, but was \" + conf.phi_convict_threshold, false);\n        }\n\n        /* Thread per pool */\n        if (conf.concurrent_reads < 2)\n        {\n            throw new ConfigurationException(\"concurrent_reads must be at least 2, but was \" + conf.concurrent_reads, false);\n        }\n\n        if (conf.concurrent_writes < 2 && TEST_FAIL_MV_LOCKS_COUNT.getString(\"\").isEmpty())\n        {\n            throw new ConfigurationException(\"concurrent_writes must be at least 2, but was \" + conf.concurrent_writes, false);\n        }\n\n        if (conf.concurrent_counter_writes < 2)\n            throw new ConfigurationException(\"concurrent_counter_writes must be at least 2, but was \" + conf.concurrent_counter_writes, false);\n\n        if (conf.networking_cache_size == null)\n            conf.networking_cache_size = new DataStorageSpec.IntMebibytesBound(Math.min(128, (int) (Runtime.getRuntime().maxMemory() / (16 * 1048576))));\n\n        if (conf.file_cache_size == null)\n            conf.file_cache_size = new DataStorageSpec.IntMebibytesBound(Math.min(512, (int) (Runtime.getRuntime().maxMemory() / (4 * 1048576))));\n\n        // round down for SSDs and round up for spinning disks\n        if (conf.file_cache_round_up == null)\n            conf.file_cache_round_up = conf.disk_optimization_strategy == Config.DiskOptimizationStrategy.spinning;\n\n        if (conf.memtable_offheap_space == null)\n            conf.memtable_offheap_space = new DataStorageSpec.IntMebibytesBound((int) (Runtime.getRuntime().maxMemory() / (4 * 1048576)));\n        // for the moment, we default to twice as much on-heap space as off-heap, as heap overhead is very large\n        if (conf.memtable_heap_space == null)\n            conf.memtable_heap_space = new DataStorageSpec.IntMebibytesBound((int) (Runtime.getRuntime().maxMemory() / (4 * 1048576)));\n        if (conf.memtable_heap_space.toMebibytes() == 0)\n            throw new ConfigurationException(\"memtable_heap_space must be positive, but was \" + conf.memtable_heap_space, false);","sourceCodeStart":719,"sourceCodeEnd":755,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/config/DatabaseDescriptor.java#L719-L755","documentation":"concurrent_counter_writes sizes the counter-write stage thread pool and must be at least 2, mirroring the other concurrent_* pool checks. applySimpleConfig throws this ConfigurationException at startup for smaller values.","triggerScenarios":"Setting `concurrent_counter_writes: 0` or `1` in cassandra.yaml (or programmatic Config) before DatabaseDescriptor.toolInitialization/applyAll.","commonSituations":"Counter-light deployments where operators minimize the pool; shared generated configs applying the same low value to all concurrent_* settings; typos or arithmetic in automated tuning scripts.","solutions":["Set `concurrent_counter_writes` to at least 2 (default is 32).","Remove the override so the default applies.","Update automated tuning scripts to clamp all concurrent_* pools to a minimum of 2."],"exampleFix":"// before (cassandra.yaml)\nconcurrent_counter_writes: 1\n// after (cassandra.yaml)\nconcurrent_counter_writes: 32","handlingStrategy":"validation","validationCode":"// Java, before toolInitialization()\nint counterWrites = /* configured concurrent_counter_writes */;\nif (counterWrites < 2)\n    throw new IllegalArgumentException(\"concurrent_counter_writes must be >= 2, got \" + counterWrites);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Apply one shared clamp (>= 2) to every concurrent_* key in config tooling.","Even on counter-light clusters leave the pool at its default.","Diff generated configs against upstream defaults each upgrade."],"tags":["config","thread-pools","counters","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"}