row 185 (#1683): every activate backs up the stopped store
stack-release.sh activate now backs up the stopped store under its activation id on every run
with a store file, before any migration. Before this, backup_store ran only when the schemas
differed, so a same-schema activate took no backup and rollback --restore had nothing to name.
store-newer and migration-needs-flag still roll back before the backup, since those runs never
touch the store, and a missing store takes no backup.
BACKUP and TAKEN now mean two things. BACKUP is set by every backup, so the log line names it and
from_log backup finds it. TAKEN is set only right before a migration, so a gate failure after a
same-schema activate puts back the units and the wrapper and leaves the store as the failed run
left it. activate --plan prints a backup line, or "backup: none" with no store file. Rollback and
pm-on are unchanged; a same-schema rollback --restore already works through the row 181 guard.
docs/TOOLS.md "Pinned stack update" steps 5-7 say so.
stack-release.test.mjs updates T5, T11, T26 and T29 and adds T47-T51, with one fixture fault
(start-writes-row-<copy>). The three brief mutants are killed, and Filbert's two more (the backup
ahead of the schema checks, the plan line on a rollback) are killed by T6, T9 and T50.
This is the precondition for mos-0928 Part A, the re-pin from 89af38a83.
Filbert approved round 1 in #1683 comment 29404, with two non-blocking notes.
This commit is contained in:
1 parent
6c88bc666f
commit
490e2771d3
3 files changed
+121
-16
No files matched your search
@@ -345,7 +345,8 @@ sums() { (cd "$1" && find . -type f ! -name SHA256SUMS ! -name steps.log -print0
|
||||
sum_of() { awk -v f="./$2" '$2 == f { print $1 }' "$1/SHA256SUMS"; }
|
||||
|
||||
# The backup of the stopped store (backup.sh's steps). Only bus.sqlite: a -wal or -shm was
|
||||
# already refused as store-unclean. Sets TAKEN once the backup is whole.
|
||||
# already refused as store-unclean. Every activate with a store takes one (row 185). Sets BACKUP
|
||||
# once the backup is whole, for the log line; TAKEN is set by the caller only before a migration.
|
||||
backup_store() {
|
||||
local o="$DATA/backups/stack/$ACT"
|
||||
(
|
||||
@@ -364,7 +365,7 @@ backup_store() {
|
||||
echo "$RS" > "$o/ROLLBACK_SET"
|
||||
) || return 1
|
||||
stopped || return 1
|
||||
TAKEN="$ACT" BACKUP="$ACT"
|
||||
BACKUP="$ACT"
|
||||
say "backup: $o"
|
||||
}
|
||||
|
||||
@@ -533,7 +534,8 @@ put_back() {
|
||||
}
|
||||
|
||||
# A failure after step 2: put the pointer's stack back and gate it. $1 is the run's code. Only a
|
||||
# backup this run took (TAKEN) is restored; a rollback's --restore backup never is.
|
||||
# backup this run took before a migration (TAKEN) is restored; a same-schema activate's backup
|
||||
# and a rollback's --restore backup never are.
|
||||
rollback_in_run() {
|
||||
trap - INT TERM HUP
|
||||
local code="$1" rcode=""
|
||||
@@ -809,6 +811,13 @@ plan() {
|
||||
else
|
||||
echo "restore: the store must go back to $T_SCHEMA; needs --restore $(from_log backup || echo ACTIVATION)"
|
||||
fi
|
||||
if [ "$OP" != activate ]; then
|
||||
: # rollback takes no backup of its own
|
||||
elif [ -e "$STORE" ]; then
|
||||
echo "backup: the run backs up the stopped store to $DATA/backups/stack/<activation>/ before any migration"
|
||||
else
|
||||
echo "backup: none; there is no store file"
|
||||
fi
|
||||
plan_commits
|
||||
[ "$P_PENDING" = 0 ] || echo "pm: the pointer is pending (activate --pm-after-harness); the bus runs without its PM"
|
||||
[ "$RUN_PENDING" = 0 ] || echo "pm: the bus starts without --pm and the PM stays pending; next: Jason's plugins set of harness, then pm-on"
|
||||
@@ -836,7 +845,10 @@ run_steps() {
|
||||
if [ "$STORE_SCHEMA" != "$T_SCHEMA" ]; then
|
||||
in_chain "$STORE_SCHEMA" || rollback_in_run store-newer
|
||||
[ "$MIGRATE" = 1 ] || rollback_in_run migration-needs-flag
|
||||
backup_store || rollback_in_run backup
|
||||
fi
|
||||
backup_store || rollback_in_run backup
|
||||
if [ "$STORE_SCHEMA" != "$T_SCHEMA" ]; then
|
||||
TAKEN="$ACT"
|
||||
node "$COPIES/$TO/packages/bus/src/migrate-schema.mjs" "$DATA" >> "$STEPS" 2>&1 || rollback_in_run migrate-failed
|
||||
say "migrated the store to $T_SCHEMA"
|
||||
fi
|
||||
|
||||
Reference in new issue
Block a user