From 6aa559f93dcb89be8d9d80a91cdd7611fc0971fb Mon Sep 17 00:00:00 2001 From: Gyu-Ho Lee Date: Wed, 18 Nov 2015 12:18:56 -0800 Subject: [PATCH] rafthttp: more detailed logs when filled-up buffer This adds more detailed explanation about why some messages got dropped to help users debug. This is for https://github.com/coreos/etcd/issues/3806. --- rafthttp/peer.go | 5 ++--- rafthttp/remote.go | 5 ++--- rafthttp/stream.go | 5 ++--- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/rafthttp/peer.go b/rafthttp/peer.go index f55628ef3..a71fd54bd 100644 --- a/rafthttp/peer.go +++ b/rafthttp/peer.go @@ -171,10 +171,9 @@ func startPeer(streamRt, pipelineRt http.RoundTripper, urls types.URLs, local, t p.r.ReportSnapshot(m.To, raft.SnapshotFailure) } if status.isActive() { - plog.MergeWarningf("dropped %s to %s since %s's sending buffer is full", m.Type, p.id, name) - } else { - plog.Debugf("dropped %s to %s since %s's sending buffer is full", m.Type, p.id, name) + plog.MergeWarningf("dropped internal raft message to %s since %s's sending buffer is full (bad/overloaded network)", p.id, name) } + plog.Debugf("dropped %s to %s since %s's sending buffer is full", m.Type, p.id, name) } case mm := <-p.recvc: if err := r.Process(context.TODO(), mm); err != nil { diff --git a/rafthttp/remote.go b/rafthttp/remote.go index 0e63dee8b..425e7aebd 100644 --- a/rafthttp/remote.go +++ b/rafthttp/remote.go @@ -42,10 +42,9 @@ func (g *remote) send(m raftpb.Message) { case g.pipeline.msgc <- m: default: if g.status.isActive() { - plog.MergeWarningf("dropped %s to %s since sending buffer is full", m.Type, g.id) - } else { - plog.Debugf("dropped %s to %s since sending buffer is full", m.Type, g.id) + plog.MergeWarningf("dropped internal raft message to %s since sending buffer is full (bad/overloaded network)", g.id) } + plog.Debugf("dropped %s to %s since sending buffer is full", m.Type, g.id) } } diff --git a/rafthttp/stream.go b/rafthttp/stream.go index e01681239..393ed934f 100644 --- a/rafthttp/stream.go +++ b/rafthttp/stream.go @@ -332,10 +332,9 @@ func (cr *streamReader) decodeLoop(rc io.ReadCloser, t streamType) error { case recvc <- m: default: if cr.status.isActive() { - plog.MergeWarningf("dropped %s from %s since receiving buffer is full", m.Type, types.ID(m.From)) - } else { - plog.Debugf("dropped %s from %s since receiving buffer is full", m.Type, types.ID(m.From)) + plog.MergeWarningf("dropped internal raft message from %s since receiving buffer is full (overloaded network)", types.ID(m.From)) } + plog.Debugf("dropped %s from %s since receiving buffer is full", m.Type, types.ID(m.From)) } } }