mvcc: check the error return in defragdb (#11524)

Co-authored-by: yutedz <54038175+yutedz@users.noreply.github.com>
This commit is contained in:
Ted Yu 2020-01-15 16:57:12 -08:00 committed by Xiang Li
parent 67bf39b2ec
commit 250b0acac4

View File

@ -492,7 +492,7 @@ func defragdb(odb, tmpdb *bolt.DB, limit int) error {
} }
tmpb.FillPercent = 0.9 // for seq write in for each tmpb.FillPercent = 0.9 // for seq write in for each
b.ForEach(func(k, v []byte) error { if pErr := b.ForEach(func(k, v []byte) error {
count++ count++
if count > limit { if count > limit {
err = tmptx.Commit() err = tmptx.Commit()
@ -509,7 +509,9 @@ func defragdb(odb, tmpdb *bolt.DB, limit int) error {
count = 0 count = 0
} }
return tmpb.Put(k, v) return tmpb.Put(k, v)
}) }); pErr != nil {
return pErr
}
} }
return tmptx.Commit() return tmptx.Commit()