mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
rafthttp: report unreachable when dropping messages
This commit is contained in:
parent
b1ff6ddd88
commit
a230003255
@ -91,6 +91,7 @@ type Peer interface {
|
||||
type peer struct {
|
||||
// id of the remote raft peer node
|
||||
id types.ID
|
||||
r Raft
|
||||
|
||||
msgAppWriter *streamWriter
|
||||
writer *streamWriter
|
||||
@ -113,6 +114,7 @@ func startPeer(tr http.RoundTripper, urls types.URLs, local, to, cid types.ID, r
|
||||
picker := newURLPicker(urls)
|
||||
p := &peer{
|
||||
id: to,
|
||||
r: r,
|
||||
msgAppWriter: startStreamWriter(fs, r),
|
||||
writer: startStreamWriter(fs, r),
|
||||
pipeline: newPipeline(tr, picker, to, cid, fs, r, errorc),
|
||||
@ -156,6 +158,7 @@ func startPeer(tr http.RoundTripper, urls types.URLs, local, to, cid types.ID, r
|
||||
select {
|
||||
case writec <- m:
|
||||
default:
|
||||
p.r.ReportUnreachable(m.To)
|
||||
log.Printf("peer: dropping %s to %s since %s with %d-size buffer is blocked",
|
||||
m.Type, p.id, name, bufSizeMap[name])
|
||||
}
|
||||
|
@ -116,6 +116,8 @@ func (cw *streamWriter) run() {
|
||||
if m.Term > msgAppTerm {
|
||||
cw.resetCloser()
|
||||
heartbeatc, msgc = nil, nil
|
||||
// TODO: report to raft at peer level
|
||||
cw.r.ReportUnreachable(m.To)
|
||||
}
|
||||
continue
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user