R-1340 second producer: a restore_mixed hold's Why() names the cause from its record (found live on rc.1: the hub's Held apps line said off-site/database for a local restore with no database) — test red first
gates / gates (push) Successful in 30s
gates / gates (push) Successful in 30s
This commit is contained in:
1 parent
6077ac0083
commit
99fac06aa7
4 files changed
+80
-2
No files matched your search
@@ -2051,7 +2051,7 @@ func (h RestoreHold) Why() string {
|
||||
}
|
||||
return "stopped by the box for a " + strings.ReplaceAll(kind, "_", " ") + " (" + h.At + ") — the household's Start gives it one more try"
|
||||
case HoldReasonRestoreMixed:
|
||||
return "held after an off-site restore failed its database replay (" + h.At + ") — clear the hold to start it"
|
||||
return h.mixedWhy() + " (" + h.At + ") — clear the hold to start it"
|
||||
case HoldReasonPutBackPending:
|
||||
return "held until the pre-restore copy is poured back (" + h.At + ") — the put-back starts it"
|
||||
default:
|
||||
@@ -2059,6 +2059,36 @@ func (h RestoreHold) Why() string {
|
||||
}
|
||||
}
|
||||
|
||||
// mixedWhy (R-1340) names a restore_mixed hold from what its record carries — never „database" or „off-site" unless the
|
||||
// record says so. A record written before these fields („legacy") gets the neutral sentence. Pinned by
|
||||
// TestR1340_WhyNamesTheMixedCause.
|
||||
func (h RestoreHold) mixedWhy() string {
|
||||
kind := "a restore"
|
||||
switch h.RestoreKind {
|
||||
case RestoreKindOffsite:
|
||||
kind = "an off-site restore"
|
||||
case RestoreKindLocal:
|
||||
kind = "a local restore"
|
||||
}
|
||||
switch h.MixedCause {
|
||||
case MixedCauseDefinitionWrite:
|
||||
return "held after " + kind + " could not write its definition and writing the live definition back failed too"
|
||||
case MixedCauseInterruptedPutBack:
|
||||
return "held after a restore was interrupted and its live data could not be put back at the next start"
|
||||
case MixedCausePutBack:
|
||||
what := "failed"
|
||||
if h.DBReplay {
|
||||
what = "failed its database replay"
|
||||
}
|
||||
s := "held after " + kind + " " + what + " and putting the live data back failed"
|
||||
if h.FailedStep != "" {
|
||||
s += " (" + h.FailedStep + ")"
|
||||
}
|
||||
return s
|
||||
}
|
||||
return "held after a restore stopped half-way"
|
||||
}
|
||||
|
||||
// SetRestoreHold records a hold. Modelled on SetDisconnected: a condition, plus what it is holding.
|
||||
func (s *Settings) SetRestoreHold(h RestoreHold) error {
|
||||
s.mu.Lock()
|
||||
|
||||
Reference in new issue
Block a user