Skip to content

Commit

Permalink
fix: commit the ndb in LoadVersionForOverwriting (#640)
Browse files Browse the repository at this point in the history
(cherry picked from commit e144f08)

# Conflicts:
#	CHANGELOG.md
  • Loading branch information
yihuang authored and mergify[bot] committed Dec 7, 2022
1 parent f4499a9 commit cfaebd0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

## Unreleased

<<<<<<< HEAD
=======
- [#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`.

>>>>>>> e144f08 (fix: commit the ndb in LoadVersionForOverwriting (#640))
## 0.19.4 (October 28, 2022)

- [#599](https://github.com/cosmos/iavl/pull/599) Populate ImmutableTree creation in copy function with missing field
Expand Down
7 changes: 7 additions & 0 deletions mutable_tree.go
Original file line number Diff line number Diff line change
Expand Up @@ -623,6 +623,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 cfaebd0

Please sign in to comment.