{"record":{"id":"db800ffb8a6b67e7","repo":"risingwavelabs/risingwave","slug":"compaction-max-snapshots-num-must-be-greater-tha-db800f","errorCode":null,"errorMessage":"`compaction.max_snapshots_num` must be greater than 0, got: {}","messagePattern":"`compaction\\.max_snapshots_num` must be greater than 0, got: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/connector/src/sink/iceberg/mod.rs","lineNumber":327,"sourceCode":"        // Validate compaction interval\n        if let Some(compaction_interval) = iceberg_config.compaction_interval_sec {\n            if iceberg_config.enable_compaction && compaction_interval == 0 {\n                bail!(\n                    \"`compaction-interval-sec` must be greater than 0 when `enable-compaction` is true\"\n                );\n            }\n\n            tracing::info!(\n                \"Alter config compaction_interval set to {} seconds\",\n                compaction_interval\n            );\n        }\n\n        // Validate max snapshots\n        if let Some(max_snapshots) = iceberg_config.max_snapshots_num_before_compaction\n            && max_snapshots < 1\n        {\n            bail!(\n                \"`compaction.max_snapshots_num` must be greater than 0, got: {}\",\n                max_snapshots\n            );\n        }\n\n        // Validate target file size\n        if let Some(target_file_size_mb) = iceberg_config.target_file_size_mb\n            && target_file_size_mb == 0\n        {\n            bail!(\"`compaction.target_file_size_mb` must be greater than 0\");\n        }\n\n        // Validate parquet max row group rows\n        if let Some(max_row_group_rows) = iceberg_config.write_parquet_max_row_group_rows\n            && max_row_group_rows == 0\n        {\n            bail!(\"`compaction.write_parquet_max_row_group_rows` must be greater than 0\");\n        }","sourceCodeStart":309,"sourceCodeEnd":345,"githubUrl":"https://github.com/risingwavelabs/risingwave/blob/6469eb736d691e8e9b8a419a57edd6429ca77417/src/connector/src/sink/iceberg/mod.rs#L309-L345","documentation":"During Iceberg sink config alteration, `compaction.max_snapshots_num` must be at least 1. A value of 0 or negative would mean compaction triggers on zero snapshots or is nonsensical, so validation rejects it.","triggerScenarios":"`ALTER SINK ... SET` with `compaction.max_snapshots_num = '0'` or a negative number while configuring snapshot-retention-based compaction.","commonSituations":"Users misreading the option as 'delete all snapshots' and setting 0; arithmetic/templating producing 0; confusion with an infinity/disable sentinel.","solutions":["Set `compaction.max_snapshots_num` to a positive integer, e.g. `100`.","Remove the property to fall back to the built-in default threshold.","Use `enable-compaction=false` if the intent is to disable snapshot-based compaction entirely."],"exampleFix":"-- before\nALTER SINK s SET ('compaction.max_snapshots_num'='0');\n-- after\nALTER SINK s SET ('compaction.max_snapshots_num'='100');","handlingStrategy":"validation","validationCode":"fn valid_max_snapshots(cfg: &std::collections::BTreeMap<String, String>) -> Result<(), String> {\n    if let Some(s) = cfg.get(\"compaction.max_snapshots_num\") {\n        if s.parse::<i64>().unwrap_or(0) < 1 {\n            return Err(\"compaction.max_snapshots_num must be >= 1\".into());\n        }\n    }\n    Ok(())\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Remember the option means 'compact when more than N snapshots exist', so minimum is 1.","Don't use 0 as a 'disable' sentinel; use enable-compaction=false."],"tags":["iceberg","sink","config","compaction"],"backgroundTag":"value-out-of-range","analyzedSha":"6469eb736d691e8e9b8a419a57edd6429ca77417","analyzedAt":"2026-09-11T21:06:21.487Z","contentChangedAt":"2026-09-11T21:06:21.487Z","schemaVersion":2},"datasetVersion":"2026-09-14T21:17:11.552Z"}