Skip to content
This repository was archived by the owner on Jan 22, 2025. It is now read-only.

Correct missing entry handling to avoid bad warns#8339

Merged
ryoqun merged 5 commits intosolana-labs:masterfrom
ryoqun:missing-storage-entry-handling
Feb 21, 2020
Merged

Correct missing entry handling to avoid bad warns#8339
ryoqun merged 5 commits intosolana-labs:masterfrom
ryoqun:missing-storage-entry-handling

Conversation

@ryoqun
Copy link
Copy Markdown
Contributor

@ryoqun ryoqun commented Feb 20, 2020

Problem

Bogus warnings is introduced by #7281. Also this is needed for #8337 because compacting at generate_index causes a lot of missing storage entries.

Summary of Changes

Put empty dummy files for missing storage entry's AppendVec in the snapshot file.

=> Changed the design strategy to change AccountStorageSerialize as discussed on discord.

This changes ABI for snapshots.

=> this is not true anymore; this shouldn't introduce any ABI changes.

@ryoqun ryoqun added the work in progress This isn't quite right yet label Feb 20, 2020
@ryoqun ryoqun requested a review from sakridge February 20, 2020 00:40
@ryoqun ryoqun added the v0.23 label Feb 20, 2020
@ryoqun ryoqun changed the title [wip] Correct missing entry handling to avoid bad warns Correct missing entry handling to avoid bad warns Feb 20, 2020
Comment thread runtime/src/accounts_db.rs Outdated
.filter(|store| accounts_index.is_root(store.slot_id))
.iter()
.filter(|(slot, storage)| {
**slot <= snapshot_slot && accounts_index.is_root(**slot) && !storage.is_empty()
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

slot <= snapshot_slot logic is moved from here.

@ryoqun
Copy link
Copy Markdown
Contributor Author

ryoqun commented Feb 20, 2020

@sakridge Does this look better?Still needs to add tests (added) and more local testing with TdS snapshots (tested). Also CI might not pass.... (CI passed), also I checked ABI as well.

@ryoqun ryoqun removed the work in progress This isn't quite right yet label Feb 20, 2020
@codecov
Copy link
Copy Markdown

codecov Bot commented Feb 20, 2020

Codecov Report

Merging #8339 into master will increase coverage by <.1%.
The diff coverage is 86.3%.

@@           Coverage Diff            @@
##           master   #8339     +/-   ##
========================================
+ Coverage    80.5%   80.5%   +<.1%     
========================================
  Files         253     253             
  Lines       55412   55465     +53     
========================================
+ Hits        44637   44681     +44     
- Misses      10775   10784      +9

@sakridge
Copy link
Copy Markdown
Contributor

@sakridge Does this look better?Still needs to add tests and more local testing with TdS snapshots. Also CI might not pass....

Yea. This looks really good. Thanks for the updates.

sakridge
sakridge previously approved these changes Feb 20, 2020
Copy link
Copy Markdown
Contributor

@sakridge sakridge left a comment

Choose a reason for hiding this comment

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

lgtm

@ryoqun
Copy link
Copy Markdown
Contributor Author

ryoqun commented Feb 21, 2020

For the record, this PR doesn't change the ABI:

$ diff -U20 /tmp/abi8/accounts_db__test_accounts_db_serialize__AccountsDBSerializeAbiTestWrapper_frozen_abi__test_digest_DAT7VpkAnXSw7r9pDHppJSqKCRYC8YAF4yCDAfkCbVE5 /tmp/abi8/accounts_db__test_accounts_db_serialize__AccountsDBSerializeAbiTestWrapper_frozen_abi__test_digest_2zC1Q4tpzCGw88khu3Aab13zM4cQzeH9kq2SHtMyrhvc
--- /tmp/abi8/accounts_db__test_accounts_db_serialize__AccountsDBSerializeAbiTestWrapper_frozen_abi__test_digest_DAT7VpkAnXSw7r9pDHppJSqKCRYC8YAF4yCDAfkCbVE5   2020-02-21 12:41:47.146055549 +0900
+++ /tmp/abi8/accounts_db__test_accounts_db_serialize__AccountsDBSerializeAbiTestWrapper_frozen_abi__test_digest_2zC1Q4tpzCGw88khu3Aab13zM4cQzeH9kq2SHtMyrhvc   2020-02-21 12:48:42.452915738 +0900
@@ -1,30 +1,30 @@
 struct AccountsDBSerializeAbiTestWrapper (fields = 1)
     field owned: solana_runtime::accounts_db::test_accounts_db_serialize::_IMPL_SERIALIZE_FOR_AccountsDBSerializeAbiTestWrapper::<impl serde::ser::Serialize for solana_runtime::accounts_db::test_accounts_db_serialize::AccountsDBSerializeAbiTestWrapper>::serialize::__SerializeWith
         tuple (elements = 4)
             element solana_runtime::accounts_db::AccountStorageSerialize
                 map (entries = 1)
-                    key &u64
+                    key u64
                         primitive u64
-                    value alloc::vec::Vec<&alloc::sync::Arc<solana_runtime::accounts_db::AccountStorageEntry>>
+                    value &alloc::vec::Vec<alloc::sync::Arc<solana_runtime::accounts_db::AccountStorageEntry>>
                         seq (elements = 1)
-                            element &&alloc::sync::Arc<solana_runtime::accounts_db::AccountStorageEntry>
+                            element &alloc::sync::Arc<solana_runtime::accounts_db::AccountStorageEntry>
                                 struct AccountStorageEntry (fields = 3)
                                     field id: usize
                                         primitive u64
                                     field accounts: solana_runtime::append_vec::AppendVec
                                         bytes [u8] (len = 8)
                                     field count_and_status: std::sync::rwlock::RwLock<(usize, solana_runtime::accounts_db::AccountStorageStatus)>
                                         tuple (elements = 2)
                                             element usize
                                                 primitive u64
                                             element solana_runtime::accounts_db::AccountStorageStatus
                                                 enum AccountStorageStatus (variants = 3)
                                                     variant(0) Available (unit)
                                                     variant(1) Full (unit)
                                                     variant(2) Candidate (unit)
             element u64
                 primitive u64
             element u64
                 primitive u64
             element &solana_runtime::accounts_db::BankHashInfo
                 struct BankHashInfo (fields = 2)

Generated by this branch: https://github.com/ryoqun/solana/commits/abi-management-implementation-for-missing-storage-entry-handling

@mergify mergify Bot dismissed sakridge’s stale review February 21, 2020 05:04

Pull request has been modified.

@ryoqun
Copy link
Copy Markdown
Contributor Author

ryoqun commented Feb 21, 2020

@sakridge Does this look better?Still needs to add tests (added) and more local testing with TdS snapshots (tested). Also CI might not pass.... (CI passed), also I checked ABI as well.

All, prudent testing and preparation is done; now it's time to merge!

@sakridge Thanks for quick review!!

@ryoqun ryoqun merged commit d238371 into solana-labs:master Feb 21, 2020
mergify Bot pushed a commit that referenced this pull request Feb 21, 2020
* Correct missing entry handling to avoid bad warns

* Pass storage entries to AccountStorageSerialize

* Fix CI.....

* Add tests and reorder condition for cheapest first

* Remove unneeded reference

(cherry picked from commit d238371)

# Conflicts:
#	runtime/src/bank.rs
@ryoqun
Copy link
Copy Markdown
Contributor Author

ryoqun commented Feb 21, 2020

@mvines Btw, snapshots created after this PR doesn't anymore produce bad snapshots, which cause these scary warnings to be printed when loading from it as some validators are scared of:

[2020-02-16T17:20:43.188504734Z INFO  solana_runtime::accounts_db] Err(Custom { kind: Other, error: "Unable to move \"/home/vk/validator-ledger/snapshot/.tmpBQUoxR/accounts/1400272.5601273\" to \"/home/vk/validator-ledger/accounts\": entity not found" })
[2020-02-16T17:20:43.188544129Z WARN  solana_runtime::accounts_db] AccountsDB error: "Unable to move \"/home/vk/validator-ledger/snapshot/.tmpBQUoxR/accounts/1400272.5601280\" to \"/home/vk/validator-ledger/accounts\": entity not found"
[2020-02-16T17:20:43.188557641Z INFO  solana_runtime::accounts_db] Err(Custom { kind: Other, error: "Unable to move \"/home/vk/validator-ledger/snapshot/.tmpBQUoxR/accounts/1400272.5601280\" to \"/home/vk/validator-ledger/accounts\": entity not found" })
[2020-02-16T17:20:43.188608874Z WARN  solana_runtime::accounts_db] AccountsDB error: "Unable to move \"/home/vk/validator-ledger/snapshot/.tmpBQUoxR/accounts/1400272.5601283\" to \"/home/vk/validator-ledger/accounts\": entity not found"
[2020-02-16T17:20:43.188624977Z INFO  solana_runtime::accounts_db] Err(Custom { kind: Other, error: "Unable to move \"/home/vk/validator-ledger/snapshot/.tmpBQUoxR/accounts/1400272.5601283\" to \"/home/vk/validator-ledger/accounts\": entity not found" })

@mvines
Copy link
Copy Markdown
Contributor

mvines commented Feb 21, 2020

Awesome, thanks :)

@ryoqun ryoqun mentioned this pull request Feb 21, 2020
ryoqun added a commit to ryoqun/solana that referenced this pull request Feb 28, 2020
$ git diff --no-index /tmp/abi8/*{8HonGUuN4veVMzn6JBsUd2o7AkTRkkrKxy1bQeB5rnvE,EpX1HbzgTKh1jki8aVJKzTL3dWoA5cknxn6qr6WDrwm}*
diff --git a/tmp/abi8/accounts_db__test_accounts_db_serialize__AccountsDBSerializeAbiTestWrapper_frozen_abi__test_digest_8HonGUuN4veVMzn6JBsUd2o7AkTRkkrKxy1bQeB5rnvE b/tmp/abi8/accounts_db__test_accounts_db_serialize__AccountsDBSerializeAbiTestWrapper_frozen_abi__test_digest_EpX1HbzgTKh1jki8aVJKzTL3dWoA5cknxn6qr6WDrwm
index 2607110e2..92dbb9206 100644
--- a/tmp/abi8/accounts_db__test_accounts_db_serialize__AccountsDBSerializeAbiTestWrapper_frozen_abi__test_digest_8HonGUuN4veVMzn6JBsUd2o7AkTRkkrKxy1bQeB5rnvE
+++ b/tmp/abi8/accounts_db__test_accounts_db_serialize__AccountsDBSerializeAbiTestWrapper_frozen_abi__test_digest_EpX1HbzgTKh1jki8aVJKzTL3dWoA5cknxn6qr6WDrwm
@@ -1,3 +1,3 @@
 struct AccountsDBSerializeAbiTestWrapper (fields = 1)
     field owned: solana_runtime::accounts_db::test_accounts_db_serialize::_IMPL_SERIALIZE_FOR_AccountsDBSerializeAbiTestWrapper::<impl serde::ser::Serialize for solana_runtime::accounts_db::test_accounts_db_serialize::AccountsDBSerializeAbiTestWrapper>::serialize::__SerializeWith
-        bytes [u8] (len = 572)
+        bytes [u8] (len = 180)
Comment thread runtime/src/bank.rs
pub fn get_snapshot_storages(&self) -> SnapshotStorages {
self.rc
.get_snapshot_storages(self.slot())
.into_iter()
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

redundant me #17559

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants