risingwavelabs/risingwave · error

`compaction.type` must not be set when `write_mode` is `copy

Error message

`compaction.type` must not be set when `write_mode` is `copy-on-write`; copy-on-write selects its compaction policy automatically

What it means

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.

Source

Thrown at src/connector/src/sink/iceberg/mod.rs:99

        IcebergSink::new(config, param)
    }
}

impl Debug for IcebergSink {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.debug_struct("IcebergSink")
            .field("config", &self.config)
            .finish()
    }
}

fn validate_explicit_compaction_type(config: &IcebergConfig) -> Result<()> {
    let Some(compaction_type) = config.compaction_type else {
        return Ok(());
    };

    if config.write_mode == IcebergWriteMode::CopyOnWrite {
        bail!(
            "`compaction.type` must not be set when `write_mode` is `copy-on-write`; \
             copy-on-write selects its compaction policy automatically"
        );
    }

    if !matches!(compaction_type, CompactionType::Full) {
        Feature::IcebergCompaction
            .check_available()
            .map_err(|e| anyhow!(e))?;
    }

    Ok(())
}

fn validate_compaction_option_compatibility(config: &IcebergConfig) -> Result<()> {
    // Value ranges are validated by `IcebergConfig::from_btreemap`. This only rejects
    // options that are incompatible with the selected merge-on-read strategy.
    // COW ignores legacy persisted types, so merge-on-read type-option compatibility does not apply.

View on GitHub (pinned to 6469eb736d)

Solutions

  1. Remove the `compaction.type` option when using copy-on-write
  2. Or keep compaction.type and use write_mode='merge-on-read'
  3. If this appeared after an ALTER, drop and recreate the sink with a consistent option set

Example fix

// before
WITH (connector='iceberg', write_mode='copy-on-write', compaction.type='full')
// after
WITH (connector='iceberg', write_mode='copy-on-write')
Defensive patterns

Strategy: validation

Validate before calling

if write_mode == "copy-on-write" && options.contains_key("compaction.type") {
    return Err("compaction.type conflicts with copy-on-write");
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: Conflicting config options: "cannot be used together" — configuration validation errors across open-source libraries — this error's family across 162 libraries.

Related errors


AI-assisted analysis of risingwavelabs/risingwave@6469eb736d (2026-09-11). Data as JSON: /api/errors/3e502d6c0f0138d8. Report an issue: GitHub.