mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
rafthttp: better snapshot sending logging
snapshot sending is an important event. We should always log it explicitly.
This commit is contained in:
parent
7e5b7cfc65
commit
74dba2d4cf
@ -73,13 +73,18 @@ func (s *snapshotSender) send(merged snap.Message) {
|
|||||||
u := s.picker.pick()
|
u := s.picker.pick()
|
||||||
req := createPostRequest(u, RaftSnapshotPrefix, body, "application/octet-stream", s.from, s.cid)
|
req := createPostRequest(u, RaftSnapshotPrefix, body, "application/octet-stream", s.from, s.cid)
|
||||||
|
|
||||||
|
plog.Infof("start to send database snapshot [index: %d, to %s]...", m.Snapshot.Metadata.Index, types.ID(m.To))
|
||||||
|
|
||||||
err := s.post(req)
|
err := s.post(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
plog.Warningf("database snapshot [index: %d, to: %s] failed to be sent out (%v)", m.Snapshot.Metadata.Index, types.ID(m.To), err)
|
||||||
|
|
||||||
// errMemberRemoved is a critical error since a removed member should
|
// errMemberRemoved is a critical error since a removed member should
|
||||||
// always be stopped. So we use reportCriticalError to report it to errorc.
|
// always be stopped. So we use reportCriticalError to report it to errorc.
|
||||||
if err == errMemberRemoved {
|
if err == errMemberRemoved {
|
||||||
reportCriticalError(err, s.errorc)
|
reportCriticalError(err, s.errorc)
|
||||||
}
|
}
|
||||||
|
|
||||||
s.picker.unreachable(u)
|
s.picker.unreachable(u)
|
||||||
reportSentFailure(sendSnap, m)
|
reportSentFailure(sendSnap, m)
|
||||||
s.status.deactivate(failureType{source: sendSnap, action: "post"}, err.Error())
|
s.status.deactivate(failureType{source: sendSnap, action: "post"}, err.Error())
|
||||||
@ -88,17 +93,12 @@ func (s *snapshotSender) send(merged snap.Message) {
|
|||||||
// machine knows about it, it would pause a while and retry sending
|
// machine knows about it, it would pause a while and retry sending
|
||||||
// new snapshot message.
|
// new snapshot message.
|
||||||
s.r.ReportSnapshot(m.To, raft.SnapshotFailure)
|
s.r.ReportSnapshot(m.To, raft.SnapshotFailure)
|
||||||
if s.status.isActive() {
|
|
||||||
plog.Warningf("snapshot [index: %d, to: %s] failed to be sent out (%v)", m.Snapshot.Metadata.Index, types.ID(m.To), err)
|
|
||||||
} else {
|
|
||||||
plog.Debugf("snapshot [index: %d, to: %s] failed to be sent out (%v)", m.Snapshot.Metadata.Index, types.ID(m.To), err)
|
|
||||||
}
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
reportSentDuration(sendSnap, m, time.Since(start))
|
reportSentDuration(sendSnap, m, time.Since(start))
|
||||||
s.status.activate()
|
s.status.activate()
|
||||||
s.r.ReportSnapshot(m.To, raft.SnapshotFinish)
|
s.r.ReportSnapshot(m.To, raft.SnapshotFinish)
|
||||||
plog.Infof("snapshot [index: %d, to: %s] sent out successfully", m.Snapshot.Metadata.Index, types.ID(m.To))
|
plog.Infof("database snapshot [index: %d, to: %s] sent out successfully", m.Snapshot.Metadata.Index, types.ID(m.To))
|
||||||
}
|
}
|
||||||
|
|
||||||
// post posts the given request.
|
// post posts the given request.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user