{"record":{"id":"d87a515087759c74","repo":"cube-js/cube","slug":"cubestore-compaction-readiness-chunks-threshold","errorCode":null,"errorMessage":"CUBESTORE_COMPACTION_READINESS_CHUNKS_THRESHOLD ({}) must not be lower than CUBESTORE_CHUNKS_COUNT_THRESHOLD ({}), otherwise compaction will never reduce chunks below the readiness threshold","messagePattern":"CUBESTORE_COMPACTION_READINESS_CHUNKS_THRESHOLD \\((.+?)\\) must not be lower than CUBESTORE_CHUNKS_COUNT_THRESHOLD \\((.+?)\\), otherwise compaction will never reduce chunks below the readiness threshold","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"rust/cubestore/cubestore/src/config/mod.rs","lineNumber":2279,"sourceCode":"\n    pub fn update_config(\n        &self,\n        update_config: impl FnOnce(ConfigObjImpl) -> ConfigObjImpl,\n    ) -> Config {\n        let new_config = self.config_obj.as_ref().clone();\n        let config = Self {\n            injector: self.injector.clone(),\n            config_obj: Arc::new(update_config(new_config)),\n        };\n        config.validate_config();\n        config\n    }\n\n    fn validate_config(&self) {\n        if let Some(readiness) = self.config_obj.compaction_readiness_chunks_threshold {\n            let compaction = self.config_obj.compaction_chunks_count_threshold;\n            if readiness < compaction {\n                panic!(\n                    \"CUBESTORE_COMPACTION_READINESS_CHUNKS_THRESHOLD ({}) must not be lower than \\\n                     CUBESTORE_CHUNKS_COUNT_THRESHOLD ({}), otherwise compaction will never \\\n                     reduce chunks below the readiness threshold\",\n                    readiness, compaction,\n                );\n            }\n        }\n    }\n\n    pub async fn start_test<T>(&self, test_fn: impl FnOnce(CubeServices) -> T)\n    where\n        T: Future<Output = Result<(), CubeError>> + Send,\n    {\n        self.start_test_with_options::<_, T, _, _>(\n            true,\n            Option::<\n                Box<\n                    dyn FnOnce(Arc<Injector>) -> Pin<Box<dyn Future<Output = ()> + Send>>","sourceCodeStart":2261,"sourceCodeEnd":2297,"githubUrl":"https://github.com/cube-js/cube/blob/7d981676b36392fec34088b9afab6bdcad40207c/rust/cubestore/cubestore/src/config/mod.rs#L2261-L2297","documentation":"CubeStore's validate_config panics if CUBESTORE_COMPACTION_READINESS_CHUNKS_THRESHOLD is set lower than CUBESTORE_CHUNKS_COUNT_THRESHOLD. With such a configuration, compaction could never bring the chunk count below the readiness threshold, so the config is logically invalid and the server refuses to start.","triggerScenarios":"Configuring a readiness threshold smaller than the compaction trigger threshold, e.g. CUBESTORE_COMPACTION_READINESS_CHUNKS_THRESHOLD=5 with CUBESTORE_CHUNKS_COUNT_THRESHOLD=10.","commonSituations":"Operators tuning compaction knobs independently without realizing readiness must be >= the compaction trigger; template configs copied between environments with only one of the two variables overridden.","solutions":["Raise CUBESTORE_COMPACTION_READINESS_CHUNKS_THRESHOLD to a value >= CUBESTORE_CHUNKS_COUNT_THRESHOLD","Lower CUBESTORE_CHUNKS_COUNT_THRESHOLD instead if that matches intent","Unset one or both variables to use the defaults, which are consistent"],"exampleFix":"// before\nCUBESTORE_CHUNKS_COUNT_THRESHOLD=10\nCUBESTORE_COMPACTION_READINESS_CHUNKS_THRESHOLD=5\n// after\nCUBESTORE_CHUNKS_COUNT_THRESHOLD=10\nCUBESTORE_COMPACTION_READINESS_CHUNKS_THRESHOLD=20","handlingStrategy":"validation","validationCode":"// fail fast when readiness < compaction threshold\nif [ -n \"$CUBESTORE_COMPACTION_READINESS_CHUNKS_THRESHOLD\" ] && [ -n \"$CUBESTORE_CHUNKS_COUNT_THRESHOLD\" ] \\\n   && [ \"$CUBESTORE_COMPACTION_READINESS_CHUNKS_THRESHOLD\" -lt \"$CUBESTORE_CHUNKS_COUNT_THRESHOLD\" ]; then\n  echo \"readiness threshold must be >= compaction threshold\"; exit 1;\nfi","typeGuard":null,"tryCatchPattern":"null","preventionTips":["Always set the two compaction thresholds together","Keep readiness >= compaction threshold by convention (e.g. readiness = 2x compaction)","Document the invariant in your ops runbook","Unset both to use consistent built-in defaults"],"tags":["config","compaction","env-var","panic"],"backgroundTag":"invalid-env-var-value","analyzedSha":"7d981676b36392fec34088b9afab6bdcad40207c","analyzedAt":"2026-09-02T03:45:10.400Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}