risingwavelabs/risingwave · error

`compaction-interval-sec` must be greater than 0 when `enabl

Error message

`compaction-interval-sec` must be greater than 0 when `enable-compaction` is true

What it means

When altering an Iceberg sink's configuration, if compaction is enabled and a compaction interval is supplied, the interval must be a positive number of seconds. An interval of 0 combined with `enable-compaction=true` would schedule compaction constantly, so validation rejects it.

Source

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

                    && iceberg_config.write_mode == IcebergWriteMode::MergeOnRead);

            // Persisted COW types are legacy-only and must not block compaction activation.
            if validate_explicit_type {
                validate_explicit_compaction_type(&iceberg_config)?;
            }
            validate_compaction_option_compatibility(&iceberg_config)?;
        }

        Self::validate_alter_config(config)
    }

    fn validate_alter_config(config: &BTreeMap<String, String>) -> Result<()> {
        let iceberg_config = IcebergConfig::from_btreemap(config.clone())?;

        // Validate compaction interval
        if let Some(compaction_interval) = iceberg_config.compaction_interval_sec {
            if iceberg_config.enable_compaction && compaction_interval == 0 {
                bail!(
                    "`compaction-interval-sec` must be greater than 0 when `enable-compaction` is true"
                );
            }

            tracing::info!(
                "Alter config compaction_interval set to {} seconds",
                compaction_interval
            );
        }

        // Validate max snapshots
        if let Some(max_snapshots) = iceberg_config.max_snapshots_num_before_compaction
            && max_snapshots < 1
        {
            bail!(
                "`compaction.max_snapshots_num` must be greater than 0, got: {}",
                max_snapshots
            );

View on GitHub (pinned to 6469eb736d)

Solutions

  1. Set `compaction-interval-sec` to a positive integer, e.g. `60`.
  2. Set `enable-compaction=false` instead of zeroing the interval if you want compaction off.
  3. Remove `compaction-interval-sec` to use the default interval while keeping compaction enabled.

Example fix

-- before
ALTER SINK s SET ('enable-compaction'='true', 'compaction-interval-sec'='0');
-- after
ALTER SINK s SET ('enable-compaction'='true', 'compaction-interval-sec'='60');
Defensive patterns

Strategy: validation

Validate before calling

fn valid_interval(cfg: &std::collections::BTreeMap<String, String>) -> Result<(), String> {
    let enabled = cfg.get("enable-compaction").map(|v| v == "true").unwrap_or(false);
    if enabled {
        if let Some(s) = cfg.get("compaction-interval-sec") {
            if s.parse::<u64>().unwrap_or(0) == 0 {
                return Err("compaction-interval-sec must be > 0 when enable-compaction is true".into());
            }
        }
    }
    Ok(())
}

Prevention

When it happens

Trigger: `ALTER SINK ... SET` (validate_alter_config) with `enable-compaction` true and `compaction-interval-sec = '0'`.

Common situations: Users trying to disable compaction by setting the interval to 0 instead of `enable-compaction=false`; copy-paste of a placeholder value.

Understand the failure class

Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.

Related errors


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