ledger-tool create-snapshot uses write cache (#29119)

* ledger-tool create-snapshot uses write cache

* ledger tool create snapshot works with write cache
This commit is contained in:
Jeff Washington (jwash) 2022-12-08 08:09:52 -06:00 committed by GitHub
parent 019f276a91
commit 2f4731570a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 2 deletions

View File

@ -3018,6 +3018,7 @@ fn main() {
&genesis_config,
&blockstore,
ProcessOptions {
accounts_db_caching_enabled: true,
new_hard_forks,
halt_at_slot: Some(snapshot_slot),
poh_verify: false,

View File

@ -884,6 +884,7 @@ impl Accounts {
debug_verify: bool,
epoch_schedule: &EpochSchedule,
rent_collector: &RentCollector,
data_source: CalcAccountsHashDataSource,
) -> u64 {
let is_startup = true;
self.accounts_db
@ -891,7 +892,7 @@ impl Accounts {
.wait_for_complete();
self.accounts_db
.update_accounts_hash(
CalcAccountsHashDataSource::Storages,
data_source,
debug_verify,
slot,
ancestors,

View File

@ -7009,6 +7009,8 @@ impl Bank {
debug_verify,
self.epoch_schedule(),
&self.rent_collector,
// we have to use the index since the slot could be in the write cache still
CalcAccountsHashDataSource::IndexForTests,
)
}
@ -7031,7 +7033,10 @@ impl Bank {
/// This should only be used for developing purposes.
pub fn set_capitalization(&self) -> u64 {
let old = self.capitalization();
let debug_verify = true;
// We cannot debug verify the hash calculation here becuase calculate_capitalization will use the index calculation due to callers using the write cache.
// debug_verify only exists as an extra debugging step under the assumption that this code path is only used for tests. But, this is used by ledger-tool create-snapshot
// for example.
let debug_verify = false;
self.capitalization
.store(self.calculate_capitalization(debug_verify), Relaxed);
old