risingwavelabs/risingwave · error

`compaction.target_file_size_mb` must be greater than 0

Error message

`compaction.target_file_size_mb` must be greater than 0

What it means

Guard in validate_alter_config that re-checks compaction options on ALTER SINK: `compaction.max_snapshots_num` must be at least 1. Unlike the creation-time from_btreemap check, this one bails with the offending value interpolated, so the user sees exactly what was rejected.

Source

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

                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
            );
        }

        // Validate target file size
        if let Some(target_file_size_mb) = iceberg_config.target_file_size_mb
            && target_file_size_mb == 0
        {
            bail!("`compaction.target_file_size_mb` must be greater than 0");
        }

        // Validate parquet max row group rows
        if let Some(max_row_group_rows) = iceberg_config.write_parquet_max_row_group_rows
            && max_row_group_rows == 0
        {
            bail!("`compaction.write_parquet_max_row_group_rows` must be greater than 0");
        }

        // Validate parquet max row group bytes
        if let Some(max_row_group_bytes) = iceberg_config.write_parquet_max_row_group_bytes
            && max_row_group_bytes == 0
        {
            bail!("`compaction.write_parquet_max_row_group_bytes` must be greater than 0");
        }

        // Validate parquet compression codec
        if let Some(ref compression) = iceberg_config.write_parquet_compression {

View on GitHub (pinned to 6469eb736d)

Solutions

  1. Set `compaction.target_file_size_mb` to a positive value, e.g. `128` or `512`.
  2. Remove the property to use the default target file size.
  3. Verify the unit is megabytes and that any computed/templated value is >= 1.

Example fix

-- before
ALTER SINK s SET ('compaction.target_file_size_mb'='0');
-- after
ALTER SINK s SET ('compaction.target_file_size_mb'='512');
Defensive patterns

Strategy: validation

Validate before calling

fn valid_target_file_size(cfg: &std::collections::BTreeMap<String, String>) -> Result<(), String> {
    if let Some(s) = cfg.get("compaction.target_file_size_mb") {
        if s.parse::<u64>().unwrap_or(0) == 0 {
            return Err("compaction.target_file_size_mb must be > 0".into());
        }
    }
    Ok(())
}

Prevention

When it happens

Trigger: `ALTER SINK ... SET` with `compaction.target_file_size_mb = '0'`.

Common situations: Placeholder values left in generated configs; misunderstanding the unit (MB) and passing a fraction or 0; attempts to force maximal compaction.

Understand the failure class

Background: "value must be between 0 and 1" / "out of range" / "must not be negative" errors: fixing range-validation failures across open-source libraries — this error's family across 42 libraries.

Related errors


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