H-A-772 (3) again-rows: hold the want's again on an unchanged move to its backup and its hold (issue 1984)
Review round 2 found two cases of H-A-772 (3) without a row: an interrupted backup whose want carries again, and a failed again backup of an unchanged move. - An interrupted backup, the want carrying again, the move unchanged: it says it is backed up again, takes one backup and is applied. - The want carrying again on an unchanged move whose backup fails: it is held, nothing is applied until the later answer, and nothing says the hold ends. Builds: design 47 H2 H-A-772 (1), (3)
This commit is contained in:
@@ -1060,18 +1060,26 @@ func testADataModuleIsBackedUpFirstAndHeldWhenItFails(t *testing.T) {
|
||||
detail string
|
||||
wait bool
|
||||
says, never string
|
||||
// fails is the words of a backup that fails ("" one that is done): the module is held before the later answer.
|
||||
fails string
|
||||
}{
|
||||
{"answered before the start", meshwants.WantsByWantNodeModuleValueBackupAgain, "", 1, false, false, "", false, "", ""},
|
||||
{"answered while held", "", meshwants.WantsByWantNodeModuleValueBackupAgain, 1, true, false, "", false, "", ""},
|
||||
{"skipped while held", "", meshwants.WantsByWantNodeModuleValueBackupSkip, 0, true, false, "", false, "", ""},
|
||||
{"held, its move unchanged", "", "", 0, false, true, "", false, "nats's hold for a failed backup", ""},
|
||||
{"again on an unchanged move", meshwants.WantsByWantNodeModuleValueBackupAgain, "", 1, false, true, "", false, "", ""},
|
||||
{"answered before the start", meshwants.WantsByWantNodeModuleValueBackupAgain, "", 1, false, false, "", false, "", "", ""},
|
||||
{"answered while held", "", meshwants.WantsByWantNodeModuleValueBackupAgain, 1, true, false, "", false, "", "", ""},
|
||||
{"skipped while held", "", meshwants.WantsByWantNodeModuleValueBackupSkip, 0, true, false, "", false, "", "", ""},
|
||||
{"held, its move unchanged", "", "", 0, false, true, "", false, "nats's hold for a failed backup", "", ""},
|
||||
{"again on an unchanged move", meshwants.WantsByWantNodeModuleValueBackupAgain, "", 1, false, true, "", false, "", "", ""},
|
||||
// H-A-772 (3): every line said names what happens; an interrupted backup of an unchanged move is applied with none.
|
||||
{"interrupted, its move unchanged", "", "", 0, false, true, BackupInterrupted, true,
|
||||
"judged unchanged: it is applied with no backup", "it is backed up again"},
|
||||
"judged unchanged: it is applied with no backup", "it is backed up again", ""},
|
||||
// H-A-772 (3): the end is of a failed backup's hold only; a revert's hold carries a wait and waits for the answer.
|
||||
{"a revert's hold, its move unchanged", "", meshwants.WantsByWantNodeModuleValueBackupSkip, 0, true, true,
|
||||
"restore point missing: nats's cache has none of form 1 taken before " + fp2, true, "", "nats's hold for a failed backup"},
|
||||
"restore point missing: nats's cache has none of form 1 taken before " + fp2, true, "", "nats's hold for a failed backup", ""},
|
||||
// H-A-772 (1), (3): the want's again backs up an unchanged move whose backup was interrupted, and says so.
|
||||
{"interrupted, again on an unchanged move", meshwants.WantsByWantNodeModuleValueBackupAgain, "", 1, false, true, BackupInterrupted, true,
|
||||
"it is backed up again", "applied with no backup", ""},
|
||||
// H-A-772 (3): a hold after a failed again stays until the operator answers again, whatever the judgement.
|
||||
{"a failed again on an unchanged move", meshwants.WantsByWantNodeModuleValueBackupAgain, meshwants.WantsByWantNodeModuleValueBackupSkip, 1, false, true,
|
||||
"", false, "", "nats's hold for a failed backup", "restic: the repository is locked"},
|
||||
} {
|
||||
t.Run(row.name, func(t *testing.T) {
|
||||
r := newBed(t)
|
||||
@@ -1108,8 +1116,22 @@ func testADataModuleIsBackedUpFirstAndHeldWhenItFails(t *testing.T) {
|
||||
held.Wait = &nodeengine.Wait{Owner: nodeengine.Seat, Step: nodeengine.WaitStepCompose, Reason: held.Detail, Words: held.Detail}
|
||||
}
|
||||
r.haves.stored = map[string]Have{"nats": held}
|
||||
if row.fails != "" {
|
||||
r.backup = func(string) Backup { return Backup{Words: row.fails} }
|
||||
}
|
||||
stopR := r.run()
|
||||
defer stopR()
|
||||
if row.fails != "" {
|
||||
eventually(t, "the failed backup did not hold the module", func() bool {
|
||||
h := r.haves.last("nats")
|
||||
return h.Phase == string(nodeengineclient.PhaseHeld) && h.Detail == row.fails
|
||||
})
|
||||
r.idle()
|
||||
if got := r.appliedList(); len(got) != 0 {
|
||||
t.Fatalf("applied behind the hold of a failed again with no later answer: %v", got)
|
||||
}
|
||||
r.wants.put(wk, selfWant(row.later))
|
||||
}
|
||||
if row.holdsTill {
|
||||
eventually(t, "the hold at the start is not said", func() bool {
|
||||
r.mu.Lock()
|
||||
|
||||
Reference in New Issue
Block a user