remove AccountsDb::initial_blockstore_processing_complete (#27974)

This commit is contained in:
Brooks Prumo 2022-09-22 13:52:04 -04:00 committed by GitHub
parent a846d50b6a
commit 1ee595ca9c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 11 additions and 53 deletions

View File

@ -104,7 +104,6 @@ impl SnapshotTestConfig {
);
bank0.freeze();
bank0.set_startup_verification_complete();
bank0.initial_blockstore_processing_completed();
let mut bank_forks = BankForks::new(bank0);
bank_forks.accounts_hash_interval_slots = accounts_hash_interval_slots;

View File

@ -859,8 +859,6 @@ pub fn process_blockstore_from_root(
let processing_time = now.elapsed();
bank.initial_blockstore_processing_completed();
datapoint_info!(
"process_blockstore_from_root",
("total_time_us", processing_time.as_micros(), i64),

View File

@ -1157,25 +1157,15 @@ fn test_incremental_snapshot_download_with_crossing_full_snapshot_interval_at_st
let validator_full_snapshot_archive_for_comparison = validator_full_snapshot_archives
.into_iter()
.find(|validator_full_snapshot_archive| {
[
leader_full_snapshot_archive_for_comparison.slot(),
leader_full_snapshot_archive_for_comparison.slot() + full_snapshot_interval,
]
.contains(&validator_full_snapshot_archive.slot())
validator_full_snapshot_archive.slot()
== leader_full_snapshot_archive_for_comparison.slot()
})
.expect("validator created an unexpected full snapshot");
info!("Validator full snapshot archive for comparison: {validator_full_snapshot_archive_for_comparison:#?}");
if validator_full_snapshot_archive_for_comparison.slot()
== leader_full_snapshot_archive_for_comparison.slot()
{
assert_eq!(
validator_full_snapshot_archive_for_comparison.hash(),
leader_full_snapshot_archive_for_comparison.hash(),
);
} else {
info!("Hash check skipped due to slot mismatch");
}
assert_eq!(
validator_full_snapshot_archive_for_comparison.hash(),
leader_full_snapshot_archive_for_comparison.hash(),
);
// And lastly, startup another node with the new snapshots to ensure they work
let final_validator_snapshot_test_config = SnapshotValidatorConfig::new(

View File

@ -1204,9 +1204,6 @@ pub struct AccountsDb {
/// debug feature to scan every append vec and verify refcounts are equal
exhaustively_verify_refcounts: bool,
/// true once all accounts hash calculations that may take place at startup have been requested
pub initial_blockstore_processing_complete: AtomicBool,
/// the full accounts hash calculation as of a predetermined block height 'N'
/// to be included in the bank hash at a predetermined block height 'M'
/// The cadence is once per epoch, all nodes calculate a full accounts hash as of a known slot calculated using 'N'
@ -2023,7 +2020,6 @@ impl AccountsDb {
num_hash_scan_passes,
log_dead_slots: AtomicBool::new(true),
exhaustively_verify_refcounts: false,
initial_blockstore_processing_complete: AtomicBool::new(false),
epoch_accounts_hash: Mutex::new(None),
}
}

View File

@ -163,7 +163,7 @@ use {
sync::{
atomic::{
AtomicBool, AtomicI64, AtomicU64, AtomicUsize,
Ordering::{AcqRel, Acquire, Relaxed, Release},
Ordering::{AcqRel, Acquire, Relaxed},
},
Arc, LockResult, RwLock, RwLockReadGuard, RwLockWriteGuard,
},
@ -7231,28 +7231,6 @@ impl Bank {
self.update_accounts_hash_with_index_option(true, false, false)
}
/// When the validator starts up, there is an initial hash calculation verification of the snapshot.
/// Then, in some conditions, there are additional slots replayed and a second hash calculation verification occurs.
/// This function is called when all initial hash calculations have been requested or completed.
pub fn initial_blockstore_processing_completed(&self) {
self.rc
.accounts
.accounts_db
.initial_blockstore_processing_complete
.store(true, Release);
}
/// until this occurs, no additional accounts hash calculations can be started
/// There will be 0..=2 of these requests.
pub fn is_initial_blockstore_processing_complete(&self) -> bool {
self.rc
.accounts
.accounts_db
.initial_blockstore_processing_complete
.load(Acquire)
&& self.is_startup_verification_complete()
}
/// A snapshot bank should be purged of 0 lamport accounts which are not part of the hash
/// calculation and could shield other real accounts.
pub fn verify_snapshot_bank(
@ -8174,7 +8152,9 @@ pub(crate) mod tests {
MAX_LOCKOUT_HISTORY,
},
},
std::{result, str::FromStr, thread::Builder, time::Duration},
std::{
result, str::FromStr, sync::atomic::Ordering::Release, thread::Builder, time::Duration,
},
test_utils::goto_end_of_slot,
};

View File

@ -276,7 +276,7 @@ impl BankForks {
if self.snapshot_config.is_some()
&& accounts_background_request_sender.is_snapshot_creation_enabled()
{
if bank.is_initial_blockstore_processing_complete() {
if bank.is_startup_verification_complete() {
// Save off the status cache because these may get pruned if another
// `set_root()` is called before the snapshots package can be generated
let status_cache_slot_deltas =

View File

@ -606,11 +606,6 @@ impl TestValidator {
.unwrap()
.root_bank()
.set_startup_verification_complete();
self.bank_forks()
.read()
.unwrap()
.root_bank()
.initial_blockstore_processing_completed();
}
/// Initialize the ledger directory