Updating dependancies. (#9303)
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
347ee1d205
Коммит
61e27beabc
1
vendor/github.com/hashicorp/errwrap/go.mod
сгенерированный
поставляемый
Обычный файл
1
vendor/github.com/hashicorp/errwrap/go.mod
сгенерированный
поставляемый
Обычный файл
@@ -0,0 +1 @@
|
||||
module github.com/hashicorp/errwrap
|
||||
3
vendor/github.com/hashicorp/go-multierror/go.mod
сгенерированный
поставляемый
Обычный файл
3
vendor/github.com/hashicorp/go-multierror/go.mod
сгенерированный
поставляемый
Обычный файл
@@ -0,0 +1,3 @@
|
||||
module github.com/hashicorp/go-multierror
|
||||
|
||||
require github.com/hashicorp/errwrap v1.0.0
|
||||
4
vendor/github.com/hashicorp/go-multierror/go.sum
сгенерированный
поставляемый
Обычный файл
4
vendor/github.com/hashicorp/go-multierror/go.sum
сгенерированный
поставляемый
Обычный файл
@@ -0,0 +1,4 @@
|
||||
github.com/hashicorp/errwrap v0.0.0-20141028054710-7554cd9344ce h1:prjrVgOk2Yg6w+PflHoszQNLTUh4kaByUcEWM/9uin4=
|
||||
github.com/hashicorp/errwrap v0.0.0-20141028054710-7554cd9344ce/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
|
||||
github.com/hashicorp/errwrap v1.0.0 h1:hLrqtEDnRye3+sgx6z4qVLNuviH3MR5aQ0ykNJa/UYA=
|
||||
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
|
||||
2
vendor/github.com/hashicorp/memberlist/Makefile
сгенерированный
поставляемый
2
vendor/github.com/hashicorp/memberlist/Makefile
сгенерированный
поставляемый
@@ -16,4 +16,4 @@ deps:
|
||||
go get -d -v ./...
|
||||
echo $(DEPS) | xargs -n1 go get -d
|
||||
|
||||
.PNONY: test cov integ
|
||||
.PHONY: test cov integ
|
||||
|
||||
32
vendor/github.com/hashicorp/memberlist/memberlist.go
сгенерированный
поставляемый
32
vendor/github.com/hashicorp/memberlist/memberlist.go
сгенерированный
поставляемый
@@ -15,6 +15,7 @@ multiple routes.
|
||||
package memberlist
|
||||
|
||||
import (
|
||||
"container/list"
|
||||
"fmt"
|
||||
"log"
|
||||
"net"
|
||||
@@ -34,6 +35,7 @@ type Memberlist struct {
|
||||
sequenceNum uint32 // Local sequence number
|
||||
incarnation uint32 // Local incarnation number
|
||||
numNodes uint32 // Number of known nodes (estimate)
|
||||
pushPullReq uint32 // Number of push/pull requests
|
||||
|
||||
config *Config
|
||||
shutdown int32 // Used as an atomic boolean value
|
||||
@@ -45,7 +47,11 @@ type Memberlist struct {
|
||||
leaveLock sync.Mutex // Serializes calls to Leave
|
||||
|
||||
transport Transport
|
||||
handoff chan msgHandoff
|
||||
|
||||
handoffCh chan struct{}
|
||||
highPriorityMsgQueue *list.List
|
||||
lowPriorityMsgQueue *list.List
|
||||
msgQueueLock sync.Mutex
|
||||
|
||||
nodeLock sync.RWMutex
|
||||
nodes []*nodeState // Known nodes
|
||||
@@ -160,17 +166,19 @@ func newMemberlist(conf *Config) (*Memberlist, error) {
|
||||
}
|
||||
|
||||
m := &Memberlist{
|
||||
config: conf,
|
||||
shutdownCh: make(chan struct{}),
|
||||
leaveBroadcast: make(chan struct{}, 1),
|
||||
transport: transport,
|
||||
handoff: make(chan msgHandoff, conf.HandoffQueueDepth),
|
||||
nodeMap: make(map[string]*nodeState),
|
||||
nodeTimers: make(map[string]*suspicion),
|
||||
awareness: newAwareness(conf.AwarenessMaxMultiplier),
|
||||
ackHandlers: make(map[uint32]*ackHandler),
|
||||
broadcasts: &TransmitLimitedQueue{RetransmitMult: conf.RetransmitMult},
|
||||
logger: logger,
|
||||
config: conf,
|
||||
shutdownCh: make(chan struct{}),
|
||||
leaveBroadcast: make(chan struct{}, 1),
|
||||
transport: transport,
|
||||
handoffCh: make(chan struct{}, 1),
|
||||
highPriorityMsgQueue: list.New(),
|
||||
lowPriorityMsgQueue: list.New(),
|
||||
nodeMap: make(map[string]*nodeState),
|
||||
nodeTimers: make(map[string]*suspicion),
|
||||
awareness: newAwareness(conf.AwarenessMaxMultiplier),
|
||||
ackHandlers: make(map[uint32]*ackHandler),
|
||||
broadcasts: &TransmitLimitedQueue{RetransmitMult: conf.RetransmitMult},
|
||||
logger: logger,
|
||||
}
|
||||
m.broadcasts.NumNodes = func() int {
|
||||
return m.estNumNodes()
|
||||
|
||||
92
vendor/github.com/hashicorp/memberlist/net.go
сгенерированный
поставляемый
92
vendor/github.com/hashicorp/memberlist/net.go
сгенерированный
поставляемый
@@ -8,9 +8,10 @@ import (
|
||||
"hash/crc32"
|
||||
"io"
|
||||
"net"
|
||||
"sync/atomic"
|
||||
"time"
|
||||
|
||||
"github.com/armon/go-metrics"
|
||||
metrics "github.com/armon/go-metrics"
|
||||
"github.com/hashicorp/go-msgpack/codec"
|
||||
)
|
||||
|
||||
@@ -71,7 +72,8 @@ const (
|
||||
compoundOverhead = 2 // Assumed overhead per entry in compoundHeader
|
||||
userMsgOverhead = 1
|
||||
blockingWarning = 10 * time.Millisecond // Warn if a UDP packet takes this long to process
|
||||
maxPushStateBytes = 10 * 1024 * 1024
|
||||
maxPushStateBytes = 20 * 1024 * 1024
|
||||
maxPushPullRequests = 128 // Maximum number of concurrent push/pull requests
|
||||
)
|
||||
|
||||
// ping request sent directly to node
|
||||
@@ -238,6 +240,16 @@ func (m *Memberlist) handleConn(conn net.Conn) {
|
||||
m.logger.Printf("[ERR] memberlist: Failed to receive user message: %s %s", err, LogConn(conn))
|
||||
}
|
||||
case pushPullMsg:
|
||||
// Increment counter of pending push/pulls
|
||||
numConcurrent := atomic.AddUint32(&m.pushPullReq, 1)
|
||||
defer atomic.AddUint32(&m.pushPullReq, ^uint32(0))
|
||||
|
||||
// Check if we have too many open push/pull requests
|
||||
if numConcurrent >= maxPushPullRequests {
|
||||
m.logger.Printf("[ERR] memberlist: Too many pending push/pull requests")
|
||||
return
|
||||
}
|
||||
|
||||
join, remoteNodes, userState, err := m.readRemoteState(bufConn, dec)
|
||||
if err != nil {
|
||||
m.logger.Printf("[ERR] memberlist: Failed to read remote state: %s %s", err, LogConn(conn))
|
||||
@@ -357,10 +369,25 @@ func (m *Memberlist) handleCommand(buf []byte, from net.Addr, timestamp time.Tim
|
||||
case deadMsg:
|
||||
fallthrough
|
||||
case userMsg:
|
||||
select {
|
||||
case m.handoff <- msgHandoff{msgType, buf, from}:
|
||||
default:
|
||||
// Determine the message queue, prioritize alive
|
||||
queue := m.lowPriorityMsgQueue
|
||||
if msgType == aliveMsg {
|
||||
queue = m.highPriorityMsgQueue
|
||||
}
|
||||
|
||||
// Check for overflow and append if not full
|
||||
m.msgQueueLock.Lock()
|
||||
if queue.Len() >= m.config.HandoffQueueDepth {
|
||||
m.logger.Printf("[WARN] memberlist: handler queue full, dropping message (%d) %s", msgType, LogAddress(from))
|
||||
} else {
|
||||
queue.PushBack(msgHandoff{msgType, buf, from})
|
||||
}
|
||||
m.msgQueueLock.Unlock()
|
||||
|
||||
// Notify of pending message
|
||||
select {
|
||||
case m.handoffCh <- struct{}{}:
|
||||
default:
|
||||
}
|
||||
|
||||
default:
|
||||
@@ -368,28 +395,51 @@ func (m *Memberlist) handleCommand(buf []byte, from net.Addr, timestamp time.Tim
|
||||
}
|
||||
}
|
||||
|
||||
// getNextMessage returns the next message to process in priority order, using LIFO
|
||||
func (m *Memberlist) getNextMessage() (msgHandoff, bool) {
|
||||
m.msgQueueLock.Lock()
|
||||
defer m.msgQueueLock.Unlock()
|
||||
|
||||
if el := m.highPriorityMsgQueue.Back(); el != nil {
|
||||
m.highPriorityMsgQueue.Remove(el)
|
||||
msg := el.Value.(msgHandoff)
|
||||
return msg, true
|
||||
} else if el := m.lowPriorityMsgQueue.Back(); el != nil {
|
||||
m.lowPriorityMsgQueue.Remove(el)
|
||||
msg := el.Value.(msgHandoff)
|
||||
return msg, true
|
||||
}
|
||||
return msgHandoff{}, false
|
||||
}
|
||||
|
||||
// packetHandler is a long running goroutine that processes messages received
|
||||
// over the packet interface, but is decoupled from the listener to avoid
|
||||
// blocking the listener which may cause ping/ack messages to be delayed.
|
||||
func (m *Memberlist) packetHandler() {
|
||||
for {
|
||||
select {
|
||||
case msg := <-m.handoff:
|
||||
msgType := msg.msgType
|
||||
buf := msg.buf
|
||||
from := msg.from
|
||||
case <-m.handoffCh:
|
||||
for {
|
||||
msg, ok := m.getNextMessage()
|
||||
if !ok {
|
||||
break
|
||||
}
|
||||
msgType := msg.msgType
|
||||
buf := msg.buf
|
||||
from := msg.from
|
||||
|
||||
switch msgType {
|
||||
case suspectMsg:
|
||||
m.handleSuspect(buf, from)
|
||||
case aliveMsg:
|
||||
m.handleAlive(buf, from)
|
||||
case deadMsg:
|
||||
m.handleDead(buf, from)
|
||||
case userMsg:
|
||||
m.handleUser(buf, from)
|
||||
default:
|
||||
m.logger.Printf("[ERR] memberlist: Message type (%d) not supported %s (packet handler)", msgType, LogAddress(from))
|
||||
switch msgType {
|
||||
case suspectMsg:
|
||||
m.handleSuspect(buf, from)
|
||||
case aliveMsg:
|
||||
m.handleAlive(buf, from)
|
||||
case deadMsg:
|
||||
m.handleDead(buf, from)
|
||||
case userMsg:
|
||||
m.handleUser(buf, from)
|
||||
default:
|
||||
m.logger.Printf("[ERR] memberlist: Message type (%d) not supported %s (packet handler)", msgType, LogAddress(from))
|
||||
}
|
||||
}
|
||||
|
||||
case <-m.shutdownCh:
|
||||
@@ -1094,7 +1144,7 @@ func (m *Memberlist) sendPingAndWaitForAck(addr string, ping ping, deadline time
|
||||
}
|
||||
|
||||
if ack.SeqNo != ping.SeqNo {
|
||||
return false, fmt.Errorf("Sequence number from ack (%d) doesn't match ping (%d)", ack.SeqNo, ping.SeqNo, LogConn(conn))
|
||||
return false, fmt.Errorf("Sequence number from ack (%d) doesn't match ping (%d)", ack.SeqNo, ping.SeqNo)
|
||||
}
|
||||
|
||||
return true, nil
|
||||
|
||||
Ссылка в новой задаче
Block a user