{"record":{"id":"400000407234499c","repo":"risingwavelabs/risingwave","slug":"since-timestamp-is-earlier-than-the-retained-chang","errorCode":null,"errorMessage":"since_timestamp is earlier than the retained changelog of upstream table {}: requested epoch {}, first retained checkpoint epoch {}","messagePattern":"since_timestamp is earlier than the retained changelog of upstream table (.+?): requested epoch (.+?), first retained checkpoint epoch (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/meta/src/barrier/context/context_impl.rs","lineNumber":78,"sourceCode":"    upstream_committed_epoch: u64,\n    table_change_log: &TableChangeLogs,\n) -> MetaResult<SinceTimestampResolvedEpoch> {\n    let change_log = table_change_log.get(&table_id).ok_or_else(|| {\n        anyhow::anyhow!(\n            \"no table changelog found for upstream table {} when resolving since_timestamp\",\n            table_id\n        )\n    })?;\n    let Some(first_log) = change_log.first() else {\n        return Err(anyhow::anyhow!(\n            \"empty table changelog found for upstream table {} when resolving since_timestamp\",\n            table_id\n        )\n        .into());\n    };\n    let first_checkpoint_epoch = first_log.checkpoint_epoch;\n    if since_epoch < first_checkpoint_epoch {\n        return Err(anyhow::anyhow!(\n            \"since_timestamp is earlier than the retained changelog of upstream table {}: requested epoch {}, first retained checkpoint epoch {}\",\n            table_id,\n            since_epoch,\n            first_checkpoint_epoch,\n        )\n        .into());\n    }\n    if since_epoch >= upstream_committed_epoch {\n        return Err(anyhow::anyhow!(\n            \"since_timestamp is not before the committed epoch of upstream table {}: requested epoch {}, committed epoch {}\",\n            table_id,\n            since_epoch,\n            upstream_committed_epoch,\n        )\n        .into());\n    }\n    let latest_log = change_log.last().expect(\"checked non-empty\");\n    if upstream_committed_epoch != latest_log.checkpoint_epoch {","sourceCodeStart":60,"sourceCodeEnd":96,"githubUrl":"https://github.com/risingwavelabs/risingwave/blob/6469eb736d691e8e9b8a419a57edd6429ca77417/src/meta/src/barrier/context/context_impl.rs#L60-L96","documentation":"The requested since_timestamp epoch is older than the earliest checkpoint epoch still retained in the upstream table's changelog. The required history has been trimmed, so a snapshot at that epoch cannot be produced.","triggerScenarios":"resolve_since_timestamp_log_store_epoch with since_epoch < first_log.checkpoint_epoch — e.g. backfilling from an MV whose old changelogs have been trimmed by retention policies.","commonSituations":"Slow snapshot backfill created long after upstream data history aged out; short changelog retention in log store; replaying an old DDL script against aged data.","solutions":["Re-create the snapshot backfill with a more recent since_timestamp","Increase upstream changelog/log-store retention","If full history is needed, rebuild the upstream MV or use a full refresh instead of timestamp backfill"],"exampleFix":"-- before\nCREATE ... FROM mv WITH (SNC_TIMESTAMP = 'very old timestamp');\n-- after: use a recent timestamp within retained changelog\nCREATE ... FROM mv WITH (SNC_TIMESTAMP = now - interval '1 hour');","handlingStrategy":"validation","validationCode":"if since_epoch < first_retained_checkpoint_epoch {\n    return Err(\"since_timestamp older than retained changelog; increase retention or use newer timestamp\");\n}","typeGuard":"fn within_retained_range(since: u64, first: u64, committed: u64) -> bool {\n    since >= first && since < committed\n}","tryCatchPattern":"match create_snapshot_backfill(...).await {\n    Err(e) if e.contains(\"earlier than the retained changelog\") => pick_newer_since_timestamp(),\n    other => other,\n}","preventionTips":["Pick since_timestamps within changelog retention","Increase log-store retention for long-lived history needs","Prefer full rebuild when old history is required"],"tags":["meta","barrier","changelog","retention","since-timestamp"],"backgroundTag":"value-out-of-range","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"}