{"record":{"id":"ed79f0780a37886c","repo":"risingwavelabs/risingwave","slug":"replace-sink-must-not-use-snapshot-backfill","errorCode":null,"errorMessage":"replace sink must not use snapshot backfill","messagePattern":"replace sink must not use snapshot backfill","errorType":"validation","errorClass":"MetaError","httpStatus":null,"severity":"error","filePath":"src/meta/src/barrier/checkpoint/state.rs","lineNumber":910,"sourceCode":"                let resolved_split_assignment = resolve_source_splits(\n                    &info,\n                    &actors,\n                    edges.actor_new_no_shuffle(),\n                    &self.database_info,\n                )?;\n\n                let old_sink_job_id = info\n                    .replace_sink\n                    .as_ref()\n                    .map(|old_sink_id| old_sink_id.as_job_id());\n                if old_sink_job_id.is_some()\n                    && matches!(\n                        job_type,\n                        CreateStreamingJobType::SnapshotBackfill { .. }\n                            | CreateStreamingJobType::BatchRefresh(_)\n                    )\n                {\n                    bail!(\"replace sink must not use snapshot backfill\");\n                }\n\n                // Pre-apply: add new job and fragments\n                let cdc_tracker = if let Some(splits) = &info.cdc_table_snapshot_splits {\n                    let (fragment, _) =\n                        parallel_cdc_table_backfill_fragment(info.stream_job_fragments.fragments())\n                            .expect(\"should have parallel cdc fragment\");\n                    Some(CdcTableBackfillTracker::new(\n                        fragment.fragment_id,\n                        splits.clone(),\n                    ))\n                } else {\n                    None\n                };\n                self.database_info\n                    .pre_apply_new_job(info.streaming_job.id(), cdc_tracker);\n                self.database_info.pre_apply_new_fragments(\n                    info.stream_job_fragments","sourceCodeStart":892,"sourceCodeEnd":928,"githubUrl":"https://github.com/risingwavelabs/risingwave/blob/6469eb736d691e8e9b8a419a57edd6429ca77417/src/meta/src/barrier/checkpoint/state.rs#L892-L928","documentation":"A sink replace (ReplaceSink) command attempted to replace an existing sink using a job type of SnapshotBackfill or BatchRefresh, which is unsupported for replacement. Sink replacement must be a plain sink job, so the applier bails out.","triggerScenarios":"Applying a replace-sink command via handle_new_barrier where the new job's CreateStreamingJobType is SnapshotBackfill or BatchRefresh.","commonSituations":"User tries to recreate a sink with a backfill/snapshot clause while an existing sink is being replaced; tooling or migration scripts generate replace commands with backfill options.","solutions":["Replace the sink without snapshot backfill/batch refresh job type","Drop the old sink and create the new one as a fresh job instead","Remove backfill options from the replace statement"],"exampleFix":"-- before: replace with backfill\nALTER SINK s AS ... WITH BACKFILL;\n-- after\nDROP SINK s;\nCREATE SINK s AS ... WITH BACKFILL;","handlingStrategy":"validation","validationCode":"if is_replace_sink(job) && matches!(job.job_type, SnapshotBackfill{..} | BatchRefresh(_)) {\n    return Err(\"use DROP+CREATE for backfill sinks\");\n}","typeGuard":"fn replace_allows_backfill(jt: &CreateStreamingJobType) -> bool {\n    !matches!(jt, CreateStreamingJobType::SnapshotBackfill{..} | CreateStreamingJobType::BatchRefresh(_))\n}","tryCatchPattern":null,"preventionTips":["Never attach backfill options to replace-sink statements","Use DROP + CREATE when backfill is needed for a sink","Validate job type client-side before submitting replace"],"tags":["meta","barrier","sink","unsupported-operation"],"backgroundTag":"unsupported-operation","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"}