refactor: add error log when iavl set failed (#13803)

* add error log when iavl set failed

Ref: #12012

* Update CHANGELOG.md

* play safe
This commit is contained in:
yihuang 2022-11-09 14:53:53 +08:00 committed by GitHub
parent a785bf5af6
commit 22f3261285
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 3 deletions

View File

@ -85,6 +85,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
* [#13236](https://github.com/cosmos/cosmos-sdk/pull/13236) Integrate Filter Logging
* [#13528](https://github.com/cosmos/cosmos-sdk/pull/13528) Update `ValidateMemoDecorator` to only check memo against `MaxMemoCharacters` param when a memo is present.
* [#13651](https://github.com/cosmos/cosmos-sdk/pull/13651) Update `server/config/config.GetConfig` function.
* [#13803](https://github.com/cosmos/cosmos-sdk/pull/13803) Add an error log if iavl set operation failed.
### State Machine Breaking

View File

@ -37,7 +37,8 @@ var (
// Store Implements types.KVStore and CommitKVStore.
type Store struct {
tree Tree
tree Tree
logger log.Logger
}
// LoadStore returns an IAVL Store as a CommitKVStore. Internally, it will load the
@ -87,7 +88,8 @@ func LoadStoreWithInitialVersion(db dbm.DB, logger log.Logger, key types.StoreKe
}
return &Store{
tree: tree,
tree: tree,
logger: logger,
}, nil
}
@ -198,7 +200,10 @@ func (st *Store) CacheWrapWithListeners(storeKey types.StoreKey, listeners []typ
func (st *Store) Set(key, value []byte) {
types.AssertValidKey(key)
types.AssertValidValue(value)
st.tree.Set(key, value)
_, err := st.tree.Set(key, value)
if err != nil && st.logger != nil {
st.logger.Error("iavl set error", "error", err.Error())
}
}
// Implements types.KVStore.