Skip to content

Trust restore stamp when source is unresolvable - #1

Open
kw1knode wants to merge 1 commit into
mainfrom
trust-stamp-on-rotated-source
Open

Trust restore stamp when source is unresolvable#1
kw1knode wants to merge 1 commit into
mainfrom
trust-stamp-on-rotated-source

Conversation

@kw1knode

Copy link
Copy Markdown
Contributor

Problem

A completed restore writes .stream-download.stamp, but two things could still invalidate it and send restarts into target is non-empty; set WIPE_EXISTING=true to replace (crash-looping the pod):

  1. Snapshot rotation. Providers (e.g. Base) delete old snapshot objects. On restart the HTTP resolve 404s, the error is silently swallowed for HTTP sources, and the resulting empty SnapshotID no longer matches the stored etag:... — so a node that restored successfully days ago suddenly demands a wipe. Observed in production on base-mainnet-rpc-1 after Base rotated base-mainnet-reth-1782614844.tar.zst.
  2. Image upgrades. ToolVersion was part of the exact stamp equality, so any version bump invalidated every existing stamp the same way.

Fix

  • If the source can no longer be resolved (empty identity) but a stamp exists matching the same source, target, checksum, and compression, log restore_already_complete and exit 0 instead of falling through to a fresh restore.
  • Drop ToolVersion from the StampMatches comparison (still recorded in the stamp file for info).

Tests

  • TestRunTrustsStampWhenSourceRotated: restore succeeds, server starts returning 404, second run no-ops and leaves data intact.
  • TestRunSkipsRestoreAcrossToolVersions: second run with a bumped toolVersion no-ops.

🤖 Generated with Claude Code

Snapshot providers rotate old objects out of their buckets. A failed
HTTP resolve produced an empty snapshot identity that invalidated an
otherwise-valid stamp, sending the restore path into the non-empty
target error on every pod restart.

- Skip the restore when a stamp matches the same source, target,
  checksum, and compression but the source can no longer be resolved.
- Stop comparing ToolVersion in StampMatches so image upgrades don't
  invalidate existing stamps.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant