etcdserver: remove code duplication from the peer.send func

During the refactoring process, duplicate logging
of the send buffer overflow event was added.
Each of these log lines logs exactly the same information, the logging
context is sufficient to distinguish the cause.
Additionally, the unnecessary context (in parentheses) in the log
message was removed, which was necessary without the zap context (with
the old logger), but now only confuses.
This commit is contained in:
Sergey Kacheev 2021-07-22 23:15:20 +07:00
parent a1fd98c6b0
commit daf7e0350a

View File

@ -250,10 +250,9 @@ func (p *peer) send(m raftpb.Message) {
if isMsgSnap(m) {
p.r.ReportSnapshot(m.To, raft.SnapshotFailure)
}
if p.status.isActive() {
if p.lg != nil {
p.lg.Warn(
"dropped internal Raft message since sending buffer is full (overloaded network)",
"dropped internal Raft message since sending buffer is full",
zap.String("message-type", m.Type.String()),
zap.String("local-member-id", p.localID.String()),
zap.String("from", types.ID(m.From).String()),
@ -262,19 +261,6 @@ func (p *peer) send(m raftpb.Message) {
zap.Bool("remote-peer-active", p.status.isActive()),
)
}
} else {
if p.lg != nil {
p.lg.Warn(
"dropped internal Raft message since sending buffer is full (overloaded network)",
zap.String("message-type", m.Type.String()),
zap.String("local-member-id", p.localID.String()),
zap.String("from", types.ID(m.From).String()),
zap.String("remote-peer-id", p.id.String()),
zap.String("remote-peer-name", name),
zap.Bool("remote-peer-active", p.status.isActive()),
)
}
}
sentFailures.WithLabelValues(types.ID(m.To).String()).Inc()
}
}