{"record":{"id":"6816a6d4638b5e80","repo":"risingwavelabs/risingwave","slug":"expect-at-least-1-cdc-table-snapshot-splits-0-was","errorCode":null,"errorMessage":"Expect at least 1 CDC table snapshot splits, 0 was found.","messagePattern":"Expect at least 1 CDC table snapshot splits, 0 was found\\.","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/meta/src/stream/cdc.rs","lineNumber":199,"sourceCode":"    assert_eq!(\n        stream_scan_fragments.count(),\n        0,\n        \"Expect no remaining scan fragment\",\n    );\n    Some(fragment)\n}\n\npub(crate) fn assign_cdc_table_snapshot_splits(\n    actor_ids: HashSet<ActorId>,\n    splits: &[CdcTableSnapshotSplitRaw],\n    generation: u64,\n) -> MetaResult<HashMap<ActorId, PbCdcTableSnapshotSplits>> {\n    if actor_ids.is_empty() {\n        return Err(anyhow::anyhow!(\"Expect at least 1 actor, 0 was found.\").into());\n    }\n    if splits.is_empty() {\n        return Err(\n            anyhow::anyhow!(\"Expect at least 1 CDC table snapshot splits, 0 was found.\").into(),\n        );\n    }\n    let splits_per_actor = splits.len().div_ceil(actor_ids.len());\n    let mut assignments = HashMap::new();\n    for (actor_id, splits) in actor_ids.iter().copied().zip_eq_debug(\n        splits\n            .iter()\n            .map(build_cdc_table_snapshot_split)\n            .chunks(splits_per_actor)\n            .into_iter()\n            .map(|c| c.collect_vec())\n            .chain(iter::repeat(Vec::default()))\n            .take(actor_ids.len()),\n    ) {\n        assignments.insert(actor_id, PbCdcTableSnapshotSplits { splits, generation });\n    }\n    Ok(assignments)\n}","sourceCodeStart":181,"sourceCodeEnd":217,"githubUrl":"https://github.com/risingwavelabs/risingwave/blob/6469eb736d691e8e9b8a419a57edd6429ca77417/src/meta/src/stream/cdc.rs#L181-L217","documentation":"The mirror-side guard of assign_cdc_table_snapshot_splits: it rejects when the snapshot split list is empty, since there is nothing to distribute to the actors. Raised when reassign_splits reloads splits for a CDC table and finds zero pending snapshot splits despite actors being available.","triggerScenarios":"reassign_splits calls assign_cdc_table_snapshot_splits with a non-empty actor set but an empty slices of CdcTableSnapshotSplitRaw — e.g. all snapshot splits were already assigned/completed but a reschedule still requested snapshot reassignment, or the meta store returned no splits for the table.","commonSituations":"Backfill already finished when a recovery/scale event triggers reassignment; concurrent completion of splits by another meta operation; race between backfill completion and reschedule.","solutions":["Verify the CDC table's snapshot backfill state; if already complete, no snapshot reassignment is needed — the error is a benign race and can be retried/ignored.","Check the split rows for the job in the meta store; if splits were removed unexpectedly, restore from backup or recreate the CDC table.","Retry the operation; the scheduler should skip snapshot reassignment once backfill is finished.","If persistent with pending splits missing, recreate the CDC table's backfill."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"let pending: Vec<_> = load_splits_for_job(job_id).await?;\nlet snapshot_splits: Vec<_> = pending.into_iter().filter(|s| s.is_snapshot()).collect();\nif !snapshot_splits.is_empty() {\n    assign_cdc_table_snapshot_splits(actors, &snapshot_splits, generation)?;\n}","typeGuard":null,"tryCatchPattern":"match reassign_splits(job_id).await {\n    Err(e) if e.to_string().contains(\"Expect at least 1 CDC table snapshot splits\") => {\n        // snapshot backfill likely already completed; log and continue\n        tracing::debug!(%job_id, \"no snapshot splits left to assign\");\n    }\n    other => other?,\n}","preventionTips":["Check backfill completion state before reassigning snapshot splits.","Filter split lists to snapshot splits only before calling assignment.","Treat concurrent backfill-completion races as benign and retry."],"tags":["cdc","scheduling","backfill","splits"],"backgroundTag":"empty-required-field","analyzedSha":"6469eb736d691e8e9b8a419a57edd6429ca77417","analyzedAt":"2026-09-11T21:06:21.487Z","contentChangedAt":"2026-09-11T21:06:21.487Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}