Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: quick workaround for flat storage memtrie comparison #12592

Merged
merged 3 commits into from
Dec 10, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions integration-tests/src/test_loop/tests/resharding_v3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ use near_primitives::test_utils::create_user_test_signer;
use near_primitives::transaction::SignedTransaction;
use near_primitives::trie_key::TrieKey;
use near_primitives::views::FinalExecutionStatus;
use near_store::flat::FlatStorageStatus;
use std::cell::Cell;
use std::u64;

Expand Down Expand Up @@ -653,6 +654,25 @@ fn assert_state_sanity(
trie.lock_for_iter().iter().unwrap().collect::<Result<HashSet<_>, _>>().unwrap();
assert_state_equal(&memtrie_state, &trie_state, shard_uid, "memtrie and trie");

// FlatStorageChunkView::iter_range() used below to retrieve all key-value pairs in Flat
// Storage only looks at the data committed into the DB. For this reasons comparing Flat
// Storage and Memtries makes sense only if we can retrieve a view at the same height from
// both.
if let FlatStorageStatus::Ready(status) = client
.chain
.runtime_adapter
.get_flat_storage_manager()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mini nit: you also need the manager a few lines below, maybe move to a variable

.get_flat_storage_status(shard_uid)
{
if status.flat_head.hash != final_head.prev_block_hash {
tracing::warn!(target: "test", "skipping flat storage - memtrie state check");
continue;
} else {
tracing::debug!(target: "test", "checking flat storage - memtrie state");
}
} else {
continue;
};
let Some(flat_store_chunk_view) = client
.chain
.runtime_adapter
Expand Down
Loading