diff --git a/vendor.mod b/vendor.mod index a3d4c14b48..7ec45514d5 100644 --- a/vendor.mod +++ b/vendor.mod @@ -63,7 +63,7 @@ require ( github.com/moby/locker v1.0.1 github.com/moby/patternmatcher v0.5.0 github.com/moby/pubsub v1.0.0 - github.com/moby/swarmkit/v2 v2.0.0-20230406225228-75e92ce14ff7 + github.com/moby/swarmkit/v2 v2.0.0-20230531205928-01bb7a41396b github.com/moby/sys/mount v0.3.3 github.com/moby/sys/mountinfo v0.6.2 github.com/moby/sys/sequential v0.5.0 diff --git a/vendor.sum b/vendor.sum index bc79ce6dfb..5def2ffebc 100644 --- a/vendor.sum +++ b/vendor.sum @@ -1060,8 +1060,8 @@ github.com/moby/patternmatcher v0.5.0 h1:YCZgJOeULcxLw1Q+sVR636pmS7sPEn1Qo2iAN6M github.com/moby/patternmatcher v0.5.0/go.mod h1:hDPoyOpDY7OrrMDLaYoY3hf52gNCR/YOUYxkhApJIxc= github.com/moby/pubsub v1.0.0 h1:jkp/imWsmJz2f6LyFsk7EkVeN2HxR/HTTOY8kHrsxfA= github.com/moby/pubsub v1.0.0/go.mod h1:bXSO+3h5MNXXCaEG+6/NlAIk7MMZbySZlnB+cUQhKKc= -github.com/moby/swarmkit/v2 v2.0.0-20230406225228-75e92ce14ff7 h1:h6NclNly6/B9N4IdM5pcBaq/LkNLuaCmE7B44Vj+pb0= -github.com/moby/swarmkit/v2 v2.0.0-20230406225228-75e92ce14ff7/go.mod h1:P/ha3F7UZMmuUvqrHw9cZK/BjktSngQIgRPiairNHTc= +github.com/moby/swarmkit/v2 v2.0.0-20230531205928-01bb7a41396b h1:w07xyBXYTrihwBqCkuXPLqcQ1a2guqXlRIocU+e9K7A= +github.com/moby/swarmkit/v2 v2.0.0-20230531205928-01bb7a41396b/go.mod h1:Z5i5At5g0zU+ZBWb/95yVwDeNQX8BZmei9ZoYvoVD7g= github.com/moby/sys/mount v0.1.0/go.mod h1:FVQFLDRWwyBjDTBNQXDlWnSFREqOo3OKX9aqhmeoo74= github.com/moby/sys/mount v0.1.1/go.mod h1:FVQFLDRWwyBjDTBNQXDlWnSFREqOo3OKX9aqhmeoo74= github.com/moby/sys/mount v0.3.3 h1:fX1SVkXFJ47XWDoeFW4Sq7PdQJnV2QIDZAqjNqgEjUs= diff --git a/vendor/github.com/moby/swarmkit/v2/manager/scheduler/volumes.go b/vendor/github.com/moby/swarmkit/v2/manager/scheduler/volumes.go index 9ddba6be16..cbd2f74119 100644 --- a/vendor/github.com/moby/swarmkit/v2/manager/scheduler/volumes.go +++ b/vendor/github.com/moby/swarmkit/v2/manager/scheduler/volumes.go @@ -303,11 +303,7 @@ func (vs *volumeSet) checkVolume(id string, info *NodeInfo, readOnly bool) bool // then, do the quick check of whether this volume is in the topology. if // the volume has an AccessibleTopology, and it does not lie within the // node's topology, then this volume won't fit. - if !IsInTopology(top, vi.volume.VolumeInfo.AccessibleTopology) { - return false - } - - return true + return IsInTopology(top, vi.volume.VolumeInfo.AccessibleTopology) } // hasWriter is a helper function that returns true if at least one task is diff --git a/vendor/github.com/moby/swarmkit/v2/manager/state/raft/transport/peer.go b/vendor/github.com/moby/swarmkit/v2/manager/state/raft/transport/peer.go index 237b871619..071f6dc76f 100644 --- a/vendor/github.com/moby/swarmkit/v2/manager/state/raft/transport/peer.go +++ b/vendor/github.com/moby/swarmkit/v2/manager/state/raft/transport/peer.go @@ -196,9 +196,44 @@ func needsSplitting(m *raftpb.Message) bool { } func (p *peer) sendProcessMessage(ctx context.Context, m raftpb.Message) error { - ctx, cancel := context.WithTimeout(ctx, p.tr.config.SendTimeout) + // These lines used to be in the code, but they've been removed. I'm + // leaving them in in a comment just in case they cause some unforeseen + // breakage later, to show why they were removed. + // + // ctx, cancel := context.WithTimeout(ctx, p.tr.config.SendTimeout) + // defer cancel() + // + // Basically, these lines created a timeout that applied not to each chunk + // of a streaming message, but to the whole streaming process. With a + // sufficiently large raft log, the bandwidth on some connections can not + // physically be enough to fit within the default 2 second timeout. + // Further, it seems that because of some gRPC magic, the timeout was + // getting propagated to the stream *server*, meaning it wasn't even the + // sender timing out, it was the receiver. + // + // It should be fine to remove this timeout. The whole purpose of this + // method is to send very large raft messages that could take several + // seconds to send. + + ctx, cancel := context.WithCancel(ctx) defer cancel() + // This is a bootleg watchdog timer. If the timer elapses without something + // being written to the bump channel, it will cancel the context. + // + // We use this because the operations on this stream *must* either time out + // or succeed for raft to function correctly. We can't just time out the + // whole operation, because of the reasons stated above. But we also only + // set the context once, when we create the stream, and so can't set an + // individual timeout for each stream operation. + // + // By doing it as this watchdog-type structure, we can time out individual + // operations by canceling the context on our own terms. + t := time.AfterFunc(p.tr.config.SendTimeout, cancel) + defer t.Stop() + + bump := func() { t.Reset(p.tr.config.SendTimeout) } + var err error var stream api.Raft_StreamRaftMessageClient stream, err = api.NewRaftClient(p.conn()).StreamRaftMessage(ctx) @@ -222,6 +257,9 @@ func (p *peer) sendProcessMessage(ctx context.Context, m raftpb.Message) error { stream.CloseAndRecv() break } + + // If the send succeeds, bump the watchdog timer. + bump() } // Finished sending all the messages. diff --git a/vendor/github.com/moby/swarmkit/v2/manager/state/store/memory.go b/vendor/github.com/moby/swarmkit/v2/manager/state/store/memory.go index 1726ac1bee..4814e04551 100644 --- a/vendor/github.com/moby/swarmkit/v2/manager/state/store/memory.go +++ b/vendor/github.com/moby/swarmkit/v2/manager/state/store/memory.go @@ -16,7 +16,6 @@ import ( gogotypes "github.com/gogo/protobuf/types" memdb "github.com/hashicorp/go-memdb" "github.com/moby/swarmkit/v2/api" - pb "github.com/moby/swarmkit/v2/api" "github.com/moby/swarmkit/v2/manager/state" "github.com/moby/swarmkit/v2/watch" ) @@ -855,8 +854,8 @@ func (tx readTx) find(table string, by By, checkType func(By) error, appendResul } // Save serializes the data in the store. -func (s *MemoryStore) Save(tx ReadTx) (*pb.StoreSnapshot, error) { - var snapshot pb.StoreSnapshot +func (s *MemoryStore) Save(tx ReadTx) (*api.StoreSnapshot, error) { + var snapshot api.StoreSnapshot for _, os := range objectStorers { if err := os.Save(tx, &snapshot); err != nil { return nil, err @@ -868,7 +867,7 @@ func (s *MemoryStore) Save(tx ReadTx) (*pb.StoreSnapshot, error) { // Restore sets the contents of the store to the serialized data in the // argument. -func (s *MemoryStore) Restore(snapshot *pb.StoreSnapshot) error { +func (s *MemoryStore) Restore(snapshot *api.StoreSnapshot) error { return s.updateLocal(func(tx Tx) error { for _, os := range objectStorers { if err := os.Restore(tx, snapshot); err != nil { diff --git a/vendor/modules.txt b/vendor/modules.txt index 39d69402e6..9b54cb8f1b 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -773,7 +773,7 @@ github.com/moby/patternmatcher # github.com/moby/pubsub v1.0.0 ## explicit; go 1.19 github.com/moby/pubsub -# github.com/moby/swarmkit/v2 v2.0.0-20230406225228-75e92ce14ff7 +# github.com/moby/swarmkit/v2 v2.0.0-20230531205928-01bb7a41396b ## explicit; go 1.18 github.com/moby/swarmkit/v2/agent github.com/moby/swarmkit/v2/agent/configs