parent
62e12e3af5
commit
a61ddb6f61
|
@ -39,12 +39,12 @@ impl LedgerCleanupService {
|
||||||
pub fn new(
|
pub fn new(
|
||||||
new_root_receiver: Receiver<Slot>,
|
new_root_receiver: Receiver<Slot>,
|
||||||
blockstore: Arc<Blockstore>,
|
blockstore: Arc<Blockstore>,
|
||||||
max_ledger_slots: u64,
|
max_ledger_shreds: u64,
|
||||||
exit: &Arc<AtomicBool>,
|
exit: &Arc<AtomicBool>,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
info!(
|
info!(
|
||||||
"LedgerCleanupService active. Max Ledger Slots {}",
|
"LedgerCleanupService active. Max Ledger Slots {}",
|
||||||
max_ledger_slots
|
max_ledger_shreds
|
||||||
);
|
);
|
||||||
let exit = exit.clone();
|
let exit = exit.clone();
|
||||||
let mut last_purge_slot = 0;
|
let mut last_purge_slot = 0;
|
||||||
|
@ -57,7 +57,7 @@ impl LedgerCleanupService {
|
||||||
if let Err(e) = Self::cleanup_ledger(
|
if let Err(e) = Self::cleanup_ledger(
|
||||||
&new_root_receiver,
|
&new_root_receiver,
|
||||||
&blockstore,
|
&blockstore,
|
||||||
max_ledger_slots,
|
max_ledger_shreds,
|
||||||
&mut last_purge_slot,
|
&mut last_purge_slot,
|
||||||
DEFAULT_PURGE_SLOT_INTERVAL,
|
DEFAULT_PURGE_SLOT_INTERVAL,
|
||||||
) {
|
) {
|
||||||
|
|
|
@ -63,7 +63,7 @@ pub struct Sockets {
|
||||||
|
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
pub struct TvuConfig {
|
pub struct TvuConfig {
|
||||||
pub max_ledger_slots: Option<u64>,
|
pub max_ledger_shreds: Option<u64>,
|
||||||
pub sigverify_disabled: bool,
|
pub sigverify_disabled: bool,
|
||||||
pub shred_version: u16,
|
pub shred_version: u16,
|
||||||
pub halt_on_trusted_validators_accounts_hash_mismatch: bool,
|
pub halt_on_trusted_validators_accounts_hash_mismatch: bool,
|
||||||
|
@ -202,11 +202,11 @@ impl Tvu {
|
||||||
retransmit_slots_sender,
|
retransmit_slots_sender,
|
||||||
);
|
);
|
||||||
|
|
||||||
let ledger_cleanup_service = tvu_config.max_ledger_slots.map(|max_ledger_slots| {
|
let ledger_cleanup_service = tvu_config.max_ledger_shreds.map(|max_ledger_shreds| {
|
||||||
LedgerCleanupService::new(
|
LedgerCleanupService::new(
|
||||||
ledger_cleanup_slot_receiver,
|
ledger_cleanup_slot_receiver,
|
||||||
blockstore.clone(),
|
blockstore.clone(),
|
||||||
max_ledger_slots,
|
max_ledger_shreds,
|
||||||
&exit,
|
&exit,
|
||||||
)
|
)
|
||||||
});
|
});
|
||||||
|
|
|
@ -70,7 +70,7 @@ pub struct ValidatorConfig {
|
||||||
pub rpc_config: JsonRpcConfig,
|
pub rpc_config: JsonRpcConfig,
|
||||||
pub rpc_ports: Option<(u16, u16)>, // (API, PubSub)
|
pub rpc_ports: Option<(u16, u16)>, // (API, PubSub)
|
||||||
pub snapshot_config: Option<SnapshotConfig>,
|
pub snapshot_config: Option<SnapshotConfig>,
|
||||||
pub max_ledger_slots: Option<u64>,
|
pub max_ledger_shreds: Option<u64>,
|
||||||
pub broadcast_stage_type: BroadcastStageType,
|
pub broadcast_stage_type: BroadcastStageType,
|
||||||
pub enable_partition: Option<Arc<AtomicBool>>,
|
pub enable_partition: Option<Arc<AtomicBool>>,
|
||||||
pub fixed_leader_schedule: Option<FixedSchedule>,
|
pub fixed_leader_schedule: Option<FixedSchedule>,
|
||||||
|
@ -92,7 +92,7 @@ impl Default for ValidatorConfig {
|
||||||
expected_shred_version: None,
|
expected_shred_version: None,
|
||||||
voting_disabled: false,
|
voting_disabled: false,
|
||||||
storage_slots_per_turn: DEFAULT_SLOTS_PER_TURN,
|
storage_slots_per_turn: DEFAULT_SLOTS_PER_TURN,
|
||||||
max_ledger_slots: None,
|
max_ledger_shreds: None,
|
||||||
account_paths: Vec::new(),
|
account_paths: Vec::new(),
|
||||||
rpc_config: JsonRpcConfig::default(),
|
rpc_config: JsonRpcConfig::default(),
|
||||||
rpc_ports: None,
|
rpc_ports: None,
|
||||||
|
@ -439,7 +439,7 @@ impl Validator {
|
||||||
vote_tracker.clone(),
|
vote_tracker.clone(),
|
||||||
retransmit_slots_sender,
|
retransmit_slots_sender,
|
||||||
TvuConfig {
|
TvuConfig {
|
||||||
max_ledger_slots: config.max_ledger_slots,
|
max_ledger_shreds: config.max_ledger_shreds,
|
||||||
sigverify_disabled: config.dev_sigverify_disabled,
|
sigverify_disabled: config.dev_sigverify_disabled,
|
||||||
halt_on_trusted_validators_accounts_hash_mismatch: config
|
halt_on_trusted_validators_accounts_hash_mismatch: config
|
||||||
.halt_on_trusted_validators_accounts_hash_mismatch,
|
.halt_on_trusted_validators_accounts_hash_mismatch,
|
||||||
|
|
|
@ -17,7 +17,7 @@ mod tests {
|
||||||
|
|
||||||
const DEFAULT_BENCHMARK_SLOTS: u64 = 50;
|
const DEFAULT_BENCHMARK_SLOTS: u64 = 50;
|
||||||
const DEFAULT_BATCH_SIZE: u64 = 1;
|
const DEFAULT_BATCH_SIZE: u64 = 1;
|
||||||
const DEFAULT_MAX_LEDGER_SLOTS: u64 = 50;
|
const DEFAULT_MAX_LEDGER_SHREDS: u64 = 50;
|
||||||
const DEFAULT_ENTRIES_PER_SLOT: u64 = 500;
|
const DEFAULT_ENTRIES_PER_SLOT: u64 = 500;
|
||||||
const DEFAULT_STOP_SIZE_BYTES: u64 = 0;
|
const DEFAULT_STOP_SIZE_BYTES: u64 = 0;
|
||||||
const DEFAULT_STOP_SIZE_ITERATIONS: u64 = 0;
|
const DEFAULT_STOP_SIZE_ITERATIONS: u64 = 0;
|
||||||
|
@ -28,7 +28,7 @@ mod tests {
|
||||||
struct BenchmarkConfig {
|
struct BenchmarkConfig {
|
||||||
pub benchmark_slots: u64,
|
pub benchmark_slots: u64,
|
||||||
pub batch_size: u64,
|
pub batch_size: u64,
|
||||||
pub max_ledger_slots: u64,
|
pub max_ledger_shreds: u64,
|
||||||
pub entries_per_slot: u64,
|
pub entries_per_slot: u64,
|
||||||
pub stop_size_bytes: u64,
|
pub stop_size_bytes: u64,
|
||||||
pub stop_size_iterations: u64,
|
pub stop_size_iterations: u64,
|
||||||
|
@ -145,7 +145,7 @@ mod tests {
|
||||||
fn get_benchmark_config() -> BenchmarkConfig {
|
fn get_benchmark_config() -> BenchmarkConfig {
|
||||||
let benchmark_slots = read_env("BENCHMARK_SLOTS", DEFAULT_BENCHMARK_SLOTS);
|
let benchmark_slots = read_env("BENCHMARK_SLOTS", DEFAULT_BENCHMARK_SLOTS);
|
||||||
let batch_size = read_env("BATCH_SIZE", DEFAULT_BATCH_SIZE);
|
let batch_size = read_env("BATCH_SIZE", DEFAULT_BATCH_SIZE);
|
||||||
let max_ledger_slots = read_env("MAX_LEDGER_SLOTS", DEFAULT_MAX_LEDGER_SLOTS);
|
let max_ledger_shreds = read_env("MAX_LEDGER_SHREDS", DEFAULT_MAX_LEDGER_SHREDS);
|
||||||
let entries_per_slot = read_env("ENTRIES_PER_SLOT", DEFAULT_ENTRIES_PER_SLOT);
|
let entries_per_slot = read_env("ENTRIES_PER_SLOT", DEFAULT_ENTRIES_PER_SLOT);
|
||||||
let stop_size_bytes = read_env("STOP_SIZE_BYTES", DEFAULT_STOP_SIZE_BYTES);
|
let stop_size_bytes = read_env("STOP_SIZE_BYTES", DEFAULT_STOP_SIZE_BYTES);
|
||||||
let stop_size_iterations = read_env("STOP_SIZE_ITERATIONS", DEFAULT_STOP_SIZE_ITERATIONS);
|
let stop_size_iterations = read_env("STOP_SIZE_ITERATIONS", DEFAULT_STOP_SIZE_ITERATIONS);
|
||||||
|
@ -158,7 +158,7 @@ mod tests {
|
||||||
BenchmarkConfig {
|
BenchmarkConfig {
|
||||||
benchmark_slots,
|
benchmark_slots,
|
||||||
batch_size,
|
batch_size,
|
||||||
max_ledger_slots,
|
max_ledger_shreds,
|
||||||
entries_per_slot,
|
entries_per_slot,
|
||||||
stop_size_bytes,
|
stop_size_bytes,
|
||||||
stop_size_iterations,
|
stop_size_iterations,
|
||||||
|
@ -217,7 +217,7 @@ mod tests {
|
||||||
|
|
||||||
let benchmark_slots = config.benchmark_slots;
|
let benchmark_slots = config.benchmark_slots;
|
||||||
let batch_size = config.batch_size;
|
let batch_size = config.batch_size;
|
||||||
let max_ledger_slots = config.max_ledger_slots;
|
let max_ledger_shreds = config.max_ledger_shreds;
|
||||||
let entries_per_slot = config.entries_per_slot;
|
let entries_per_slot = config.entries_per_slot;
|
||||||
let stop_size_bytes = config.stop_size_bytes;
|
let stop_size_bytes = config.stop_size_bytes;
|
||||||
let stop_size_iterations = config.stop_size_iterations;
|
let stop_size_iterations = config.stop_size_iterations;
|
||||||
|
@ -227,7 +227,7 @@ mod tests {
|
||||||
let (sender, receiver) = channel();
|
let (sender, receiver) = channel();
|
||||||
let exit = Arc::new(AtomicBool::new(false));
|
let exit = Arc::new(AtomicBool::new(false));
|
||||||
let cleaner =
|
let cleaner =
|
||||||
LedgerCleanupService::new(receiver, blockstore.clone(), max_ledger_slots, &exit);
|
LedgerCleanupService::new(receiver, blockstore.clone(), max_ledger_shreds, &exit);
|
||||||
|
|
||||||
let exit_cpu = Arc::new(AtomicBool::new(false));
|
let exit_cpu = Arc::new(AtomicBool::new(false));
|
||||||
let sys = CpuStatsUpdater::new(&exit_cpu);
|
let sys = CpuStatsUpdater::new(&exit_cpu);
|
||||||
|
@ -282,7 +282,7 @@ mod tests {
|
||||||
x,
|
x,
|
||||||
batch_size,
|
batch_size,
|
||||||
batch_size,
|
batch_size,
|
||||||
max_ledger_slots as i64,
|
max_ledger_shreds as i64,
|
||||||
&blockstore,
|
&blockstore,
|
||||||
&sys.get_stats(),
|
&sys.get_stats(),
|
||||||
);
|
);
|
||||||
|
@ -312,7 +312,7 @@ mod tests {
|
||||||
benchmark_slots,
|
benchmark_slots,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
max_ledger_slots as i64,
|
max_ledger_shreds as i64,
|
||||||
&blockstore,
|
&blockstore,
|
||||||
&sys.get_stats(),
|
&sys.get_stats(),
|
||||||
);
|
);
|
||||||
|
@ -333,7 +333,7 @@ mod tests {
|
||||||
benchmark_slots,
|
benchmark_slots,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
max_ledger_slots as i64,
|
max_ledger_shreds as i64,
|
||||||
&blockstore,
|
&blockstore,
|
||||||
&sys.get_stats(),
|
&sys.get_stats(),
|
||||||
);
|
);
|
||||||
|
|
|
@ -46,7 +46,7 @@ fn test_ledger_cleanup_service() {
|
||||||
error!("test_ledger_cleanup_service");
|
error!("test_ledger_cleanup_service");
|
||||||
let num_nodes = 3;
|
let num_nodes = 3;
|
||||||
let mut validator_config = ValidatorConfig::default();
|
let mut validator_config = ValidatorConfig::default();
|
||||||
validator_config.max_ledger_slots = Some(100);
|
validator_config.max_ledger_shreds = Some(100);
|
||||||
let config = ClusterConfig {
|
let config = ClusterConfig {
|
||||||
cluster_lamports: 10_000,
|
cluster_lamports: 10_000,
|
||||||
poh_config: PohConfig::new_sleep(Duration::from_millis(50)),
|
poh_config: PohConfig::new_sleep(Duration::from_millis(50)),
|
||||||
|
|
|
@ -857,7 +857,7 @@ pub fn main() {
|
||||||
);
|
);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
validator_config.max_ledger_slots = Some(limit_ledger_size);
|
validator_config.max_ledger_shreds = Some(limit_ledger_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
if matches.is_present("halt_on_trusted_validators_accounts_hash_mismatch") {
|
if matches.is_present("halt_on_trusted_validators_accounts_hash_mismatch") {
|
||||||
|
|
Loading…
Reference in New Issue