Просмотр исходного кода

rafthttp: log before receiving snapshot

Database snapshot can be as large as 5GB. It is reasonable
to log before receiving it. Or the user might not know what
is happening and why etcd starts to use IO intensively.
Xiang Li 10 лет назад
Родитель
Сommit
94da4b9ee5
1 измененных файлов с 1 добавлено и 0 удалено
  1. 1 0
      rafthttp/http.go

+ 1 - 0
rafthttp/http.go

@@ -169,6 +169,7 @@ func (h *snapshotHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
 		return
 		return
 	}
 	}
 
 
+	plog.Infof("receiving database snapshot [index:%d, from %s] ...", m.Snapshot.Metadata.Index, types.ID(m.From))
 	// save incoming database snapshot.
 	// save incoming database snapshot.
 	if err := h.snapshotter.SaveDBFrom(r.Body, m.Snapshot.Metadata.Index); err != nil {
 	if err := h.snapshotter.SaveDBFrom(r.Body, m.Snapshot.Metadata.Index); err != nil {
 		msg := fmt.Sprintf("failed to save KV snapshot (%v)", err)
 		msg := fmt.Sprintf("failed to save KV snapshot (%v)", err)