From a6e703c21ab8fd91f2935803c6dfe72c43d330e0 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Mon, 16 Dec 2024 17:20:12 +0000 Subject: [PATCH] cache first version for legacy versions (backport #1018) (#1020) Co-authored-by: yihuang Co-authored-by: Marko Baricevic --- CHANGELOG.md | 2 ++ nodedb.go | 1 + 2 files changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f2f822e22..9e1a74d12 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,3 +16,5 @@ - [#955](https://github.com/cosmos/iavl/pull/955) Get rid of `cosmos-db` deps completely. - [#965](https://github.com/cosmos/iavl/pull/965) Use expected interface for expected IAVL `Logger`. - [#970](https://github.com/cosmos/iavl/pull/970) Close the pruning process when the nodeDB is closed. +- [#980](https://github.com/cosmos/iavl/pull/980) Use the `sdk/core/store.KVStoreWithBatch` interface instead of `iavl/db.DB` interface +- [#1018](https://github.com/cosmos/iavl/pull/1018) Cache first version for legacy versions, fix performance regression after upgrade. diff --git a/nodedb.go b/nodedb.go index 14d74d043..a5713fbca 100644 --- a/nodedb.go +++ b/nodedb.go @@ -739,6 +739,7 @@ func (ndb *nodeDB) getFirstVersion() (int64, error) { if itr.Valid() { var version int64 legacyRootKeyFormat.Scan(itr.Key(), &version) + ndb.resetFirstVersion(version) return version, nil } // Find the first version