* fix typos
This commit is contained in:
HaoranYi 2022-03-05 20:46:46 -06:00 committed by GitHub
parent b8b7163b66
commit 463cd564cf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 8 deletions

View File

@ -170,14 +170,14 @@ type DashMapVersionHash = DashMap<Pubkey, (u64, Hash)>;
#[derive(Debug, Clone, Copy)] #[derive(Debug, Clone, Copy)]
pub enum AccountShrinkThreshold { pub enum AccountShrinkThreshold {
/// Measure the total space sparseness across all candididates /// Measure the total space sparseness across all candidates
/// And select the candidiates by using the top sparse account storage entries to shrink. /// And select the candidates by using the top sparse account storage entries to shrink.
/// The value is the overall shrink threshold measured as ratio of the total live bytes /// The value is the overall shrink threshold measured as ratio of the total live bytes
/// over the total bytes. /// over the total bytes.
TotalSpace { shrink_ratio: f64 }, TotalSpace { shrink_ratio: f64 },
/// Use the following option to shrink all stores whose alive ratio is below /// Use the following option to shrink all stores whose alive ratio is below
/// the specified threshold. /// the specified threshold.
IndividalStore { shrink_ratio: f64 }, IndividualStore { shrink_ratio: f64 },
} }
pub const DEFAULT_ACCOUNTS_SHRINK_OPTIMIZE_TOTAL_SPACE: bool = true; pub const DEFAULT_ACCOUNTS_SHRINK_OPTIMIZE_TOTAL_SPACE: bool = true;
pub const DEFAULT_ACCOUNTS_SHRINK_RATIO: f64 = 0.80; pub const DEFAULT_ACCOUNTS_SHRINK_RATIO: f64 = 0.80;
@ -6038,7 +6038,7 @@ impl AccountsDb {
AccountShrinkThreshold::TotalSpace { shrink_ratio: _ } => { AccountShrinkThreshold::TotalSpace { shrink_ratio: _ } => {
Self::page_align(store.alive_bytes() as u64) < store.total_bytes() Self::page_align(store.alive_bytes() as u64) < store.total_bytes()
} }
AccountShrinkThreshold::IndividalStore { shrink_ratio } => { AccountShrinkThreshold::IndividualStore { shrink_ratio } => {
(Self::page_align(store.alive_bytes() as u64) as f64 / store.total_bytes() as f64) (Self::page_align(store.alive_bytes() as u64) as f64 / store.total_bytes() as f64)
< shrink_ratio < shrink_ratio
} }
@ -13185,7 +13185,7 @@ pub mod tests {
(shrink_ratio * 100.) as u64 (shrink_ratio * 100.) as u64
) )
} }
AccountShrinkThreshold::IndividalStore { shrink_ratio: _ } => { AccountShrinkThreshold::IndividualStore { shrink_ratio: _ } => {
panic!("Expect the default to be TotalSpace") panic!("Expect the default to be TotalSpace")
} }
} }
@ -13196,7 +13196,7 @@ pub mod tests {
accounts.shrink_ratio = AccountShrinkThreshold::TotalSpace { shrink_ratio: 0.3 }; accounts.shrink_ratio = AccountShrinkThreshold::TotalSpace { shrink_ratio: 0.3 };
entry.alive_bytes.store(3000, Ordering::Release); entry.alive_bytes.store(3000, Ordering::Release);
assert!(accounts.is_candidate_for_shrink(&entry)); assert!(accounts.is_candidate_for_shrink(&entry));
accounts.shrink_ratio = AccountShrinkThreshold::IndividalStore { shrink_ratio: 0.3 }; accounts.shrink_ratio = AccountShrinkThreshold::IndividualStore { shrink_ratio: 0.3 };
assert!(!accounts.is_candidate_for_shrink(&entry)); assert!(!accounts.is_candidate_for_shrink(&entry));
} }

View File

@ -2458,7 +2458,7 @@ mod tests {
&expected_snapshots, &expected_snapshots,
); );
// retaiing 2, expecting the 2 newest to be retained // retaining 2, expecting the 2 newest to be retained
let expected_snapshots = vec![&snap2_name, &snap3_name]; let expected_snapshots = vec![&snap2_name, &snap3_name];
common_test_purge_old_snapshot_archives( common_test_purge_old_snapshot_archives(
&snapshot_names, &snapshot_names,

View File

@ -2100,7 +2100,7 @@ pub fn main() {
let accounts_shrink_ratio = if accounts_shrink_optimize_total_space { let accounts_shrink_ratio = if accounts_shrink_optimize_total_space {
AccountShrinkThreshold::TotalSpace { shrink_ratio } AccountShrinkThreshold::TotalSpace { shrink_ratio }
} else { } else {
AccountShrinkThreshold::IndividalStore { shrink_ratio } AccountShrinkThreshold::IndividualStore { shrink_ratio }
}; };
let entrypoint_addrs = values_t!(matches, "entrypoint", String) let entrypoint_addrs = values_t!(matches, "entrypoint", String)
.unwrap_or_default() .unwrap_or_default()