{"record":{"id":"59549fb34d1a1f63","repo":"apache/cassandra","slug":"cannot-set-repair-session-space-to-1-mebibyte","errorCode":null,"errorMessage":"Cannot set repair_session_space to < 1 mebibyte","messagePattern":"Cannot set repair_session_space to < 1 mebibyte","errorType":"validation","errorClass":"ConfigurationException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/config/DatabaseDescriptor.java","lineNumber":4771,"sourceCode":"    {\n        if (depth < 10)\n            throw new ConfigurationException(\"Cannot set repair_session_max_tree_depth to \" + depth +\n                                             \" which is < 10, doing nothing\");\n        else if (depth > 20)\n            logger.warn(\"repair_session_max_tree_depth of \" + depth + \" > 20 could lead to excessive memory usage\");\n\n        conf.repair_session_max_tree_depth = depth;\n    }\n\n    public static int getRepairSessionSpaceInMiB()\n    {\n        return conf.repair_session_space.toMebibytes();\n    }\n\n    public static void setRepairSessionSpaceInMiB(int sizeInMiB)\n    {\n        if (sizeInMiB < 1)\n            throw new ConfigurationException(\"Cannot set repair_session_space to \" + sizeInMiB +\n                                             \" < 1 mebibyte\");\n        else if (sizeInMiB > (int) (Runtime.getRuntime().maxMemory() / (4 * 1048576)))\n            logger.warn(\"A repair_session_space of \" + conf.repair_session_space +\n                        \" is likely to cause heap pressure.\");\n\n        conf.repair_session_space = new DataStorageSpec.IntMebibytesBound(sizeInMiB);\n    }\n\n    public static int getConcurrentMerkleTreeRequests()\n    {\n        return conf.concurrent_merkle_tree_requests;\n    }\n\n    public static void setConcurrentMerkleTreeRequests(int value)\n    {\n        conf.concurrent_merkle_tree_requests = value;\n    }\n","sourceCodeStart":4753,"sourceCodeEnd":4789,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/config/DatabaseDescriptor.java#L4753-L4789","documentation":"Cassandra throws this ConfigurationException when setRepairSessionSpaceInMiB is called with a size below 1 MiB. repair_session_space bounds the total memory used by repair Merkle trees per repair session; values under 1 MiB cannot be honored.","triggerScenarios":"Calling DatabaseDescriptor.setRepairSessionSpaceInMiB(0) or any value < 1, via JMX config updates or programmatic configuration.","commonSituations":"Operators on memory-constrained nodes shrink repair_session_space to nearly zero to relieve heap pressure; unit confusion where someone enters bytes or intends a fraction of a MiB.","solutions":["Set the value to at least 1 MiB","If heap pressure is the concern, reduce concurrent repair validators instead of the per-session space","Check cassandra.yaml repair_session_space uses MiB units (e.g. 16MiB)"],"exampleFix":"// before\nDatabaseDescriptor.setRepairSessionSpaceInMiB(0);\n// after\nDatabaseDescriptor.setRepairSessionSpaceInMiB(16);","handlingStrategy":"validation","validationCode":"if (sizeInMiB < 1) throw new IllegalArgumentException(\"repair_session_space must be at least 1 MiB\");","typeGuard":null,"tryCatchPattern":"try {\n    DatabaseDescriptor.setRepairSessionSpaceInMiB(sizeInMiB);\n} catch (ConfigurationException e) {\n    logger.warn(\"repair_session_space must be >= 1 MiB; keeping current value\", e);\n}","preventionTips":["Set repair_session_space >= 1 MiB (common values: 16-128 MiB)","Confirm units in cassandra.yaml use MiB suffix (e.g. 16MiB)","Relieve heap pressure by limiting concurrent repairs, not shrinking below 1 MiB"],"tags":["configuration","repair","memory"],"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-14T16:17:12.679Z"}