diff --git a/bcos-executor/src/executor/TransactionExecutor.cpp b/bcos-executor/src/executor/TransactionExecutor.cpp index 8c8330ec1e..7353058535 100644 --- a/bcos-executor/src/executor/TransactionExecutor.cpp +++ b/bcos-executor/src/executor/TransactionExecutor.cpp @@ -2504,7 +2504,8 @@ void TransactionExecutor::removeCommittedState() if (it != m_stateStorages.end()) { EXECUTOR_NAME_LOG(INFO) - << "Set state number, " << it->number << " prev to cachedStorage"; + << "Set state number, " << it->number << " prev to cachedStorage" + << LOG_KV("stateStorageSize", m_stateStorages.size()); it->storage->setPrev(m_cachedStorage); } } diff --git a/bcos-table/src/StateStorage.h b/bcos-table/src/StateStorage.h index 2bbedc21cf..1fa5065366 100644 --- a/bcos-table/src/StateStorage.h +++ b/bcos-table/src/StateStorage.h @@ -324,16 +324,16 @@ class BaseStorage : public virtual storage::StateStorageInterface, updatedCapacity -= entryOld->size(); bucket->container.modify(it, [&entry](Data& data) { data.entry = std::move(entry); }); - - if constexpr (enableLRU) - { - updateMRUAndCheck(*bucket, it); - } } else { - bucket->container.emplace( + auto [iter, _] = bucket->container.emplace( Data{std::string(tableView), std::string(keyView), std::move(entry)}); + it = iter; + } + if constexpr (enableLRU) + { + updateMRUAndCheck(*bucket, it); } if (m_recoder.local())