Skip to content

Commit

Permalink
mvcc: rollback tmptx in case of error (#11525)
Browse files Browse the repository at this point in the history
Co-authored-by: yutedz <54038175+yutedz@users.noreply.github.com>
  • Loading branch information
2 people authored and xiang90 committed Jan 15, 2020
1 parent af131b5 commit 574ee42
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions mvcc/backend/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 574ee42

Please sign in to comment.