Skip to content

A restore finished at startup publishes without rechecking replication peers #4043

Open

Description

@cb1kenobi

Problem

A restore that committed its receipt and then crashed is finished at the next startup (finishCommittedRestoresBeforeStartup and recoverRestoresAtStartup in dataLayer/restorePublication.ts). That path clears the marker and publishes the restored database under the target's restore lock only. Unlike publishRestore, it does not take the replication membership fence or recheck assertNoReplicationPeers.

So a node that gained a peer between the crash and the restart, for example a replication.routes entry added to the config file while Harper was down, publishes the restored database anyway. Replication then either undoes the restore or spreads it to the peer, which is the outcome the peer refusal in #3920 exists to prevent.

Impact

  • Needs a crash in the narrow window between committing the receipt and publishing, plus a peer added before the restart.
  • The restored data itself is sound (the restore proved it before committing); what escapes is the membership check.

Options

  • Recheck peers before finishing a committed receipt at startup, and leave the database blocked with a clear error when a peer appeared. The cost is a startup that refuses to publish a proven restore until the operator removes the peer or reruns the restore.
  • Keep publishing, and log a warning naming the peer.

Deferred from the pre-merge review of #3920.

Review-Deferral: adeec5a928222bb2 severity=minor category=data-integrity

🤖 Generated by Claude Opus 5.5; posted via @cb1kenobi.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Fields

    Priority

    P3

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions