{"record":{"id":"3e502d6c0f0138d8","repo":"risingwavelabs/risingwave","slug":"compaction-type-must-not-be-set-when-write-mode","errorCode":null,"errorMessage":"`compaction.type` must not be set when `write_mode` is `copy-on-write`; copy-on-write selects its compaction policy automatically","messagePattern":"`compaction\\.type` must not be set when `write_mode` is `copy-on-write`; copy-on-write selects its compaction policy automatically","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/connector/src/sink/iceberg/mod.rs","lineNumber":99,"sourceCode":"        IcebergSink::new(config, param)\n    }\n}\n\nimpl Debug for IcebergSink {\n    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {\n        f.debug_struct(\"IcebergSink\")\n            .field(\"config\", &self.config)\n            .finish()\n    }\n}\n\nfn validate_explicit_compaction_type(config: &IcebergConfig) -> Result<()> {\n    let Some(compaction_type) = config.compaction_type else {\n        return Ok(());\n    };\n\n    if config.write_mode == IcebergWriteMode::CopyOnWrite {\n        bail!(\n            \"`compaction.type` must not be set when `write_mode` is `copy-on-write`; \\\n             copy-on-write selects its compaction policy automatically\"\n        );\n    }\n\n    if !matches!(compaction_type, CompactionType::Full) {\n        Feature::IcebergCompaction\n            .check_available()\n            .map_err(|e| anyhow!(e))?;\n    }\n\n    Ok(())\n}\n\nfn validate_compaction_option_compatibility(config: &IcebergConfig) -> Result<()> {\n    // Value ranges are validated by `IcebergConfig::from_btreemap`. This only rejects\n    // options that are incompatible with the selected merge-on-read strategy.\n    // COW ignores legacy persisted types, so merge-on-read type-option compatibility does not apply.","sourceCodeStart":81,"sourceCodeEnd":117,"githubUrl":"https://github.com/risingwavelabs/risingwave/blob/6469eb736d691e8e9b8a419a57edd6429ca77417/src/connector/src/sink/iceberg/mod.rs#L81-L117","documentation":"The iceberg sink's copy-on-write write mode chooses its compaction policy automatically, so explicitly setting compaction.type alongside write_mode='copy-on-write' is rejected as conflicting configuration.","triggerScenarios":"Creating or altering an iceberg sink where `write_mode` is (or is changed to) 'copy-on-write' while `compaction.type` is explicitly set in sink options.","commonSituations":"Copying options from a merge-on-read sink and switching write mode; ALTERing write_mode to copy-on-write on an existing sink that had compaction.type set.","solutions":["Remove the `compaction.type` option when using copy-on-write","Or keep compaction.type and use write_mode='merge-on-read'","If this appeared after an ALTER, drop and recreate the sink with a consistent option set"],"exampleFix":"// before\nWITH (connector='iceberg', write_mode='copy-on-write', compaction.type='full')\n// after\nWITH (connector='iceberg', write_mode='copy-on-write')","handlingStrategy":"validation","validationCode":"if write_mode == \"copy-on-write\" && options.contains_key(\"compaction.type\") {\n    return Err(\"compaction.type conflicts with copy-on-write\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Only set compaction.type for merge-on-read sinks","Review sink WITH options when switching write modes via ALTER","Keep a per-write-mode option checklist"],"tags":["iceberg","sink","config","compaction"],"backgroundTag":"conflicting-config-options","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"}