{"record":{"id":"698a0606d6308447","repo":"risingwavelabs/risingwave","slug":"cow-compaction-must-produce-at-most-one-table-scop","errorCode":null,"errorMessage":"COW compaction must produce at most one table-scoped plan, got {}","messagePattern":"COW compaction must produce at most one table-scoped plan, got (.+?)","errorType":"exception","errorClass":"HummockError","httpStatus":null,"severity":"error","filePath":"src/storage/src/hummock/compactor/iceberg_compaction/iceberg_compactor_runner.rs","lineNumber":1013,"sourceCode":"        table\n            .metadata()\n            .snapshot_for_ref(&branch)\n            .map(|snapshot| {\n                vec![CompactionPlan::new(\n                    FileGroup::empty(),\n                    branch.clone(),\n                    snapshot.snapshot_id(),\n                )]\n            })\n            .unwrap_or_default()\n    } else {\n        compaction_plans\n    };\n\n    // Each COW plan publishes a complete table state to `main`, so independent plans could\n    // overwrite one another instead of composing their rewrites.\n    if compaction_kind.is_copy_on_write() && compaction_plans.len() > 1 {\n        return Err(HummockError::compaction_executor(anyhow::anyhow!(\n            \"COW compaction must produce at most one table-scoped plan, got {}\",\n            compaction_plans.len()\n        )));\n    }\n\n    if compaction_plans.is_empty() {\n        tracing::info!(\n            iceberg_component = \"compaction_worker\",\n            iceberg_operation = \"plan_task\",\n            task_id = %task_id,\n            sink_id = sink_id,\n            task_type = ?compaction_kind,\n            table = %table_ident,\n            branch = %branch,\n            \"iceberg_compaction_task_skipped_no_files\",\n        );\n        return Ok(IcebergTaskExecution {\n            sink_id,","sourceCodeStart":995,"sourceCodeEnd":1031,"githubUrl":"https://github.com/risingwavelabs/risingwave/blob/6469eb736d691e8e9b8a419a57edd6429ca77417/src/storage/src/hummock/compactor/iceberg_compaction/iceberg_compactor_runner.rs#L995-L1031","documentation":"Each copy-on-write compaction plan publishes a complete table state to the main branch, so multiple independent COW plans would overwrite one another instead of composing their rewrites. After planning, create_task_execution asserts that a COW kind yields at most one plan; if the planner produced more than one, the task fails with this error before execution.","triggerScenarios":"IcebergCompactionKind::is_copy_on_write() is true and compaction_plans.len() > 1 after planning in create_task_execution — the planner generated multiple table-scoped plans for a COW task.","commonSituations":"Internal planner bug or a table state (very large table partitioned into many groups) that causes the planner to split a COW compaction into several plans; a config combination (COW write mode + multi-plan-producing strategy) that the planner doesn't guard upstream.","solutions":["Retry the compaction — if the planner intermittently split the plan, a fresh planning round may yield a single plan.","Reduce compaction scope (e.g. run Full COW compaction on smaller tables/partitions) so a single table-scoped plan suffices.","Verify the planner configuration (target_file_size_mb, group sizing options like target_binpack_group_size_mb) isn't forcing plan fragmentation; tune them to consolidate.","If reproducible, this indicates a planner/COW invariant bug — report with the plan contents from the logs."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"let plans = plan_compaction(&table, kind).await?;\nif kind.is_copy_on_write() && plans.len() > 1 {\n    tracing::error!(count = plans.len(), \"COW planner produced multiple plans; re-planning\");\n    return retry_with_single_plan().await;\n}","preventionTips":["Keep COW compaction scope small enough for a single table-scoped plan (partition-level Full compaction).","Tune group sizing configs (target_binpack_group_size_mb, min_group_*) to avoid plan fragmentation.","Treat repeated occurrences as a planner bug and report with plan logs."],"tags":["rust","iceberg","copy-on-write","compaction","invariant"],"backgroundTag":"internal-invariant-violation","analyzedSha":"6469eb736d691e8e9b8a419a57edd6429ca77417","analyzedAt":"2026-09-11T21:06:21.487Z","contentChangedAt":"2026-09-11T21:06:21.487Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}