H-A-496 runner: say kept revisions; a gone kept revision ends the pipeline
main.291 held the one pipelines-at-once turn 50 minutes waiting for kept revision 292, which the catalog had removed: nothing pinned it and the wait had no end. pipeline-started now carries every revision the pipeline's movers are kept at, and a re-pin says it again with the full list, so the indexer pins them. A catalog read answered "no such object" is the revision gone; the placing then ends the pipeline failed "kept revision <r> gone", its movers are left unfinished and rejoin the next pipeline, and its turn is freed. Builds: design 47 H2 H-A-496, H-A-496 addendum
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"strconv"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
@@ -150,10 +151,17 @@ func catalogRevision(call func(string, any) (json.RawMessage, error), kept *revi
|
||||
for {
|
||||
raw, err := call("seat:"+catalog.Seat+"."+catalog.VerbRevision, in)
|
||||
if err != nil {
|
||||
// A revision the catalog answers "no such object" for is gone (design 47 H2 H-A-496): a kept mover's wait on it ends.
|
||||
if strings.Contains(err.Error(), "no such object") {
|
||||
return pipeline.Half{}, fmt.Errorf("%w: %v", pipeline.ErrRevisionGone, err)
|
||||
}
|
||||
return pipeline.Half{}, err
|
||||
}
|
||||
answer, said, ok := buscalls.Unwrap(raw)
|
||||
if !ok {
|
||||
if strings.Contains(said, "no such object") {
|
||||
return pipeline.Half{}, fmt.Errorf("%w: %s answered: %s", pipeline.ErrRevisionGone, catalog.VerbRevision, said)
|
||||
}
|
||||
return pipeline.Half{}, fmt.Errorf("%s answered: %s", catalog.VerbRevision, said)
|
||||
}
|
||||
var a catalog.RevisionAnswer
|
||||
|
||||
@@ -2,6 +2,7 @@ package main
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
@@ -63,6 +64,19 @@ func TestCatalogRevisionIsKeptOnceRead(t *testing.T) {
|
||||
if h, err := read("main", 0); err != nil || calls != 3 || len(h.Entries) != 2 {
|
||||
t.Fatalf("the newest made calls %d, %+v, %v; want its first page only", calls, h, err)
|
||||
}
|
||||
// A revision the catalog answers "no such object" for is gone, whether refused or answered so (design 47 H2 H-A-496).
|
||||
for _, gone := range []func(string, any) (json.RawMessage, error){
|
||||
func(string, any) (json.RawMessage, error) {
|
||||
return nil, fmt.Errorf("revision main.292: no such object")
|
||||
},
|
||||
func(string, any) (json.RawMessage, error) {
|
||||
return json.RawMessage(`{"content":[{"text":"revision main.292: no such object"}],"isError":true}`), nil
|
||||
},
|
||||
} {
|
||||
if _, err := catalogRevision(gone, newRevisionCache(1))("main", 292); !errors.Is(err, pipeline.ErrRevisionGone) {
|
||||
t.Errorf("a revision the catalog has no object of reads %v, want it gone", err)
|
||||
}
|
||||
}
|
||||
c := newRevisionCache(1)
|
||||
c.put("main", pipeline.Half{Revision: 1})
|
||||
c.put("main", pipeline.Half{Revision: 2})
|
||||
|
||||
Reference in New Issue
Block a user