The control plane uses whichever mirror answers

mirror.peers names the mirrors kept in step with mirror.api. The
mirror's management calls go to the first that can be reached, and
each mirror is asked every fifteen seconds whether it answers: a shard
is sent its model's and adapters' address on one that does while the
mirror the catalog names is down.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Ilker ManapandClaude Opus 5.5 committed 2026-10-29 13:43:27 +01:00
1 parent 5bc71b3d0a
commit 8a76a53afb
11 files changed
+276 -21

No files matched your search

+47
View File
@@ -125,3 +125,50 @@ func TestACopyWhoseChecksumIsNotThePeersIsNotKept(t *testing.T) {
t.Errorf("a copy with the wrong checksum was kept: %v", err)
}
}
// A mirror that cannot be reached is passed over for one kept in step with it.
func TestTheNextMirrorIsAskedWhenTheFirstCannotBeReached(t *testing.T) {
a, b := newTestMirror(t), newTestMirror(t)
c, err := NewFailoverClient([]string{a.api.URL, b.api.URL}, tlsconf.Config{}, 2*time.Second)
if err != nil {
t.Fatal(err)
}
if list, err := c.List(t.Context()); err != nil || list.Base != a.files.URL {
t.Fatalf("both up: %+v %v", list, err)
}
a.api.Close()
if list, err := c.List(t.Context()); err != nil || list.Base != b.files.URL {
t.Errorf("the first down: %+v %v", list, err)
}
b.api.Close()
if _, err := c.List(t.Context()); err == nil {
t.Error("both down, and an answer")
}
}
// A node is given a model's file on a mirror that answers.
func TestAModelsAddressIsMovedToAMirrorThatAnswers(t *testing.T) {
a, b := newTestMirror(t), newTestMirror(t)
s, err := NewSources([]string{a.api.URL, b.api.URL}, tlsconf.Config{}, discardLog())
if err != nil {
t.Fatal(err)
}
s.Check(t.Context())
src := a.files.URL + "/qwen/v1/m.gguf"
if got := s.Rewrite(src); got != src {
t.Errorf("its own mirror up: %s", got)
}
a.api.Close()
s.Check(t.Context())
if got := s.Rewrite(src); got != b.files.URL+"/qwen/v1/m.gguf" {
t.Errorf("its own mirror down: %s", got)
}
if got := s.Rewrite("https://huggingface.co/x/y"); got != "https://huggingface.co/x/y" {
t.Errorf("an address on no mirror: %s", got)
}
b.api.Close()
s.Check(t.Context())
if got := s.Rewrite(src); got != src {
t.Errorf("none up: %s", got)
}
}