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
- Set `compaction.target_file_size_mb` to a positive value, e.g. `128` or `512`.
- Remove the property to use the default target file size.
- 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
- Keep values in MB (unit is part of the key name).
- Use sane defaults like 128/256/512 unless profiling says otherwise.
- Sanity-check any generated config numerically before ALTER SINK.
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
- `compaction.type` must not be set when `write_mode` is `copy
- `{option}` is not supported for '{}' compaction type
- `compaction-interval-sec` must be greater than 0 when `enabl
- `compaction.max_snapshots_num` must be greater than 0, got:
- `compaction_interval_sec` must be greater than 0
AI-assisted analysis of risingwavelabs/risingwave@6469eb736d (2026-09-11).
Data as JSON: /api/errors/c17ffd9cf20507de.
Report an issue: GitHub.