mvcc: rollback tmptx in case of error (#11525)

Co-authored-by: yutedz <54038175+yutedz@users.noreply.github.com>
This commit is contained in:
Ted Yu
2020-01-15 13:54:52 -08:00
committed by Xiang Li
parent af131b58eb
commit 574ee42ad7

View File

@@ -464,6 +464,11 @@ func defragdb(odb, tmpdb *bolt.DB, limit int) error {
if err != nil {
return err
}
defer func() {
if err != nil {
tmptx.Rollback()
}
}()
// open a tx on old db for read
tx, err := odb.Begin(false)