{"record":{"id":"155b340dab6ecf88","repo":"apache/cassandra","slug":"missing-value-for-commitlog-sync-period","errorCode":null,"errorMessage":"Missing value for commitlog_sync_period.","messagePattern":"Missing value for commitlog_sync_period\\.","errorType":"validation","errorClass":"ConfigurationException","httpStatus":null,"severity":"critical","filePath":"src/java/org/apache/cassandra/config/DatabaseDescriptor.java","lineNumber":665,"sourceCode":"            logger.debug(\"Syncing log with batch mode\");\n        }\n        else if (conf.commitlog_sync == CommitLogSync.group)\n        {\n            if (conf.commitlog_sync_group_window.toMilliseconds() == 0)\n            {\n                throw new ConfigurationException(\"Missing value for commitlog_sync_group_window.\", false);\n            }\n            else if (conf.commitlog_sync_period.toMilliseconds() != 0)\n            {\n                throw new ConfigurationException(\"Group sync specified, but commitlog_sync_period found. Only specify commitlog_sync_group_window when using group sync\", false);\n            }\n            logger.debug(\"Syncing log with a group window of {}\", conf.commitlog_sync_period.toString());\n        }\n        else\n        {\n            if (conf.commitlog_sync_period.toMilliseconds() == 0)\n            {\n                throw new ConfigurationException(\"Missing value for commitlog_sync_period.\", false);\n            }\n            logger.debug(\"Syncing log with a period of {}\", conf.commitlog_sync_period.toString());\n        }\n\n        if (conf.accord.journal.flushPeriod == null)\n        {\n            conf.accord.journal.flushPeriod = conf.commitlog_sync_period;\n            if (conf.accord.journal.flushMode == PERIODIC && conf.commitlog_sync_period.toMilliseconds() == 0)\n            {\n                logger.warn(\"Accord journal is configured in periodic mode, while Cassandra commit log is configured in {} mode\", conf.commitlog_sync);\n                conf.accord.journal.flushPeriod = conf.accord.journal.periodicFlushLagBlock;\n            }\n        }\n\n        if (conf.accord.durability_flush_interval == null)\n            conf.accord.durability_flush_interval = conf.accord.shard_durability_cycle;\n\n        /* evaluate the DiskAccessMode Config directive, which also affects indexAccessMode selection */","sourceCodeStart":647,"sourceCodeEnd":683,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/config/DatabaseDescriptor.java#L647-L683","documentation":"For periodic (default) commitlog sync, commitlog_sync_period_in_ms defines how often the commitlog is fsynced. applySimpleConfig uses a 0ms period as the sentinel for 'unset' and throws at startup, refusing to run periodic sync with no period configured.","triggerScenarios":"commitlog_sync is periodic (explicitly or by default) but `commitlog_sync_period_in_ms` is absent or explicitly 0, evaluated in DatabaseDescriptor.applySimpleConfig during toolInitialization/applyAll.","commonSituations":"Hand-written minimal cassandra.yaml where the period was omitted; upgrading from a config that relied on defaults but that also pinned commitlog_sync: periodic; automated tools writing commitlog_sync_period_in_ms: 0 to 'disable' syncing.","solutions":["Add `commitlog_sync_period_in_ms: 10000` (the shipped default) to cassandra.yaml.","Remove the explicit `commitlog_sync: periodic` line so defaults apply.","Use a different sync mode (group with its window) if periodic tuning isn't desired."],"exampleFix":"// before (cassandra.yaml)\ncommitlog_sync: periodic\ncommitlog_sync_period_in_ms: 0\n// after (cassandra.yaml)\ncommitlog_sync: periodic\ncommitlog_sync_period_in_ms: 10000","handlingStrategy":"validation","validationCode":"// Java, before toolInitialization()\nvar raw = Config.getRawConfig();\nboolean periodic = raw == null || raw.commitlog_sync == null || raw.commitlog_sync == CommitLogSync.periodic;\nif (periodic && (raw == null || raw.commitlog_sync_period == null || raw.commitlog_sync_period.toMilliseconds() == 0))\n    throw new IllegalArgumentException(\"periodic commitlog_sync requires a non-zero commitlog_sync_period_in_ms\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Start from the shipped cassandra.yaml rather than authoring one from scratch.","Never use 0 to mean 'default' or 'disabled' for duration-typed config keys.","Run a node startup smoke test in CI against the real config file."],"tags":["config","commitlog","startup","validation"],"backgroundTag":"missing-required-config-field","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"}