vendor: github.com/moby/swarmkit/v2 v2.0.0-20230531205928-01bb7a41396b
- Fix timeouts from very long raft messages
- fix: code optimization
- update dependencies
full diff: 75e92ce14f...01bb7a4139
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
8d67d0c1a8
commit
06aaf87aab
6 changed files with 47 additions and 14 deletions
|
@ -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
|
||||
|
|
|
@ -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=
|
||||
|
|
6
vendor/github.com/moby/swarmkit/v2/manager/scheduler/volumes.go
generated
vendored
6
vendor/github.com/moby/swarmkit/v2/manager/scheduler/volumes.go
generated
vendored
|
@ -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
|
||||
|
|
40
vendor/github.com/moby/swarmkit/v2/manager/state/raft/transport/peer.go
generated
vendored
40
vendor/github.com/moby/swarmkit/v2/manager/state/raft/transport/peer.go
generated
vendored
|
@ -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.
|
||||
|
|
7
vendor/github.com/moby/swarmkit/v2/manager/state/store/memory.go
generated
vendored
7
vendor/github.com/moby/swarmkit/v2/manager/state/store/memory.go
generated
vendored
|
@ -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 {
|
||||
|
|
2
vendor/modules.txt
vendored
2
vendor/modules.txt
vendored
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue