A moved mover leaves an older waiting pipeline whenever a newer one starts (H-A-244)
Only a newer pipeline that waited took movers out of older waiting ones; one placed at once left them, so main.84 was placed nine hours later with a mover a newer revision had moved and built a stale fingerprint. Builds: design 47 H H-A-223, H-A-244 (1)
This commit is contained in:
@@ -176,6 +176,52 @@ func TestThePipelinesWaitTheirTurn(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// H-A-244 (1), H-A-223: a mover a newer revision moves leaves an older waiting pipeline also when the newer one is placed at
|
||||
// once, not only when it waits: the waiting pipeline keeps the movers still its own, and with none left ends superseded,
|
||||
// never placed.
|
||||
func TestANewerPlacedPipelineSupersedesAnOlderWaitingOne(t *testing.T) {
|
||||
s, mem, q, said, _, _, view, _ := queueFixture()
|
||||
take := takeIn(t, s, view)
|
||||
take(4, "app")
|
||||
take(5, "lib", "tool")
|
||||
if p, _, _ := mem.Get("main.5"); p.Outcome != seat.PipelineOutcomeWaiting {
|
||||
t.Fatalf("main.5 = %s, want waiting", p.Outcome)
|
||||
}
|
||||
s.Queue.AtOnce = 3
|
||||
take(6, "lib")
|
||||
if p, _, _ := mem.Get("main.6"); p.Outcome != seat.PipelineOutcomeRunning {
|
||||
t.Fatalf("main.6 = %s, want placed at once", p.Outcome)
|
||||
}
|
||||
p5, _, _ := mem.Get("main.5")
|
||||
if p5.Outcome != seat.PipelineOutcomeWaiting || len(p5.Movers) != 1 || p5.Movers[0].Module != "tool" || !slices.Equal(p5.Superseded, []string{"lib"}) {
|
||||
t.Fatalf("main.5 = %s moving %+v, superseded %v; want waiting with tool alone, lib superseded", p5.Outcome, p5.Movers, p5.Superseded)
|
||||
}
|
||||
// At its turn it is placed with tool alone.
|
||||
p4, rev, _ := mem.Get("main.4")
|
||||
p4.Outcome = seat.PipelineOutcomePassed
|
||||
mem.Update("main.4", p4, rev)
|
||||
if _, err := s.Turn("main.4", view); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if p, _, _ := mem.Get("main.5"); p.Outcome != seat.PipelineOutcomeRunning || len(stepsOf(p, "lib")) != 0 || len(stepsOf(p, "tool")) == 0 {
|
||||
t.Fatalf("main.5 at its turn = %s with steps %+v, want running with tool's steps alone", p.Outcome, p.Steps)
|
||||
}
|
||||
|
||||
// A waiting pipeline whose one mover a newer placed pipeline moves ends superseded, never placed.
|
||||
s, mem, q, said, _, _, view, _ = queueFixture()
|
||||
take = takeIn(t, s, view)
|
||||
take(4, "app")
|
||||
take(5, "tool")
|
||||
s.Queue.AtOnce = 3
|
||||
take(7, "tool")
|
||||
if p, _, _ := mem.Get("main.5"); p.Outcome != seat.PipelineOutcomeSuperseded || len(p.Steps) != 0 || p.Ended == nil {
|
||||
t.Errorf("main.5 = %s with %d steps, want superseded and never placed", p.Outcome, len(p.Steps))
|
||||
}
|
||||
if _, ok := q["waiting.00000000000000000001"]; ok || !slices.Contains(*said, "pipeline-ended.main.5") {
|
||||
t.Errorf("the queue %v, said %v; want main.5's waiting key gone and its pipeline-ended said", q, *said)
|
||||
}
|
||||
}
|
||||
|
||||
// R13/AC1 (design 47 H §748, ADR 0682 §7): a newer waiting pipeline of the same branch takes the movers it also moves out of
|
||||
// an older waiting one, which ends superseded, saying wait-ended and pipeline-ended, once no mover is left; a running
|
||||
// pipeline moving the same module runs to its end.
|
||||
|
||||
@@ -547,11 +547,12 @@ func (s *Starter) Start(b Begin) (bool, error) {
|
||||
if s.Supersede != nil {
|
||||
s.Supersede(p)
|
||||
}
|
||||
// ... and every older waiting one, whether this one waits or is placed at once (H-A-244 (1)).
|
||||
if _, err := s.supersedeWaiting(p); err != nil {
|
||||
s.logf("the older waiting pipelines of %s are not superseded by %s: %v", p.Branch, key, err)
|
||||
}
|
||||
if !place {
|
||||
s.sayQueueWait(seat.EventWaitHeld, p, now, "")
|
||||
if _, err := s.supersedeWaiting(p); err != nil {
|
||||
s.logf("the older waiting pipelines of %s are not superseded by %s: %v", p.Branch, key, err)
|
||||
}
|
||||
s.Queue.overCap(key, s.logf)
|
||||
return true, nil
|
||||
}
|
||||
|
||||
@@ -166,10 +166,11 @@ func (h *Hearer) supersedeRunningOne(key string, newer seat.Pipeline) bool {
|
||||
|
||||
// supersedeWaiting takes, in each older waiting pipeline of newer's branch, the movers newer also moves out of it (design 47 H
|
||||
// §748, ADR 0682 §7): a waiting pipeline left with no mover ends superseded, its waiting key deleted, saying wait-ended and its
|
||||
// pipeline-ended. newer is a pipeline just written waiting; a running pipeline's movers leave it by SupersedeRunning
|
||||
// (H-A-223). It answers the pipelines it ended.
|
||||
// pipeline-ended. newer is a pipeline just written, waiting or placed: a mover a newer revision moves leaves every pipeline not
|
||||
// ended, a waiting one as a running one (H-A-223, H-A-244 (1)), so a waiting pipeline is placed with only the movers still its
|
||||
// own; a running pipeline's movers leave it by SupersedeRunning. It answers the pipelines it ended.
|
||||
func (s *Starter) supersedeWaiting(newer seat.Pipeline) ([]string, error) {
|
||||
if s.Queue == nil || newer.Outcome != seat.PipelineOutcomeWaiting {
|
||||
if s.Queue == nil || (newer.Outcome != seat.PipelineOutcomeWaiting && newer.Outcome != seat.PipelineOutcomeRunning) {
|
||||
return nil, nil
|
||||
}
|
||||
wkeys, pipelines, err := s.Queue.Waiting()
|
||||
@@ -196,7 +197,7 @@ func (s *Starter) supersedeWaiting(newer seat.Pipeline) ([]string, error) {
|
||||
func (s *Starter) supersedeOne(wkey, key string, newer seat.Pipeline) (bool, error) {
|
||||
for {
|
||||
p, rev, err := s.Store.Get(key)
|
||||
if err != nil || p.Outcome != seat.PipelineOutcomeWaiting || p.Branch != newer.Branch || p.Seq >= newer.Seq {
|
||||
if err != nil || p.Outcome != seat.PipelineOutcomeWaiting || p.Branch != newer.Branch || !olderWaiting(p, newer) {
|
||||
return false, nil
|
||||
}
|
||||
left := slices.DeleteFunc(slices.Clone(p.Movers), func(m seat.Mover) bool { return Moves(newer, m.Module) })
|
||||
@@ -235,6 +236,15 @@ func (s *Starter) supersedeOne(wkey, key string, newer seat.Pipeline) (bool, err
|
||||
}
|
||||
}
|
||||
|
||||
// olderWaiting says whether the waiting pipeline p is older than newer: by its sequence in the queue when newer waits too,
|
||||
// by its catalog revision when newer was placed at once (H-A-244 (1)); a run on request's pipelines are never compared.
|
||||
func olderWaiting(p, newer seat.Pipeline) bool {
|
||||
if newer.Outcome == seat.PipelineOutcomeWaiting {
|
||||
return p.Seq < newer.Seq
|
||||
}
|
||||
return p.Run == "" && newer.Run == "" && p.Revision < newer.Revision
|
||||
}
|
||||
|
||||
// supersededWhy writes, into mover module's build steps, that a dependency it builds on was taken out of p by a newer
|
||||
// pipeline, so it builds against the newest published package (design 47 H §748; H-A-53, H-A-107).
|
||||
func supersededWhy(p seat.Pipeline, module string, entries map[string]catalog.CatalogEntry, steps []seat.StepResult) {
|
||||
|
||||
Reference in New Issue
Block a user