clientv3: Check the error return from Write in v3Manager#Status
@@ -183,18 +183,26 @@ func (s *v3Manager) Status(dbPath string) (ds Status, err error) {
if b == nil {
return fmt.Errorf("cannot get hash of bucket %s", string(next))
}
- h.Write(next)
+ if _, err := h.Write(next); err != nil {
+ return fmt.Errorf("cannot write bucket %s : %v", string(next), err)
+ }
iskeyb := (string(next) == "key")
- b.ForEach(func(k, v []byte) error {
- h.Write(k)
- h.Write(v)
+ if err := b.ForEach(func(k, v []byte) error {
+ if _, err := h.Write(k); err != nil {
+ return fmt.Errorf("cannot write to bucket %s", err.Error())
+ }
+ if _, err := h.Write(v); err != nil {
+ return fmt.Errorf("cannot write to bucket %s", err.Error())
+ }
if iskeyb {
rev := bytesToRev(k)
ds.Revision = rev.main
}
ds.TotalKey++
return nil
- })
+ }); err != nil {
+ return fmt.Errorf("cannot write bucket %s : %v", string(next), err)
+ }
}
return nil
}); err != nil {
