mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-11 21:26:44 +00:00
A backup generation stores databases as sql dumps, not as a file tree (--dump-only-sql), and the recover chain only ever restored trees: `git grep sql HEAD -- cli/administration/recover utils/recovery` was empty. An operator running `recover full` after a real loss got their files back, their databases untouched, and an exit code of 0. Adds the missing leg as a fifth recoverer, planned right after the volume steps so the dumps land once the volumes are back. Three properties make it a restore rather than an attempt: - It refuses while a consumer of that database runs. `--empty` pre-cleans the schema in one psql session and replays in the next; a booting consumer recreates it in between and the dump's own CREATE TABLE fails. That is what turned CI red with `relation "ar_internal_metadata" already exists`. - The engine is read, not guessed: the service key in the consuming role's meta/services.yml, the same value that fed the backup seed. The two previous call sites each sniffed it from the container image and could disagree. - The dump's own header states which server it came out of, and that is compared against the running engine before the pre-clean drops anything. Forward across a major version is the upgrade path and stays allowed; backward is refused. The version deliberately does not travel in databases.csv: that file is written at seed time and would state the version deployed back then, and a generation copied to another host carries its header along while a csv row stays behind. Mind the header formats, they are not symmetric - postgres puts `Dumped from database version` on line 7, while mariadb's line 2 opens with mariadb-dump's own version and only the tab-separated `Server version` line names the server. Both are pinned as test fixtures, captured from postgres:17-alpine and mariadb:11 themselves. baudolo is untouched: nothing beyond the credentials it already carries is read from databases.csv, and no upstream format changes. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>