diff --git a/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/integration_test.go b/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/integration_test.go index 1c6e113b..1a1372a8 100644 --- a/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/integration_test.go +++ b/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/integration_test.go @@ -1203,7 +1203,19 @@ func TestABackupAnswerIsWrittenIntoTheNodesWant(t *testing.T) { if w1.Fp != fNew || w1.Composed != "" || !w1.Self { t.Errorf("the want = %+v", w1) } - // the node retries and the backup fails again: a new have value, asked again under the next number + // the node retries: its have is backing up, not held. The ask stands and its condition is not cleared (A-453a). + backing, _ := nodeengineclient.EncodeHave(nodeengine.HaveByNodeModuleValue{Fp: fNew, Phase: nodeengineclient.PhaseBackingUp, Health: nodeengineclient.HealthWaits}) + b.putJSON(t, buckets.Have, "ace.web", backing) + time.Sleep(time.Second) + if !b.hasKey(buckets.Asks(), akey) { + t.Fatal("the backup ask was taken away while the node backs up again") + } + for k, c := range b.conditionsSaid(t) { + if strings.Contains(k, "backup") && c.State == occ.StateCleared { + t.Fatalf("the condition %s was cleared while the node backs up again", k) + } + } + // the backup fails again: a new have value, asked again under the next number again, _ := nodeengineclient.EncodeHave(nodeengine.HaveByNodeModuleValue{Fp: fNew, Phase: nodeengineclient.PhaseHeld, Health: nodeengineclient.HealthWaits, Detail: "no space left, again"}) b.putJSON(t, buckets.Have, "ace.web", again) a2 := b.askNow(t, akey, 2) diff --git a/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/pass.go b/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/pass.go index a4d4c72b..9b9d88af 100644 --- a/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/pass.go +++ b/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/pass.go @@ -845,8 +845,10 @@ func (p *passer) staleAsk(key string, trunk map[string]meshcatalog.ModulesByModu if hkey, err := nodeengineclient.HaveKey(k.Node, k.Module); err == nil { if raw := p.w.value(buckets.Have, hkey); raw != nil { if h, err := nodeengineclient.DecodeHave(raw); err == nil { - if h.Phase != nodeengineclient.PhaseHeld { - return "its module's have on " + k.Node + " is no longer held" + // Past the hold is running, removed or another fingerprint; a have mid-move (backing up again after an answer, + // applying, checking) is not (design 47 G A-453a): the ask stays, and asks again under the next number. + if h.Phase == nodeengineclient.PhaseRunning || h.Phase == nodeengineclient.PhaseRemoved || h.Fp != k.FP { + return "its module's have on " + k.Node + " has moved past the hold" } if h.Wait != nil { return "its module's have on " + k.Node + " carries a wait (" + h.Wait.Reason + "), not a failed backup" diff --git a/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/pass_test.go b/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/pass_test.go index c34e6716..4062499e 100644 --- a/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/pass_test.go +++ b/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/pass_test.go @@ -171,7 +171,9 @@ func TestAHoldAskedAgainAfterALiftAndARestartHasANewID(t *testing.T) { {"its have is held with no wait", &mwc.Want{Fp: fpTest, Self: true}, &nodeengine.HaveByNodeModuleValue{Fp: fpTest, Phase: nodeengineclient.PhaseHeld, Health: nodeengineclient.HealthWaits}, false}, {"its have is held with a wait", &mwc.Want{Fp: fpTest, Self: true}, &nodeengine.HaveByNodeModuleValue{Fp: fpTest, Phase: nodeengineclient.PhaseHeld, Health: nodeengineclient.HealthWaits, Wait: &nodeengine.Wait{Step: nodeengine.WaitStepCompose, Reason: "entry-missing", Since: now}}, true}, - {"its have is no longer held", &mwc.Want{Fp: fpTest, Self: true}, &nodeengine.HaveByNodeModuleValue{Fp: fpTest, Phase: nodeengineclient.PhaseRunning, Health: nodeengineclient.HealthOK}, true}, + {"its have runs", &mwc.Want{Fp: fpTest, Self: true}, &nodeengine.HaveByNodeModuleValue{Fp: fpTest, Phase: nodeengineclient.PhaseRunning, Health: nodeengineclient.HealthOK}, true}, + {"its have backs up again (A-453a)", &mwc.Want{Fp: fpTest, Self: true}, &nodeengine.HaveByNodeModuleValue{Fp: fpTest, Phase: nodeengineclient.PhaseBackingUp, Health: nodeengineclient.HealthWaits}, false}, + {"its have is at another fingerprint", &mwc.Want{Fp: fpTest, Self: true}, &nodeengine.HaveByNodeModuleValue{Fp: fpOther, Phase: nodeengineclient.PhaseHeld, Health: nodeengineclient.HealthWaits}, true}, } { t.Run("ended backup ask: "+c.name, func(t *testing.T) { bkv := &memKV{values: map[string][]byte{}} @@ -1041,7 +1043,7 @@ func TestAsksOfAFingerprintTheTrunkLeftBehindAreTakenAway(t *testing.T) { {"the trunk moved on", trunkOf(fpNew), []string{holdOld, holdGone, restOld, recOld}, false, nil}, {"the backup's want names another fingerprint", trunkOf(fpNew), []string{holdOld, holdGone, restOld, recOld, backOld}, false, &mwc.Want{Fp: fpNew, Self: true}}, {"the backup's want is removed", trunkOf(fpNew), []string{holdOld, holdGone, restOld, recOld, backOld}, false, &mwc.Want{Removed: true}}, - {"the backup's want names the fingerprint in another composition (its have waits for a yes, not held: A-453)", trunkOf(fpNew), []string{holdOld, holdGone, restOld, recOld, backOld}, false, &mwc.Want{Fp: fpOld, Composed: digNew}}, + {"the backup's want names the fingerprint in another composition (its have waits for a yes: a mid-move have is not past the hold, A-453a)", trunkOf(fpNew), []string{holdOld, holdGone, restOld, recOld}, false, &mwc.Want{Fp: fpOld, Composed: digNew}}, {"the trunk is at the old fingerprint", trunkOf(fpOld), []string{holdNew, holdGone, restNew, recOld}, false, nil}, {"the trunk's fingerprint is not read yet", trunkOf(""), []string{holdGone}, false, nil}, {"the composition is not read yet", trunkOf(fpNew), []string{holdOld, holdGone, restOld}, true, nil},