Skip to content

Commit 7afb11f

Browse files
authored
validator: skip health check (solana-labs#33568)
* validator: skip health check * keep `healthy` as a boolean
1 parent bd8cfc9 commit 7afb11f

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

validator/src/cli.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1453,6 +1453,11 @@ pub fn app<'a>(version: &'a str, default_args: &'a DefaultArgs) -> App<'a, 'a> {
14531453
.long("skip-new-snapshot-check")
14541454
.help("Skip check for a new snapshot")
14551455
)
1456+
.arg(
1457+
Arg::with_name("skip_health_check")
1458+
.long("skip-health-check")
1459+
.help("Skip health check")
1460+
)
14561461
)
14571462
.subcommand(
14581463
SubCommand::with_name("authorized-voter")
@@ -1668,6 +1673,11 @@ pub fn app<'a>(version: &'a str, default_args: &'a DefaultArgs) -> App<'a, 'a> {
16681673
.long("skip-new-snapshot-check")
16691674
.help("Skip check for a new snapshot")
16701675
)
1676+
.arg(
1677+
Arg::with_name("skip_health_check")
1678+
.long("skip-health-check")
1679+
.help("Skip health check")
1680+
)
16711681
.after_help("Note: If this command exits with a non-zero status \
16721682
then this not a good time for a restart")
16731683
).

validator/src/main.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ fn wait_for_restart_window(
118118
min_idle_time_in_minutes: usize,
119119
max_delinquency_percentage: u8,
120120
skip_new_snapshot_check: bool,
121+
skip_health_check: bool,
121122
) -> Result<(), Box<dyn std::error::Error>> {
122123
let sleep_interval = Duration::from_secs(5);
123124

@@ -161,7 +162,7 @@ fn wait_for_restart_window(
161162
seen_incremential_snapshot |= snapshot_slot_info_has_incremential;
162163

163164
let epoch_info = rpc_client.get_epoch_info_with_commitment(CommitmentConfig::processed())?;
164-
let healthy = rpc_client.get_health().ok().is_some();
165+
let healthy = skip_health_check || rpc_client.get_health().ok().is_some();
165166
let delinquent_stake_percentage = {
166167
let vote_accounts = rpc_client.get_vote_accounts()?;
167168
let current_stake: u64 = vote_accounts
@@ -649,6 +650,7 @@ pub fn main() {
649650
let force = subcommand_matches.is_present("force");
650651
let monitor = subcommand_matches.is_present("monitor");
651652
let skip_new_snapshot_check = subcommand_matches.is_present("skip_new_snapshot_check");
653+
let skip_health_check = subcommand_matches.is_present("skip_health_check");
652654
let max_delinquent_stake =
653655
value_t_or_exit!(subcommand_matches, "max_delinquent_stake", u8);
654656

@@ -659,6 +661,7 @@ pub fn main() {
659661
min_idle_time,
660662
max_delinquent_stake,
661663
skip_new_snapshot_check,
664+
skip_health_check,
662665
)
663666
.unwrap_or_else(|err| {
664667
println!("{err}");
@@ -777,13 +780,15 @@ pub fn main() {
777780
let max_delinquent_stake =
778781
value_t_or_exit!(subcommand_matches, "max_delinquent_stake", u8);
779782
let skip_new_snapshot_check = subcommand_matches.is_present("skip_new_snapshot_check");
783+
let skip_health_check = subcommand_matches.is_present("skip_health_check");
780784

781785
wait_for_restart_window(
782786
&ledger_path,
783787
identity,
784788
min_idle_time,
785789
max_delinquent_stake,
786790
skip_new_snapshot_check,
791+
skip_health_check,
787792
)
788793
.unwrap_or_else(|err| {
789794
println!("{err}");

0 commit comments

Comments
 (0)