Introduce eager rent collection (#9527)
* Switch AccountsIndex.account_maps from HashMap to BTreeMap * Introduce eager rent collection * Start to add tests * Avoid too short eager rent collection cycles * Add more tests * Add more tests... * Refacotr!!!!!! * Refactoring follow up * More tiny cleanups * Don't rewrite 0-lamport accounts to be deterministic * Refactor a bit * Do hard fork, restore tests, and perf. mitigation * Fix build... * Refactor and add switch over for testnet (TdS) * Use to_be_bytes * cleanup * More tiny cleanup * Rebase cleanup * Set Bank::genesis_hash when resuming from snapshot * Reorder fns and clean ups * Better naming and commenting * Yet more naming clarifications * Make prefix width strictly uniform for 2-base partition_count * Fix typo... * Revert cluster-dependent gate * kick ci? * kick ci? * kick ci?
This commit is contained in:
		@@ -15,7 +15,7 @@ use solana_runtime::{
 | 
			
		||||
        MAX_SNAPSHOT_DATA_FILE_SIZE,
 | 
			
		||||
    },
 | 
			
		||||
};
 | 
			
		||||
use solana_sdk::{clock::Slot, hash::Hash, pubkey::Pubkey};
 | 
			
		||||
use solana_sdk::{clock::Slot, genesis_config::GenesisConfig, hash::Hash, pubkey::Pubkey};
 | 
			
		||||
use std::{
 | 
			
		||||
    cmp::Ordering,
 | 
			
		||||
    fs::{self, File},
 | 
			
		||||
@@ -451,6 +451,7 @@ pub fn bank_from_archive<P: AsRef<Path>>(
 | 
			
		||||
    snapshot_path: &PathBuf,
 | 
			
		||||
    snapshot_tar: P,
 | 
			
		||||
    compression: CompressionType,
 | 
			
		||||
    genesis_config: &GenesisConfig,
 | 
			
		||||
) -> Result<Bank> {
 | 
			
		||||
    // Untar the snapshot into a temp directory under `snapshot_config.snapshot_path()`
 | 
			
		||||
    let unpack_dir = tempfile::tempdir_in(snapshot_path)?;
 | 
			
		||||
@@ -470,6 +471,7 @@ pub fn bank_from_archive<P: AsRef<Path>>(
 | 
			
		||||
        frozen_account_pubkeys,
 | 
			
		||||
        &unpacked_snapshots_dir,
 | 
			
		||||
        unpacked_accounts_dir,
 | 
			
		||||
        genesis_config,
 | 
			
		||||
    )?;
 | 
			
		||||
 | 
			
		||||
    if !bank.verify_snapshot_bank() {
 | 
			
		||||
@@ -615,6 +617,7 @@ fn rebuild_bank_from_snapshots<P>(
 | 
			
		||||
    frozen_account_pubkeys: &[Pubkey],
 | 
			
		||||
    unpacked_snapshots_dir: &PathBuf,
 | 
			
		||||
    append_vecs_path: P,
 | 
			
		||||
    genesis_config: &GenesisConfig,
 | 
			
		||||
) -> Result<Bank>
 | 
			
		||||
where
 | 
			
		||||
    P: AsRef<Path>,
 | 
			
		||||
@@ -643,6 +646,7 @@ where
 | 
			
		||||
                    )));
 | 
			
		||||
                }
 | 
			
		||||
            };
 | 
			
		||||
            bank.operating_mode = Some(genesis_config.operating_mode);
 | 
			
		||||
            info!("Rebuilding accounts...");
 | 
			
		||||
            let rc = bank::BankRc::from_stream(
 | 
			
		||||
                account_paths,
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user