validator: Improve --dynamic-port-range and sys-tuner error messages (bp #9494) (#9496)

automerge
This commit is contained in:
mergify[bot]
2020-04-14 13:54:29 -07:00
committed by GitHub
parent adb0824da5
commit 6765453f8a
3 changed files with 20 additions and 5 deletions

View File

@ -65,6 +65,7 @@ use std::{
};
pub const VALIDATOR_PORT_RANGE: PortRange = (8000, 10_000);
pub const MINIMUM_VALIDATOR_PORT_RANGE_WIDTH: u16 = 10; // VALIDATOR_PORT_RANGE must be at least this wide
/// The Data plane fanout size, also used as the neighborhood size
pub const DATA_PLANE_FANOUT: usize = 200;

View File

@ -6,7 +6,13 @@ pub const SOLANA_SYS_TUNER_PATH: &str = "/tmp/solana-sys-tuner";
pub fn request_realtime_poh() {
info!("Sending tuning request");
let status = unix_socket::UnixStream::connect(SOLANA_SYS_TUNER_PATH);
info!("Tuning request status {:?}", status);
match status {
Ok(_) => info!("Successfully sent tuning request"),
Err(err) => warn!(
"Failed to send tuning request, is `solana-sys-tuner` running? {:?}",
err
),
}
}
#[cfg(not(unix))]

View File

@ -14,7 +14,7 @@ use solana_core::ledger_cleanup_service::{
DEFAULT_MAX_LEDGER_SHREDS, DEFAULT_MIN_MAX_LEDGER_SHREDS,
};
use solana_core::{
cluster_info::{ClusterInfo, Node, VALIDATOR_PORT_RANGE},
cluster_info::{ClusterInfo, Node, MINIMUM_VALIDATOR_PORT_RANGE_WIDTH, VALIDATOR_PORT_RANGE},
contact_info::ContactInfo,
gossip_service::GossipService,
rpc::JsonRpcConfig,
@ -52,8 +52,16 @@ fn port_validator(port: String) -> Result<(), String> {
}
fn port_range_validator(port_range: String) -> Result<(), String> {
if solana_net_utils::parse_port_range(&port_range).is_some() {
Ok(())
if let Some((start, end)) = solana_net_utils::parse_port_range(&port_range) {
if end - start < MINIMUM_VALIDATOR_PORT_RANGE_WIDTH {
Err(format!(
"Port range is too small. Try --dynamic-port-range {}-{}",
start,
start + MINIMUM_VALIDATOR_PORT_RANGE_WIDTH
))
} else {
Ok(())
}
} else {
Err("Invalid port range".to_string())
}
@ -514,7 +522,7 @@ pub fn main() {
.value_name("PORT")
.takes_value(true)
.validator(port_validator)
.help("RPC port to use for this node"),
.help("Use this port for JSON RPC, and the next port for the RPC websocket"),
)
.arg(
Arg::with_name("private_rpc")