--limit-ledger-size now accepts an optional slot count value
This commit is contained in:
@ -16,7 +16,7 @@ use std::time::Duration;
|
|||||||
// - A validator to download a snapshot from a peer and boot from it
|
// - A validator to download a snapshot from a peer and boot from it
|
||||||
// - To make sure that if a validator needs to reboot from its own snapshot, it has enough slots locally
|
// - To make sure that if a validator needs to reboot from its own snapshot, it has enough slots locally
|
||||||
// to catch back up to where it was when it stopped
|
// to catch back up to where it was when it stopped
|
||||||
pub const MAX_LEDGER_SLOTS: u64 = 6400;
|
pub const DEFAULT_MAX_LEDGER_SLOTS: u64 = 6400;
|
||||||
// Remove a fixed number of slots at a time, it's more efficient than doing it one-by-one
|
// Remove a fixed number of slots at a time, it's more efficient than doing it one-by-one
|
||||||
pub const DEFAULT_PURGE_BATCH_SIZE: u64 = 256;
|
pub const DEFAULT_PURGE_BATCH_SIZE: u64 = 256;
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ use solana_clap_utils::{
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
use solana_client::rpc_client::RpcClient;
|
use solana_client::rpc_client::RpcClient;
|
||||||
use solana_core::ledger_cleanup_service::MAX_LEDGER_SLOTS;
|
use solana_core::ledger_cleanup_service::DEFAULT_MAX_LEDGER_SLOTS;
|
||||||
use solana_core::{
|
use solana_core::{
|
||||||
cluster_info::{ClusterInfo, Node, VALIDATOR_PORT_RANGE},
|
cluster_info::{ClusterInfo, Node, VALIDATOR_PORT_RANGE},
|
||||||
contact_info::ContactInfo,
|
contact_info::ContactInfo,
|
||||||
@ -344,6 +344,7 @@ fn download_ledger(
|
|||||||
pub fn main() {
|
pub fn main() {
|
||||||
let default_dynamic_port_range =
|
let default_dynamic_port_range =
|
||||||
&format!("{}-{}", VALIDATOR_PORT_RANGE.0, VALIDATOR_PORT_RANGE.1);
|
&format!("{}-{}", VALIDATOR_PORT_RANGE.0, VALIDATOR_PORT_RANGE.1);
|
||||||
|
let default_limit_ledger_size = &DEFAULT_MAX_LEDGER_SLOTS.to_string();
|
||||||
|
|
||||||
let matches = App::new(crate_name!()).about(crate_description!())
|
let matches = App::new(crate_name!()).about(crate_description!())
|
||||||
.version(solana_clap_utils::version!())
|
.version(solana_clap_utils::version!())
|
||||||
@ -534,8 +535,12 @@ pub fn main() {
|
|||||||
.arg(
|
.arg(
|
||||||
clap::Arg::with_name("limit_ledger_size")
|
clap::Arg::with_name("limit_ledger_size")
|
||||||
.long("limit-ledger-size")
|
.long("limit-ledger-size")
|
||||||
.takes_value(false)
|
.value_name("SLOT_COUNT")
|
||||||
.help("Drop older slots in the ledger"),
|
.takes_value(true)
|
||||||
|
.min_values(0)
|
||||||
|
.max_values(1)
|
||||||
|
.default_value(default_limit_ledger_size)
|
||||||
|
.help("Drop ledger data for slots older than this value"),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
clap::Arg::with_name("skip_poh_verify")
|
clap::Arg::with_name("skip_poh_verify")
|
||||||
@ -671,7 +676,15 @@ pub fn main() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
if matches.is_present("limit_ledger_size") {
|
if matches.is_present("limit_ledger_size") {
|
||||||
validator_config.max_ledger_slots = Some(MAX_LEDGER_SLOTS);
|
let limit_ledger_size = value_t_or_exit!(matches, "limit_ledger_size", u64);
|
||||||
|
if limit_ledger_size < DEFAULT_MAX_LEDGER_SLOTS {
|
||||||
|
eprintln!(
|
||||||
|
"The provided --limit-ledger-size value was too small, the minimum value is {}",
|
||||||
|
DEFAULT_MAX_LEDGER_SLOTS
|
||||||
|
);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
validator_config.max_ledger_slots = Some(limit_ledger_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
if matches.value_of("signer_addr").is_some() {
|
if matches.value_of("signer_addr").is_some() {
|
||||||
|
Reference in New Issue
Block a user