Node-engine: judge a move's data forms from the entry kept of the running build; no endless handing again
The running build's entry stays held (kept in the composition state) while the node runs it, though the catalog half dropped it; the agent no longer tells the composer it waits for a composition it holds, and the composer hands again when the entry answers. Builds: design 47 G §296, §297, A-113, §614
This commit is contained in:
@@ -239,9 +239,9 @@ func (a *Agent) keptStep(ctx context.Context, module string, w wantNow, comp com
|
||||
since := r.now()
|
||||
a.writeHave(ctx, Have{Module: module, FP: prev.Fp, Composed: prev.Composed, Phase: string(nodeengineclient.PhaseHeld), Detail: words,
|
||||
Wait: &nodeengine.Wait{Owner: nodeengine.Seat, Step: nodeengine.WaitStepCompose, Reason: "entry-missing", Since: since, Words: words}})
|
||||
if a.env.Waiting != nil {
|
||||
a.env.Waiting(module, fp)
|
||||
}
|
||||
// The composition of the want is held: the wait is for an entry, not for a composition, so the composer is not told it
|
||||
// is waited for (that handed the same composition again every pass, and the move failed the same way again); it
|
||||
// hands the composition again when the entry answers (Composer.entryChanged).
|
||||
return true, nil
|
||||
}
|
||||
take, restore := keptMoves(changes, prev.Fp, fp)
|
||||
|
||||
@@ -30,6 +30,7 @@ type recoveryFake struct {
|
||||
catchUp []meshrecovery.CatchUp
|
||||
expired chan struct{}
|
||||
unknown error // FormChanges answers it
|
||||
waited int // times the agent told the composer it waits for a composition
|
||||
}
|
||||
|
||||
type fakeAnswer struct {
|
||||
@@ -110,6 +111,7 @@ func moveDB(t *testing.T, f *recoveryFake, ranFrom, to string, settle func(b *be
|
||||
}
|
||||
f.events, f.expired = make(chan Ending, 16), make(chan struct{})
|
||||
b.env.Recovery = f.env()
|
||||
b.env.Waiting = func(string, string) { f.mu.Lock(); f.waited++; f.mu.Unlock() }
|
||||
b.env.Stop = func(context.Context, string) Result {
|
||||
f.mu.Lock()
|
||||
f.calls = append(f.calls, "stop")
|
||||
@@ -289,6 +291,11 @@ func testAMoveAcrossAFormChange(t *testing.T) {
|
||||
t.Run("a form change not known moves nothing and waits for the entries (A-113)", func(t *testing.T) {
|
||||
f := &recoveryFake{unknown: fmt.Errorf("the entry is asked")}
|
||||
b := moveDB(t, f, "a", "b", heldHave)
|
||||
f.mu.Lock()
|
||||
if f.waited != 0 {
|
||||
t.Errorf("the composer was told the agent waits for a composition %d times; it waits for an entry and holds the composition", f.waited)
|
||||
}
|
||||
f.mu.Unlock()
|
||||
if h := b.haves.last("db"); h.FP != fp("a") || !contains(h.Detail, "is not known") || h.Wait == nil || h.Wait.Reason != "entry-missing" {
|
||||
t.Fatalf("the have %+v", h)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user