Update "limit-ledger-size" to use DeleteRange for much faster deletes (#7515)

* Update "limit-ledger-size" to use DeleteRange for much faster deletes

* Update core/src/ledger_cleanup_service.rs

Co-Authored-By: Michael Vines <mvines@gmail.com>

* Rewrite more idiomatically

* Move max_ledger_slots to a fn for clippy

* Remove unused import

* Detect when all columns have been purged and fix a bug in deletion

* Check that more than 1 column is actually deleted

* Add helper to test that ledger meets minimum slot bounds

* Remove manual batching of deletes

* Refactor to keep some N slots older than the highest root

* Define MAX_LEDGER_SLOTS that ledger_cleanup_service will try to keep around

* Refactor compact range
This commit is contained in:
Sagar Dhawan
2019-12-18 11:50:09 -08:00
committed by GitHub
parent 7392505bd8
commit 6a9005645a
6 changed files with 184 additions and 110 deletions

View File

@ -12,11 +12,11 @@ use solana_clap_utils::{
},
};
use solana_client::rpc_client::RpcClient;
use solana_core::ledger_cleanup_service::MAX_LEDGER_SLOTS;
use solana_core::{
cluster_info::{ClusterInfo, Node, VALIDATOR_PORT_RANGE},
contact_info::ContactInfo,
gossip_service::GossipService,
ledger_cleanup_service::DEFAULT_MAX_LEDGER_SLOTS,
validator::{Validator, ValidatorConfig},
};
use solana_ledger::bank_forks::SnapshotConfig;
@ -507,7 +507,7 @@ pub fn main() {
clap::Arg::with_name("limit_ledger_size")
.long("limit-ledger-size")
.takes_value(false)
.help("drop older slots in the ledger"),
.help("Drop older slots in the ledger"),
)
.arg(
clap::Arg::with_name("skip_poh_verify")
@ -635,7 +635,7 @@ pub fn main() {
});
if matches.is_present("limit_ledger_size") {
validator_config.max_ledger_slots = Some(DEFAULT_MAX_LEDGER_SLOTS);
validator_config.max_ledger_slots = Some(MAX_LEDGER_SLOTS);
}
if matches.value_of("signer_addr").is_some() {