Allow contact debug interval to be adjusted (#13737)
This commit is contained in:
parent
ed82bf70f5
commit
c1eb350c47
|
@ -107,6 +107,7 @@ const MAX_PRUNE_DATA_NODES: usize = 32;
|
|||
const GOSSIP_PING_TOKEN_SIZE: usize = 32;
|
||||
const GOSSIP_PING_CACHE_CAPACITY: usize = 16384;
|
||||
const GOSSIP_PING_CACHE_TTL: Duration = Duration::from_secs(640);
|
||||
pub const DEFAULT_CONTACT_DEBUG_INTERVAL: u64 = 10_000;
|
||||
|
||||
#[derive(Debug, PartialEq, Eq)]
|
||||
pub enum ClusterInfoError {
|
||||
|
@ -298,6 +299,7 @@ pub struct ClusterInfo {
|
|||
stats: GossipStats,
|
||||
socket: UdpSocket,
|
||||
local_message_pending_push_queue: RwLock<Vec<(CrdsValue, u64)>>,
|
||||
contact_debug_interval: u64,
|
||||
}
|
||||
|
||||
impl Default for ClusterInfo {
|
||||
|
@ -553,6 +555,7 @@ impl ClusterInfo {
|
|||
stats: GossipStats::default(),
|
||||
socket: UdpSocket::bind("0.0.0.0:0").unwrap(),
|
||||
local_message_pending_push_queue: RwLock::new(vec![]),
|
||||
contact_debug_interval: DEFAULT_CONTACT_DEBUG_INTERVAL,
|
||||
};
|
||||
{
|
||||
let mut gossip = me.gossip.write().unwrap();
|
||||
|
@ -586,9 +589,14 @@ impl ClusterInfo {
|
|||
.unwrap()
|
||||
.clone(),
|
||||
),
|
||||
contact_debug_interval: self.contact_debug_interval,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn set_contact_debug_interval(&mut self, new: u64) {
|
||||
self.contact_debug_interval = new;
|
||||
}
|
||||
|
||||
pub fn update_contact_info<F>(&self, modify: F)
|
||||
where
|
||||
F: FnOnce(&mut ContactInfo),
|
||||
|
@ -1792,7 +1800,9 @@ impl ClusterInfo {
|
|||
loop {
|
||||
let start = timestamp();
|
||||
thread_mem_usage::datapoint("solana-gossip");
|
||||
if start - last_contact_info_trace > 10000 {
|
||||
if self.contact_debug_interval != 0
|
||||
&& start - last_contact_info_trace > self.contact_debug_interval
|
||||
{
|
||||
// Log contact info every 10 seconds
|
||||
info!(
|
||||
"\n{}\n\n{}",
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
use crate::{
|
||||
broadcast_stage::BroadcastStageType,
|
||||
cache_block_time_service::{CacheBlockTimeSender, CacheBlockTimeService},
|
||||
cluster_info::{ClusterInfo, Node},
|
||||
cluster_info::{ClusterInfo, Node, DEFAULT_CONTACT_DEBUG_INTERVAL},
|
||||
cluster_info_vote_listener::VoteTracker,
|
||||
completed_data_sets_service::CompletedDataSetsService,
|
||||
consensus::{reconcile_blockstore_roots_with_tower, Tower},
|
||||
|
@ -105,6 +105,7 @@ pub struct ValidatorConfig {
|
|||
pub cuda: bool,
|
||||
pub require_tower: bool,
|
||||
pub debug_keys: Option<Arc<HashSet<Pubkey>>>,
|
||||
pub contact_debug_interval: u64,
|
||||
}
|
||||
|
||||
impl Default for ValidatorConfig {
|
||||
|
@ -140,6 +141,7 @@ impl Default for ValidatorConfig {
|
|||
cuda: false,
|
||||
require_tower: false,
|
||||
debug_keys: None,
|
||||
contact_debug_interval: DEFAULT_CONTACT_DEBUG_INTERVAL,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -333,10 +335,9 @@ impl Validator {
|
|||
}
|
||||
}
|
||||
|
||||
let cluster_info = Arc::new(ClusterInfo::new(
|
||||
node.info.clone(),
|
||||
identity_keypair.clone(),
|
||||
));
|
||||
let mut cluster_info = ClusterInfo::new(node.info.clone(), identity_keypair.clone());
|
||||
cluster_info.set_contact_debug_interval(config.contact_debug_interval);
|
||||
let cluster_info = Arc::new(cluster_info);
|
||||
let mut block_commitment_cache = BlockCommitmentCache::default();
|
||||
block_commitment_cache.initialize_slots(bank.slot());
|
||||
let block_commitment_cache = Arc::new(RwLock::new(block_commitment_cache));
|
||||
|
|
|
@ -1099,6 +1099,14 @@ pub fn main() {
|
|||
.help("Number of slots between generating snapshots, \
|
||||
0 to disable snapshots"),
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("contact_debug_interval")
|
||||
.long("contact-debug-interval")
|
||||
.value_name("CONTACT_DEBUG_INTERVAL")
|
||||
.takes_value(true)
|
||||
.default_value("10000")
|
||||
.help("Milliseconds between printing contact debug from gossip."),
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("accounts_hash_interval_slots")
|
||||
.long("accounts-hash-slots")
|
||||
|
@ -1435,6 +1443,8 @@ pub fn main() {
|
|||
bind_address
|
||||
};
|
||||
|
||||
let contact_debug_interval = value_t_or_exit!(matches, "contact_debug_interval", u64);
|
||||
|
||||
let restricted_repair_only_mode = matches.is_present("restricted_repair_only_mode");
|
||||
let mut validator_config = ValidatorConfig {
|
||||
require_tower: matches.is_present("require_tower"),
|
||||
|
@ -1499,6 +1509,7 @@ pub fn main() {
|
|||
wal_recovery_mode,
|
||||
poh_verify: !matches.is_present("skip_poh_verify"),
|
||||
debug_keys,
|
||||
contact_debug_interval,
|
||||
..ValidatorConfig::default()
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue