Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make ancient appending default to packing #1224

Merged
merged 4 commits into from
May 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions accounts-db/src/accounts_db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,9 @@ const SHRINK_COLLECT_CHUNK_SIZE: usize = 50;
#[derive(Debug, Default, Clone, Copy, PartialEq, Eq)]
pub enum CreateAncientStorage {
/// ancient storages are created by appending
#[default]
Append,
/// ancient storages are created by 1-shot write to pack multiple accounts together more efficiently with new formats
#[default]
Pack,
}

Expand Down Expand Up @@ -2379,7 +2379,7 @@ impl AccountsDb {
const ACCOUNTS_STACK_SIZE: usize = 8 * 1024 * 1024;

AccountsDb {
create_ancient_storage: CreateAncientStorage::Pack,
create_ancient_storage: CreateAncientStorage::default(),
verify_accounts_hash_in_bg: VerifyAccountsHashInBackground::default(),
active_stats: ActiveStats::default(),
skip_initial_hash_calc: false,
Expand Down Expand Up @@ -2513,7 +2513,7 @@ impl AccountsDb {
let create_ancient_storage = accounts_db_config
.as_ref()
.map(|config| config.create_ancient_storage)
.unwrap_or(CreateAncientStorage::Append);
.unwrap_or_default();

let test_partitioned_epoch_rewards = accounts_db_config
.as_ref()
Expand Down Expand Up @@ -4400,7 +4400,9 @@ impl AccountsDb {
.slots_considered
.fetch_add(1, Ordering::Relaxed);

if is_ancient(accounts) {
// if an append vec is at least 80% of the ideal capacity of an ancient append vec, that's close enough.
// If we packed, then we end up allocating exact size ancient append vecs. Those will likely never be exactly the ideal ancient capacity.
if accounts.capacity() * 100 / get_ancient_append_vec_capacity() > 80 {
self.shrink_ancient_stats
.ancient_scanned
.fetch_add(1, Ordering::Relaxed);
Expand Down
Loading