Skip to content

golive restore: refusal advice must name a mixed or copied-back WAL before restore gets a caller #244

Closed

Description

@scuttletoby

Follow-up to #228 (go-live kit copy + restore). Must be fixed before any command calls stopped_restore (the planned rehearse / back steps). Today restore has no caller, so nothing can hit these yet.

From the round-6 re-check lenses on #228 (lens228cr6 and lens228dr6 comments there, with failing probe tests):

  1. A WAL that holds the copy's frames plus later T3 frames is called "T3's: keep it, remove the record". Restore stops after the WAL rename, a T3 runs on the half-way home and writes to the copy's WAL, then the owner puts the kept files back by hand. The SHA no longer matches the copy's, so the advice says keep it; the home then opens with the copy's rows plus T3's, not the old home's, and the first checkpoint overwrites the old pages. Fix: if the home WAL's header (salts, first 32 bytes) or the copy's whole WAL as a prefix matches, call it the copy's ("remove it; T3's commits on the copy's database are lost"); for any other mismatch do not claim it is T3's: list both and say to compare row counts on scratch copies.
  2. A put-back done by copying (not moving) is never checked (if not gone: return mark, False). The copy's WAL is never named, and removing the record as the copy refusal says leaves old db + copy's WAL (fewer rows, no error). Fix: when every kept file is byte-equal to its home file, run the same foreign/stale checks.
  3. When the record's copy is unreadable (pruned, restore from another copy), the lost-kept-file check is skipped and a deleted kept -wal becomes staleRecord. Safer: when the copy cannot be read and a kept file is gone, refuse.
  4. The "cannot be told" advice has no way out if the copy folder is gone: name the fallback ("run the restore again, it keeps everything", or open both on scratch copies and compare).

Each fix needs a test that fails on the #228 head (the lens probes are a start), plus the state question (runs again, stops half-way, old/empty state).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions