diff --git a/scylla/src/transport/cluster.rs b/scylla/src/transport/cluster.rs index 7cd11dcdab..346a89bb3e 100644 --- a/scylla/src/transport/cluster.rs +++ b/scylla/src/transport/cluster.rs @@ -155,6 +155,7 @@ impl Cluster { let mut metadata_reader = MetadataReader::new( known_nodes, + pool_config.hostname_resolution_timeout, control_connection_repair_sender, pool_config.connection_config.clone(), pool_config.keepalive_interval, diff --git a/scylla/src/transport/connection_pool.rs b/scylla/src/transport/connection_pool.rs index 54d70c0eb8..3035d244a1 100644 --- a/scylla/src/transport/connection_pool.rs +++ b/scylla/src/transport/connection_pool.rs @@ -60,6 +60,7 @@ pub(crate) struct PoolConfig { pub(crate) pool_size: PoolSize, pub(crate) can_use_shard_aware_port: bool, pub(crate) keepalive_interval: Option, + pub(crate) hostname_resolution_timeout: Option, } impl Default for PoolConfig { @@ -69,6 +70,7 @@ impl Default for PoolConfig { pool_size: Default::default(), can_use_shard_aware_port: true, keepalive_interval: None, + hostname_resolution_timeout: None, } } } diff --git a/scylla/src/transport/session.rs b/scylla/src/transport/session.rs index 43fce28a38..50b0d0aaee 100644 --- a/scylla/src/transport/session.rs +++ b/scylla/src/transport/session.rs @@ -549,6 +549,7 @@ impl Session { pool_size: config.connection_pool_size, can_use_shard_aware_port: !config.disallow_shard_aware_port, keepalive_interval: config.keepalive_interval, + hostname_resolution_timeout: config.hostname_resolution_timeout, }; let cluster = Cluster::new( diff --git a/scylla/src/transport/topology.rs b/scylla/src/transport/topology.rs index 93a80d2fa0..b2bb00cc8b 100644 --- a/scylla/src/transport/topology.rs +++ b/scylla/src/transport/topology.rs @@ -39,6 +39,7 @@ use super::node::{InternalKnownNode, NodeAddr, ResolvedContactPoint}; pub(crate) struct MetadataReader { connection_config: ConnectionConfig, keepalive_interval: Option, + hostname_resolution_timeout: Option, control_connection_endpoint: UntranslatedEndpoint, control_connection: NodeConnectionPool, @@ -452,6 +453,7 @@ impl MetadataReader { #[allow(clippy::too_many_arguments)] pub(crate) async fn new( initial_known_nodes: Vec, + hostname_resolution_timeout: Option, control_connection_repair_requester: broadcast::Sender<()>, mut connection_config: ConnectionConfig, keepalive_interval: Option, @@ -485,6 +487,7 @@ impl MetadataReader { control_connection_endpoint.clone(), connection_config.clone(), keepalive_interval, + hostname_resolution_timeout, control_connection_repair_requester.clone(), ); @@ -492,6 +495,7 @@ impl MetadataReader { control_connection_endpoint, control_connection, keepalive_interval, + hostname_resolution_timeout, connection_config, known_peers: initial_peers .into_iter() @@ -612,6 +616,7 @@ impl MetadataReader { self.control_connection_endpoint.clone(), self.connection_config.clone(), self.keepalive_interval, + self.hostname_resolution_timeout, self.control_connection_repair_requester.clone(), ); @@ -712,6 +717,7 @@ impl MetadataReader { self.control_connection_endpoint.clone(), self.connection_config.clone(), self.keepalive_interval, + self.hostname_resolution_timeout, self.control_connection_repair_requester.clone(), ); } @@ -723,11 +729,13 @@ impl MetadataReader { endpoint: UntranslatedEndpoint, connection_config: ConnectionConfig, keepalive_interval: Option, + hostname_resolution_timeout: Option, refresh_requester: broadcast::Sender<()>, ) -> NodeConnectionPool { let pool_config = PoolConfig { connection_config, keepalive_interval, + hostname_resolution_timeout, // We want to have only one connection to receive events from pool_size: PoolSize::PerHost(NonZeroUsize::new(1).unwrap()),