Skip to content

Commit

Permalink
Merge pull request #10123 from jingyih/cherry-pick-of-#10109-origin-r…
Browse files Browse the repository at this point in the history
…elease-3.2

etcdctl: cherry pick of #10109 to release-3.2
  • Loading branch information
gyuho authored Sep 26, 2018
2 parents 9452e5c + affd468 commit a4a8d07
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions etcdctl/ctlv3/command/snapshot_command.go
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,14 @@ func dbStatus(p string) dbstatus {
h := crc32.New(crc32.MakeTable(crc32.Castagnoli))

err = db.View(func(tx *bolt.Tx) error {
// check snapshot file integrity first
var dbErrStrings []string
for dbErr := range tx.Check() {
dbErrStrings = append(dbErrStrings, dbErr.Error())
}
if len(dbErrStrings) > 0 {
return fmt.Errorf("snapshot file integrity check failed. %d errors found.\n"+strings.Join(dbErrStrings, "\n"), len(dbErrStrings))
}
ds.TotalSize = tx.Size()
c := tx.Cursor()
for next, _ := c.First(); next != nil; next, _ = c.Next() {
Expand Down

0 comments on commit a4a8d07

Please sign in to comment.