Browse Source

Merge pull request #2495 from yichengq/337

rafthttp: report snapshot failure when dropping MsgSnap
Xiang Li 10 years ago
parent
commit
6103a05ed1
1 changed files with 4 additions and 0 deletions
  1. 4 0
      rafthttp/peer.go

+ 4 - 0
rafthttp/peer.go

@@ -22,6 +22,7 @@ import (
 	"github.com/coreos/etcd/Godeps/_workspace/src/golang.org/x/net/context"
 	"github.com/coreos/etcd/etcdserver/stats"
 	"github.com/coreos/etcd/pkg/types"
+	"github.com/coreos/etcd/raft"
 	"github.com/coreos/etcd/raft/raftpb"
 )
 
@@ -159,6 +160,9 @@ func startPeer(tr http.RoundTripper, urls types.URLs, local, to, cid types.ID, r
 				case writec <- m:
 				default:
 					p.r.ReportUnreachable(m.To)
+					if isMsgSnap(m) {
+						p.r.ReportSnapshot(m.To, raft.SnapshotFailure)
+					}
 					log.Printf("peer: dropping %s to %s since %s with %d-size buffer is blocked",
 						m.Type, p.id, name, bufSizeMap[name])
 				}