Skip to content

Commit

Permalink
fix for load version
Browse files Browse the repository at this point in the history
  • Loading branch information
kocubinski committed Nov 1, 2024
1 parent ec511e4 commit fbd5df5
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions mutable_tree.go
Original file line number Diff line number Diff line change
Expand Up @@ -455,21 +455,16 @@ func (tree *MutableTree) LoadVersion(targetVersion int64) (int64, error) {
tree.ndb.opts.InitialVersion, firstVersion)
}

_, latestVersion, err := tree.ndb.getLatestVersion()
ok, latestVersion, err := tree.ndb.getLatestVersion()
if err != nil {
return 0, err
}

if firstVersion > 0 && firstVersion < int64(tree.ndb.opts.InitialVersion) {
return latestVersion, fmt.Errorf("initial version set to %v, but found earlier version %v",
tree.ndb.opts.InitialVersion, firstVersion)
}

if latestVersion < targetVersion {
return latestVersion, fmt.Errorf("wanted to load target %d but only found up to %d", targetVersion, latestVersion)
}

if firstVersion == 0 {
if !ok {
if targetVersion <= 0 {
if !tree.skipFastStorageUpgrade {
tree.mtx.Lock()
Expand Down

0 comments on commit fbd5df5

Please sign in to comment.