Skip to content

Commit

Permalink
fix: commit the ndb in LoadVersionForOverwriting (#640)
Browse files Browse the repository at this point in the history
  • Loading branch information
yihuang committed Dec 6, 2022
1 parent 12381ab commit e144f08
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
## Unreleased

- [#586](https://github.com/cosmos/iavl/pull/586) Remove the `RangeProof` and refactor the ics23_proof to use the internal methods.
- [#640](https://github.com/cosmos/iavl/pull/640) commit `NodeDB` batch in `LoadVersionForOverwriting`.

## 0.19.4 (October 28, 2022)

Expand Down
7 changes: 7 additions & 0 deletions mutable_tree.go
Original file line number Diff line number Diff line change
Expand Up @@ -625,6 +625,13 @@ func (tree *MutableTree) LoadVersionForOverwriting(targetVersion int64) (int64,
return latestVersion, err
}

// Commit the tree rollback first
// The fast storage rebuild don't have to be atomic with this,
// because it's idempotent and will do again when `LoadVersion`.
if err := tree.ndb.Commit(); err != nil {
return latestVersion, err
}

if !tree.skipFastStorageUpgrade {
if err := tree.enableFastStorageAndCommitLocked(); err != nil {
return latestVersion, err
Expand Down

0 comments on commit e144f08

Please sign in to comment.