etcdserver: more logging on snapshot close path

release-3.2
Xiang 2017-05-17 14:45:10 -07:00
parent f4641accc3
commit 32c252f003
1 changed files with 6 additions and 1 deletions

View File

@ -60,9 +60,14 @@ func newSnapshotReaderCloser(snapshot backend.Snapshot) io.ReadCloser {
n, err := snapshot.WriteTo(pw)
if err == nil {
plog.Infof("wrote database snapshot out [total bytes: %d]", n)
} else {
plog.Warningf("failed to write database snapshot out [written bytes: %d]: %v", n, err)
}
pw.CloseWithError(err)
snapshot.Close()
err = snapshot.Close()
if err != nil {
plog.Panicf("failed to close database snapshot: %v", err)
}
}()
return pr
}