Skip to content

Commit

Permalink
use ACCOUNT_HISTORY_TABLES_TO_PRUNE var instead of 2 const
Browse files Browse the repository at this point in the history
  • Loading branch information
shekhirin committed Jul 8, 2024
1 parent cf205f7 commit c870e29
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
10 changes: 5 additions & 5 deletions crates/prune/prune/src/segments/account_history.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,11 @@ impl<DB: Database> Segment<DB> for AccountHistory {
// Deleted account changeset keys (account addresses) with the highest block number deleted
// for that key.
//
// The size of this map it's limited by `prune_delete_limit * blocks_since_last_run / 2`,
// and with current default it's usually `3500 * 5 / 2`, so 8750 entries.
// Each entry is `160 bit + 256 bit + 64 bit`, so the total size should be up to 0.5MB +
// some hashmap overhead. `blocks_since_last_run` is additionally limited by the
// `max_reorg_depth`, so no OOM is expected here.
// The size of this map it's limited by `prune_delete_limit * blocks_since_last_run /
// ACCOUNT_HISTORY_TABLES_TO_PRUNE`, and with current default it's usually `3500 * 5
// / 2`, so 8750 entries. Each entry is `160 bit + 256 bit + 64 bit`, so the total
// size should be up to 0.5MB + some hashmap overhead. `blocks_since_last_run` is
// additionally limited by the `max_reorg_depth`, so no OOM is expected here.
let mut highest_deleted_accounts = FxHashMap::default();
let (pruned_changesets, done) = provider
.prune_table_with_range::<tables::AccountChangeSets>(
Expand Down
10 changes: 5 additions & 5 deletions crates/prune/prune/src/segments/storage_history.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,11 @@ impl<DB: Database> Segment<DB> for StorageHistory {
// Deleted storage changeset keys (account addresses and storage slots) with the highest
// block number deleted for that key.
//
// The size of this map it's limited by `prune_delete_limit * blocks_since_last_run / 2`,
// and with current default it's usually `3500 * 5 / 2`, so 8750 entries.
// Each entry is `160 bit + 256 bit + 64 bit`, so the total size should be up to 0.5MB +
// some hashmap overhead. `blocks_since_last_run` is additionally limited by the
// `max_reorg_depth`, so no OOM is expected here.
// The size of this map it's limited by `prune_delete_limit * blocks_since_last_run /
// ACCOUNT_HISTORY_TABLES_TO_PRUNE`, and with current default it's usually `3500 * 5
// / 2`, so 8750 entries. Each entry is `160 bit + 256 bit + 64 bit`, so the total
// size should be up to 0.5MB + some hashmap overhead. `blocks_since_last_run` is
// additionally limited by the `max_reorg_depth`, so no OOM is expected here.
let mut highest_deleted_storages = FxHashMap::default();
let (pruned_changesets, done) = provider
.prune_table_with_range::<tables::StorageChangeSets>(
Expand Down

0 comments on commit c870e29

Please sign in to comment.