Repository navigation
Closed
Labels
bugSomething isn't working
Description
Problem or outcome
Found by the #97 clean-room restore drill against the published v0.1.0 release. The same code is on main at e8f4e42.
docs/install.md says that when the server's disk is gone, you "install on a new machine with the same --backup-dir, stop the service, and restore the newest file from the copy directory". Followed literally, that restores an empty database.
- The new installation starts with the copy directory configured. Its scheduler finds no local snapshot, snapshots the new empty database, and
catch_upcopies it into the share asconsolebook-<now>.db. That file is now the newest one there. - "Restore the newest file" restores that empty copy. Sign-in with the old accounts fails, and the records are missing.
Recorded run, with the same release on both hosts and the copy directory on another filesystem:
host A copies: consolebook-20261015T003221Z.db consolebook-20261015T003222Z.db (records)
host B starts: automatic backup complete ... consolebook-20261015T003223Z.db size_bytes=552960
backup copied off the server and verified copy=.../consolebook-20261015T003223Z.db
restore newest: restored .../consolebook-20261015T003223Z.db (installation 5ffe5235-…) <- host B's own empty install
collect: POST /api/auth/login: 401 invalid_credentials
The same path does further harm:
- After a restore,
catch_upcopies the newest local snapshot, which is now theconsolebook-prerestore-<stamp>.dbof the database just replaced (here, the empty one). The share's newest file is again not this installation's data. - A new server left running before anyone restores adds one empty copy per backup interval. With the default 14 copies kept, it prunes every real copy within 14 days.
- Two installations pointed at one share prune each other's copies.
Scope
- A copy directory holds one installation's backups.
copy_snapshotrefuses a snapshot whose installation id differs from the id in the share's newest existing copy. Both ids are read from the files, read-only andimmutable, so nothing is written to the share. This works for copy directories written by 0.1.0, which carry no marker.- The refusal says what to do: restore the newest copy if this server replaces that installation, otherwise give this installation its own directory.
- Copies carry only this installation's backups.
catch_up, and the "current" status indoctor,/api/backups/statusand the home page, consider only scheduledconsolebook-<stamp>.dbsnapshots, neverprerestoreorpremigrationones.- The pre-migration copy keeps its explicit path (feat: take a validated backup before an upgrade migrates the database #106).
docs/install.md: the replacement-server procedure says the new installation refuses to copy until you restore, and says which copy to restore.
Acceptance criteria
- Integration tests:
- a new installation whose share holds another installation's copies refuses to copy, writes nothing there, and reports why;
- after restoring one of those copies, copying resumes;
- a
prerestoresnapshot is never copied, and does not make the statusbehind.
- The recovery: clean-room restore drill from a release install #97 drill, run with the fixed build as host B against a share written by v0.1.0 host A and following the guide literally, restores the records with identical record and chain hashes.
Execution record
- Authority: found by the integrator while running recovery: clean-room restore drill from a release install #97, under the maintainer's standing authority to work these issues end to end.
Related
Metadata
Metadata
Assignees
Labels
bugSomething isn't working
Activity
docs: restore drill from a lost server to verified records (#121)