From 4be12ed4e259ee83c6aa5857c3000b26a269f8ff Mon Sep 17 00:00:00 2001 From: DimAn Date: Mon, 9 Oct 2023 02:33:53 +0300 Subject: [PATCH] validator: skip health check (#33568) * validator: skip health check * keep `healthy` as a boolean (cherry picked from commit 7afb11f1e6daa3e9bd93cfe203211de5b14ba56a) --- validator/src/cli.rs | 10 ++++++++++ validator/src/main.rs | 7 ++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/validator/src/cli.rs b/validator/src/cli.rs index 72e82ca13b56d9..511d007ca11bfa 100644 --- a/validator/src/cli.rs +++ b/validator/src/cli.rs @@ -1424,6 +1424,11 @@ pub fn app<'a>(version: &'a str, default_args: &'a DefaultArgs) -> App<'a, 'a> { .long("skip-new-snapshot-check") .help("Skip check for a new snapshot") ) + .arg( + Arg::with_name("skip_health_check") + .long("skip-health-check") + .help("Skip health check") + ) ) .subcommand( SubCommand::with_name("authorized-voter") @@ -1639,6 +1644,11 @@ pub fn app<'a>(version: &'a str, default_args: &'a DefaultArgs) -> App<'a, 'a> { .long("skip-new-snapshot-check") .help("Skip check for a new snapshot") ) + .arg( + Arg::with_name("skip_health_check") + .long("skip-health-check") + .help("Skip health check") + ) .after_help("Note: If this command exits with a non-zero status \ then this not a good time for a restart") ). diff --git a/validator/src/main.rs b/validator/src/main.rs index b97789061c9e3b..0c998b91c30309 100644 --- a/validator/src/main.rs +++ b/validator/src/main.rs @@ -118,6 +118,7 @@ fn wait_for_restart_window( min_idle_time_in_minutes: usize, max_delinquency_percentage: u8, skip_new_snapshot_check: bool, + skip_health_check: bool, ) -> Result<(), Box> { let sleep_interval = Duration::from_secs(5); @@ -161,7 +162,7 @@ fn wait_for_restart_window( seen_incremential_snapshot |= snapshot_slot_info_has_incremential; let epoch_info = rpc_client.get_epoch_info_with_commitment(CommitmentConfig::processed())?; - let healthy = rpc_client.get_health().ok().is_some(); + let healthy = skip_health_check || rpc_client.get_health().ok().is_some(); let delinquent_stake_percentage = { let vote_accounts = rpc_client.get_vote_accounts()?; let current_stake: u64 = vote_accounts @@ -649,6 +650,7 @@ pub fn main() { let force = subcommand_matches.is_present("force"); let monitor = subcommand_matches.is_present("monitor"); let skip_new_snapshot_check = subcommand_matches.is_present("skip_new_snapshot_check"); + let skip_health_check = subcommand_matches.is_present("skip_health_check"); let max_delinquent_stake = value_t_or_exit!(subcommand_matches, "max_delinquent_stake", u8); @@ -659,6 +661,7 @@ pub fn main() { min_idle_time, max_delinquent_stake, skip_new_snapshot_check, + skip_health_check, ) .unwrap_or_else(|err| { println!("{err}"); @@ -777,6 +780,7 @@ pub fn main() { let max_delinquent_stake = value_t_or_exit!(subcommand_matches, "max_delinquent_stake", u8); let skip_new_snapshot_check = subcommand_matches.is_present("skip_new_snapshot_check"); + let skip_health_check = subcommand_matches.is_present("skip_health_check"); wait_for_restart_window( &ledger_path, @@ -784,6 +788,7 @@ pub fn main() { min_idle_time, max_delinquent_stake, skip_new_snapshot_check, + skip_health_check, ) .unwrap_or_else(|err| { println!("{err}");