{"record":{"id":"87a81712c6db56af","repo":"apache/cassandra","slug":"repair-session-max-tree-depth-of-20-could-lea","errorCode":null,"errorMessage":"repair_session_max_tree_depth of {} > 20 could lead to excessive memory usage","messagePattern":"repair_session_max_tree_depth of (.+?) > 20 could lead to excessive memory usage","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/java/org/apache/cassandra/config/DatabaseDescriptor.java","lineNumber":768,"sourceCode":"            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);\n        logger.info(\"Global memtable on-heap threshold is enabled at {}\", conf.memtable_heap_space);\n        if (conf.memtable_offheap_space.toMebibytes() == 0)\n            logger.info(\"Global memtable off-heap threshold is disabled, HeapAllocator will be used instead\");\n        else\n            logger.info(\"Global memtable off-heap threshold is enabled at {}\", conf.memtable_offheap_space);\n\n        if (conf.repair_session_max_tree_depth != null)\n        {\n            logger.warn(\"repair_session_max_tree_depth has been deprecated and should be removed from cassandra.yaml. Use repair_session_space instead\");\n            if (conf.repair_session_max_tree_depth < 10)\n                throw new ConfigurationException(\"repair_session_max_tree_depth should not be < 10, but was \" + conf.repair_session_max_tree_depth);\n            if (conf.repair_session_max_tree_depth > 20)\n                logger.warn(\"repair_session_max_tree_depth of \" + conf.repair_session_max_tree_depth + \" > 20 could lead to excessive memory usage\");\n        }\n        else\n        {\n            conf.repair_session_max_tree_depth = 20;\n        }\n\n        if (conf.repair_session_space == null)\n            conf.repair_session_space = new DataStorageSpec.IntMebibytesBound(Math.max(1, (int) (Runtime.getRuntime().maxMemory() / (16 * 1048576))));\n\n        if (conf.repair_session_space.toMebibytes() < 1)\n            throw new ConfigurationException(\"repair_session_space must be > 0, but was \" + conf.repair_session_space);\n        else if (conf.repair_session_space.toMebibytes() > (int) (Runtime.getRuntime().maxMemory() / (4 * 1048576)))\n            logger.warn(\"A repair_session_space of \" + conf.repair_session_space + \" mebibytes is likely to cause heap pressure\");\n\n        checkForLowestAcceptedTimeouts(conf);\n\n        long valueInBytes = conf.native_transport_max_frame_size.toBytes();\n        if (valueInBytes < 0 || valueInBytes > Integer.MAX_VALUE - 1)","sourceCodeStart":750,"sourceCodeEnd":786,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/config/DatabaseDescriptor.java#L750-L786","documentation":"When repair_session_max_tree_depth is set above 20 in cassandra.yaml, DatabaseDescriptor logs a warning that the deeper Merkle tree depth can lead to excessive memory usage during repair. The value is accepted, but each extra level multiplies the number of tree nodes (and thus memory) needed per repair session range.","triggerScenarios":"cassandra.yaml sets repair_session_max_tree_depth to a value > 20; applySimpleConfig validates and warns after passing the >= 10 check.","commonSituations":"Operators aggressively increasing repair granularity to resolve large repair differences or streaming mismatches, without accounting for heap cost.","solutions":["Lower repair_session_max_tree_depth to <= 20","Prefer tuning repair_session_space to bound repair memory instead","Remove the deprecated property entirely and use version defaults (depth falls back to 20)"],"exampleFix":"// before\nrepair_session_max_tree_depth: 28\n// after\nrepair_session_max_tree_depth: 20   # or remove; default is 20","handlingStrategy":"validation","validationCode":"if (config.repair_session_max_tree_depth != null && config.repair_session_max_tree_depth > 20) {\n    logger.warn(\"depth > 20 risks excessive memory; keep <= 20 or tune repair_session_space instead\");\n}","typeGuard":null,"tryCatchPattern":"try { DatabaseDescriptor.applySimpleConfig(conf); } catch (ConfigurationException e) { /* only < 10 throws; > 20 is just a warn */ }","preventionTips":["Cap tree depth at 20","Bound repair memory with repair_session_space rather than tree depth","Compare configured depth against node heap size before rollout"],"tags":["cassandra","config","repair","memory"],"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"}