{"record":{"id":"98d314c96a1687f5","repo":"apache/cassandra","slug":"saved-caches-directory-must-not-be-the-same-as-any","errorCode":null,"errorMessage":"saved_caches_directory must not be the same as any data_file_directories","messagePattern":"saved_caches_directory must not be the same as any data_file_directories","errorType":"validation","errorClass":"ConfigurationException","httpStatus":null,"severity":"critical","filePath":"src/java/org/apache/cassandra/config/DatabaseDescriptor.java","lineNumber":895,"sourceCode":"            conf.data_file_directories = new String[]{ storagedir(\"data_file_directories\") + File.pathSeparator() + \"data\" };\n        }\n\n        long dataFreeBytes = 0;\n        /* data file and commit log directories. they get created later, when they're needed. */\n        for (String datadir : conf.data_file_directories)\n        {\n            if (datadir == null)\n                throw new ConfigurationException(\"data_file_directories must not contain empty entry\", false);\n            if (datadir.equals(conf.local_system_data_file_directory))\n                throw new ConfigurationException(\"local_system_data_file_directory must not be the same as any data_file_directories\", false);\n            if (datadir.equals(conf.commitlog_directory))\n                throw new ConfigurationException(\"commitlog_directory must not be the same as any data_file_directories\", false);\n            if (datadir.equals(conf.accord.journal_directory))\n                throw new ConfigurationException(\"accord.journal_directory must not be the same as any data_file_directories\", false);\n            if (datadir.equals(conf.hints_directory))\n                throw new ConfigurationException(\"hints_directory must not be the same as any data_file_directories\", false);\n            if (datadir.equals(conf.saved_caches_directory))\n                throw new ConfigurationException(\"saved_caches_directory must not be the same as any data_file_directories\", false);\n\n            dataFreeBytes = saturatedSum(dataFreeBytes, tryGetSpace(datadir, FileStore::getUnallocatedSpace));\n        }\n        if (dataFreeBytes < 64 * ONE_GIB) // 64 GB\n            logger.warn(\"Only {} free across all data volumes. Consider adding more capacity to your cluster or removing obsolete snapshots\",\n                        FBUtilities.prettyPrintMemory(dataFreeBytes));\n\n        if (conf.local_system_data_file_directory != null)\n        {\n            if (conf.local_system_data_file_directory.equals(conf.commitlog_directory))\n                throw new ConfigurationException(\"local_system_data_file_directory must not be the same as the commitlog_directory\", false);\n            if (conf.local_system_data_file_directory.equals(conf.accord.journal_directory))\n                throw new ConfigurationException(\"local_system_data_file_directory must not be the same as the accord.journal_directory\", false);\n            if (conf.local_system_data_file_directory.equals(conf.saved_caches_directory))\n                throw new ConfigurationException(\"local_system_data_file_directory must not be the same as the saved_caches_directory\", false);\n            if (conf.local_system_data_file_directory.equals(conf.hints_directory))\n                throw new ConfigurationException(\"local_system_data_file_directory must not be the same as the hints_directory\", false);\n","sourceCodeStart":877,"sourceCodeEnd":913,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/config/DatabaseDescriptor.java#L877-L913","documentation":"saved_caches_directory holds persisted key/table caches and must not overlap any data_file_directories. DatabaseDescriptor.applySimpleConfig throws ConfigurationException when a data directory string-equals conf.saved_caches_directory, refusing startup to keep cache files separate from SSTable data.","triggerScenarios":"Setting saved_caches_directory in cassandra.yaml to the same path as any data_file_directories entry; checked in the same data-directory loop during applySimpleConfig at startup.","commonSituations":"Minimal single-path deployments where every *directory option was pointed at the same location; templated configs rendering identical paths; legacy configs from a single-directory install.","solutions":["Set saved_caches_directory to a distinct path (e.g. /var/lib/cassandra/saved_caches)","Use sibling subdirectories for each function if everything shares one volume","Audit generated cassandra.yaml so each directory setting is unique"],"exampleFix":"# before (cassandra.yaml)\ndata_file_directories:\n  - /var/lib/cassandra/data\nsaved_caches_directory: /var/lib/cassandra/data\n# after (cassandra.yaml)\ndata_file_directories:\n  - /var/lib/cassandra/data\nsaved_caches_directory: /var/lib/cassandra/saved_caches","handlingStrategy":"validation","validationCode":"String caches = (String) yaml.get(\"saved_caches_directory\");\nList<String> dirs = (List<String>) yaml.get(\"data_file_directories\");\nif (caches != null && dirs != null && dirs.contains(caches))\n    throw new IllegalArgumentException(\"saved_caches_directory must differ from all data_file_directories\");","typeGuard":null,"tryCatchPattern":"try {\n    DatabaseDescriptor.toolInitialization();\n} catch (ConfigurationException e) {\n    if (e.getMessage().contains(\"saved_caches_directory\"))\n        throw new StartupConfigError(\"saved_caches_directory overlaps a data directory\", e);\n    throw e;\n}","preventionTips":["Use a dedicated saved_caches path distinct from data dirs","Template all cassandra *directory options as separate variables","Lint for exact-string path collisions across all directory settings"],"tags":["cassandra","configuration","directories","caches"],"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"}