remove index hash calculation as an option (#23928)

This commit is contained in:
Jeff Washington (jwash) 2022-03-25 15:32:53 -05:00 committed by GitHub
parent ec78702bc8
commit c24de17278
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 13 additions and 24 deletions

View File

@ -98,7 +98,6 @@ pub struct TvuConfig {
pub accounts_hash_fault_injection_slots: u64,
pub accounts_db_caching_enabled: bool,
pub test_hash_calculation: bool,
pub use_index_hash_calculation: bool,
pub rocksdb_compaction_interval: Option<u64>,
pub rocksdb_max_compaction_jitter: Option<u64>,
pub wait_for_vote_to_start_leader: bool,
@ -358,7 +357,6 @@ impl Tvu {
accounts_background_request_handler,
tvu_config.accounts_db_caching_enabled,
tvu_config.test_hash_calculation,
tvu_config.use_index_hash_calculation,
last_full_snapshot_slot,
);

View File

@ -162,7 +162,6 @@ pub struct ValidatorConfig {
pub warp_slot: Option<Slot>,
pub accounts_db_test_hash_calculation: bool,
pub accounts_db_skip_shrink: bool,
pub accounts_db_use_index_hash_calculation: bool,
pub tpu_coalesce_ms: u64,
pub validator_exit: Arc<RwLock<Exit>>,
pub no_wait_for_vote_to_start_leader: bool,
@ -223,7 +222,6 @@ impl Default for ValidatorConfig {
warp_slot: None,
accounts_db_test_hash_calculation: false,
accounts_db_skip_shrink: false,
accounts_db_use_index_hash_calculation: true,
tpu_coalesce_ms: DEFAULT_TPU_COALESCE_MS,
validator_exit: Arc::new(RwLock::new(Exit::default())),
no_wait_for_vote_to_start_leader: true,
@ -915,7 +913,6 @@ impl Validator {
accounts_hash_fault_injection_slots: config.accounts_hash_fault_injection_slots,
accounts_db_caching_enabled: config.accounts_db_caching_enabled,
test_hash_calculation: config.accounts_db_test_hash_calculation,
use_index_hash_calculation: config.accounts_db_use_index_hash_calculation,
rocksdb_compaction_interval: config.rocksdb_compaction_interval,
rocksdb_max_compaction_jitter: config.rocksdb_compaction_interval,
wait_for_vote_to_start_leader,

View File

@ -265,8 +265,7 @@ mod tests {
// set_root should send a snapshot request
bank_forks.set_root(bank.slot(), &request_sender, None);
bank.update_accounts_hash();
snapshot_request_handler
.handle_snapshot_requests(false, false, false, 0, &mut None);
snapshot_request_handler.handle_snapshot_requests(false, false, 0, &mut None);
}
}
@ -707,7 +706,6 @@ mod tests {
bank_forks.set_root(bank.slot(), &request_sender, None);
bank.update_accounts_hash();
snapshot_request_handler.handle_snapshot_requests(
false,
false,
false,
0,
@ -947,7 +945,6 @@ mod tests {
&exit,
abs_request_handler,
false,
false,
true,
None,
);

View File

@ -1260,7 +1260,7 @@ fn load_frozen_forks(
new_root_bank.exhaustively_free_unused_resource(*last_full_snapshot_slot);
last_free = Instant::now();
new_root_bank.update_accounts_hash_with_index_option(
snapshot_config.accounts_hash_use_index,
false,
snapshot_config.accounts_hash_debug_verify,
false,
);

View File

@ -55,7 +55,6 @@ pub fn safe_clone_config(config: &ValidatorConfig) -> ValidatorConfig {
warp_slot: config.warp_slot,
accounts_db_test_hash_calculation: config.accounts_db_test_hash_calculation,
accounts_db_skip_shrink: config.accounts_db_skip_shrink,
accounts_db_use_index_hash_calculation: config.accounts_db_use_index_hash_calculation,
tpu_coalesce_ms: config.tpu_coalesce_ms,
validator_exit: Arc::new(RwLock::new(Exit::default())),
poh_hashes_per_batch: config.poh_hashes_per_batch,

View File

@ -94,7 +94,6 @@ impl SnapshotRequestHandler {
&self,
accounts_db_caching_enabled: bool,
test_hash_calculation: bool,
use_index_hash_calculation: bool,
non_snapshot_time_us: u128,
last_full_snapshot_slot: &mut Option<Slot>,
) -> Option<Result<u64, SnapshotError>> {
@ -145,6 +144,7 @@ impl SnapshotRequestHandler {
}
flush_accounts_cache_time.stop();
let use_index_hash_calculation = false;
let mut hash_time = Measure::start("hash_time");
let this_hash = snapshot_root_bank.update_accounts_hash_with_index_option(
use_index_hash_calculation,
@ -320,7 +320,6 @@ impl AbsRequestHandler {
&self,
accounts_db_caching_enabled: bool,
test_hash_calculation: bool,
use_index_hash_calculation: bool,
non_snapshot_time_us: u128,
last_full_snapshot_slot: &mut Option<Slot>,
) -> Option<Result<u64, SnapshotError>> {
@ -330,7 +329,6 @@ impl AbsRequestHandler {
snapshot_request_handler.handle_snapshot_requests(
accounts_db_caching_enabled,
test_hash_calculation,
use_index_hash_calculation,
non_snapshot_time_us,
last_full_snapshot_slot,
)
@ -362,7 +360,6 @@ impl AccountsBackgroundService {
request_handler: AbsRequestHandler,
accounts_db_caching_enabled: bool,
test_hash_calculation: bool,
use_index_hash_calculation: bool,
mut last_full_snapshot_slot: Option<Slot>,
) -> Self {
info!("AccountsBackgroundService active");
@ -421,7 +418,6 @@ impl AccountsBackgroundService {
.handle_snapshot_requests(
accounts_db_caching_enabled,
test_hash_calculation,
use_index_hash_calculation,
non_snapshot_time,
&mut last_full_snapshot_slot,
);

View File

@ -32,9 +32,6 @@ pub struct SnapshotConfig {
/// NOTE: Incremental snapshots will only be kept for the latest full snapshot
pub maximum_incremental_snapshot_archives_to_retain: usize,
/// This is the `use_index` parameter to use when calling `update_accounts_hash()`
pub accounts_hash_use_index: bool,
/// This is the `debug_verify` parameter to use when calling `update_accounts_hash()`
pub accounts_hash_debug_verify: bool,
@ -57,7 +54,6 @@ impl Default for SnapshotConfig {
snapshot_utils::DEFAULT_MAX_FULL_SNAPSHOT_ARCHIVES_TO_RETAIN,
maximum_incremental_snapshot_archives_to_retain:
snapshot_utils::DEFAULT_MAX_INCREMENTAL_SNAPSHOT_ARCHIVES_TO_RETAIN,
accounts_hash_use_index: false,
accounts_hash_debug_verify: false,
packager_thread_niceness_adj: 0,
}

View File

@ -1618,14 +1618,16 @@ pub fn main() {
Arg::with_name("accounts_db_index_hashing")
.long("accounts-db-index-hashing")
.help("Enables the use of the index in hash calculation in \
AccountsHashVerifier/Accounts Background Service."),
AccountsHashVerifier/Accounts Background Service.")
.hidden(true),
)
.arg(
Arg::with_name("no_accounts_db_index_hashing")
.long("no-accounts-db-index-hashing")
.help("This is obsolete. See --accounts-db-index-hashing. \
Disables the use of the index in hash calculation in \
AccountsHashVerifier/Accounts Background Service."),
AccountsHashVerifier/Accounts Background Service.")
.hidden(true),
)
.arg(
// legacy nop argument
@ -2329,6 +2331,12 @@ pub fn main() {
None
};
if matches.is_present("accounts_db_index_hashing") {
info!("The accounts hash is only calculated without using the index. --accounts-db-index-hashing is deprecated and can be removed from the command line");
}
if matches.is_present("no_accounts_db_index_hashing") {
info!("The accounts hash is only calculated without using the index. --no-accounts-db-index-hashing is deprecated and can be removed from the command line");
}
let mut validator_config = ValidatorConfig {
require_tower: matches.is_present("require_tower"),
tower_storage,
@ -2443,7 +2451,6 @@ pub fn main() {
accounts_db_test_hash_calculation: matches.is_present("accounts_db_test_hash_calculation"),
accounts_db_config,
accounts_db_skip_shrink: matches.is_present("accounts_db_skip_shrink"),
accounts_db_use_index_hash_calculation: matches.is_present("accounts_db_index_hashing"),
tpu_coalesce_ms,
no_wait_for_vote_to_start_leader: matches.is_present("no_wait_for_vote_to_start_leader"),
accounts_shrink_ratio,
@ -2586,7 +2593,6 @@ pub fn main() {
snapshot_version,
maximum_full_snapshot_archives_to_retain,
maximum_incremental_snapshot_archives_to_retain,
accounts_hash_use_index: validator_config.accounts_db_use_index_hash_calculation,
accounts_hash_debug_verify: validator_config.accounts_db_test_hash_calculation,
packager_thread_niceness_adj: snapshot_packager_niceness_adj,
});