Check if quic is enabled before warming up quic connections (#24821)

* Check if quic is enabled before warming up quic connections

* fix after rebase

* don't start warmup service if quic not enabled

* fix test
This commit is contained in:
Pankaj Garg 2022-04-30 20:52:38 -07:00 committed by GitHub
parent 06ffd9009e
commit 88c16c0176
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 24 additions and 5 deletions

View File

@ -68,7 +68,7 @@ pub struct Tvu {
ledger_cleanup_service: Option<LedgerCleanupService>,
cost_update_service: CostUpdateService,
voting_service: VotingService,
warm_quic_cache_service: WarmQuicCacheService,
warm_quic_cache_service: Option<WarmQuicCacheService>,
drop_bank_service: DropBankService,
transaction_cost_metrics_service: TransactionCostMetricsService,
}
@ -132,6 +132,7 @@ impl Tvu {
block_metadata_notifier: Option<BlockMetadataNotifierLock>,
wait_to_vote_slot: Option<Slot>,
accounts_background_request_sender: AbsRequestSender,
use_quic: bool,
) -> Self {
let TvuSockets {
repair: repair_socket,
@ -225,9 +226,15 @@ impl Tvu {
bank_forks.clone(),
);
let warm_quic_cache_service =
WarmQuicCacheService::new(cluster_info.clone(), poh_recorder.clone(), exit.clone());
let warm_quic_cache_service = if use_quic {
Some(WarmQuicCacheService::new(
cluster_info.clone(),
poh_recorder.clone(),
exit.clone(),
))
} else {
None
};
let (cost_update_sender, cost_update_receiver) = unbounded();
let cost_update_service =
CostUpdateService::new(blockstore.clone(), cost_model.clone(), cost_update_receiver);
@ -319,7 +326,9 @@ impl Tvu {
self.replay_stage.join()?;
self.cost_update_service.join()?;
self.voting_service.join()?;
self.warm_quic_cache_service.join()?;
if let Some(warmup_service) = self.warm_quic_cache_service {
warmup_service.join()?;
}
self.drop_bank_service.join()?;
self.transaction_cost_metrics_service.join()?;
Ok(())
@ -439,6 +448,7 @@ pub mod tests {
None,
None,
AbsRequestSender::default(),
false, // use_quic
);
exit.store(true, Ordering::Relaxed);
tvu.join().unwrap();

View File

@ -377,6 +377,7 @@ impl Validator {
should_check_duplicate_instance: bool,
start_progress: Arc<RwLock<ValidatorStartProgress>>,
socket_addr_space: SocketAddrSpace,
use_quic: bool,
) -> Self {
let id = identity_keypair.pubkey();
assert_eq!(id, node.info.id);
@ -961,6 +962,7 @@ impl Validator {
block_metadata_notifier,
config.wait_to_vote_slot,
accounts_background_request_sender,
use_quic,
);
let tpu = Tpu::new(
@ -2066,6 +2068,7 @@ mod tests {
true, // should_check_duplicate_instance
start_progress.clone(),
SocketAddrSpace::Unspecified,
false, // use_quic
);
assert_eq!(
*start_progress.read().unwrap(),
@ -2160,6 +2163,7 @@ mod tests {
true, // should_check_duplicate_instance
Arc::new(RwLock::new(ValidatorStartProgress::default())),
SocketAddrSpace::Unspecified,
false, // use_quic
)
})
.collect();

View File

@ -248,6 +248,7 @@ impl LocalCluster {
true, // should_check_duplicate_instance
Arc::new(RwLock::new(ValidatorStartProgress::default())),
socket_addr_space,
false, // use_quic
);
let mut validators = HashMap::new();
@ -441,6 +442,7 @@ impl LocalCluster {
true, // should_check_duplicate_instance
Arc::new(RwLock::new(ValidatorStartProgress::default())),
socket_addr_space,
false, // use_quic
);
let validator_pubkey = validator_keypair.pubkey();
@ -777,6 +779,7 @@ impl Cluster for LocalCluster {
true, // should_check_duplicate_instance
Arc::new(RwLock::new(ValidatorStartProgress::default())),
socket_addr_space,
false, // use_quic
);
cluster_validator_info.validator = Some(restarted_node);
cluster_validator_info

View File

@ -739,6 +739,7 @@ impl TestValidator {
true, // should_check_duplicate_instance
config.start_progress.clone(),
socket_addr_space,
false, // use_quic
));
// Needed to avoid panics in `solana-responder-gossip` in tests that create a number of

View File

@ -2931,6 +2931,7 @@ pub fn main() {
should_check_duplicate_instance,
start_progress,
socket_addr_space,
tpu_use_quic,
);
*admin_service_post_init.write().unwrap() =
Some(admin_rpc_service::AdminRpcRequestMetadataPostInit {