@@ -101,8 +101,6 @@ impl ServerManager {
101101 )
102102 . await ?;
103103 let address_translation = addresses. address_translation ( ) ;
104- println ! ( "INIT REPLICA CONNECTIONS: {:?}" , source_connections) ;
105- println ! ( "INIT REPLICAS: {:?}" , replicas) ;
106104 let server_manager = Self {
107105 configured_addresses : addresses,
108106 replicas : RwLock :: new ( filter_available_replicas ! ( replicas) . collect ( ) ) ,
@@ -159,7 +157,6 @@ impl ServerManager {
159157 for replica in & replicas {
160158 let private_address = replica. private_address ( ) . clone ( ) ;
161159 if !connection_addresses. contains ( & private_address) {
162- println ! ( "UPDATE REPLICA CONNECTION FOR {private_address:?}" ) ;
163160 match self . new_replica_connection ( replica. address ( ) . clone ( ) ) . await {
164161 Ok ( replica_connection) => {
165162 new_replica_connections. insert ( private_address, replica_connection) ;
@@ -174,10 +171,8 @@ impl ServerManager {
174171 let replica_addresses: HashSet < Address > =
175172 replicas. into_iter ( ) . map ( |replica| replica. private_address ( ) . clone ( ) ) . collect ( ) ;
176173 let mut replica_connections = self . write_replica_connections ( ) ;
177- println ! ( "REFRESH REPLICA CONNECTIONS. BEFORE: {:?}" , replica_connections) ;
178174 replica_connections. retain ( |address, _| replica_addresses. contains ( address) ) ;
179175 replica_connections. extend ( new_replica_connections) ;
180- println ! ( "REFRESH REPLICA CONNECTIONS. AFTER: {:?}" , replica_connections) ;
181176
182177 if replica_connections. is_empty ( ) {
183178 Err ( self . server_connection_failed_err ( connection_errors) )
@@ -208,9 +203,7 @@ impl ServerManager {
208203 ) -> Result < ServerConnection > {
209204 let replica_connection = self . new_replica_connection ( public_address) . await ?;
210205 let mut replica_connections = self . write_replica_connections ( ) ;
211- println ! ( "RECORD NEW REPLICA CONNECTION. BEFORE: {:?}" , replica_connections) ;
212206 replica_connections. insert ( private_address, replica_connection. clone ( ) ) ;
213- println ! ( "RECORD NEW REPLICA CONNECTION. AFTER: {:?}" , replica_connections) ;
214207 Ok ( replica_connection)
215208 }
216209
@@ -270,7 +263,6 @@ impl ServerManager {
270263 F : Fn ( ServerConnection ) -> P ,
271264 P : Future < Output = Result < R > > ,
272265 {
273- println ! ( "STRONG" ) ;
274266 let mut primary_replica = match self . read_primary_replica ( ) {
275267 Some ( replica) => replica,
276268 None => {
@@ -287,24 +279,20 @@ impl ServerManager {
287279 let retries = self . driver_options . primary_failover_retries ;
288280 let mut connection_errors = HashMap :: new ( ) ;
289281 for x in 0 ..=retries {
290- println ! ( "Retry {x} on {primary_replica:?}" ) ;
291282 let private_address = primary_replica. private_address ( ) . clone ( ) ;
292283 match self . execute_on ( primary_replica. address ( ) , & private_address, & task) . await {
293284 Err ( Error :: Connection ( connection_error) ) => {
294285 let replicas: HashSet < _ > = self . read_replicas ( ) . iter ( ) . cloned ( ) . collect ( ) ;
295286 let replicas_without_old_primary = replicas. into_iter ( ) . filter ( |replica| {
296- println ! ( "REPLICAS: Filter out? {private_address:?} vs mine {:?}" , replica. private_address( ) ) ;
297287 replica. private_address ( ) != & private_address
298288 } ) ;
299289 primary_replica = match & connection_error {
300290 ConnectionError :: ClusterReplicaNotPrimary => {
301- println ! ( "Not primary" ) ;
302291 debug ! ( "Could not connect to the primary replica: no longer primary. Retrying..." ) ;
303292 let replicas = iter:: once ( primary_replica) . chain ( replicas_without_old_primary) ;
304293 self . seek_primary_replica_in ( replicas) . await ?
305294 }
306295 err => {
307- println ! ( "ERROR STRONG" ) ;
308296 debug ! ( "Could not connect to the primary replica: {err:?}. Retrying..." ) ;
309297 self . seek_primary_replica_in ( replicas_without_old_primary) . await ?
310298 }
@@ -317,11 +305,9 @@ impl ServerManager {
317305 }
318306 }
319307 Err ( err) => {
320- println ! ( "ERROR RETURN res: {err:?}" ) ;
321308 return Err ( err) ;
322309 }
323310 res => {
324- println ! ( "res ok" ) ;
325311 return res;
326312 }
327313 }
@@ -339,13 +325,10 @@ impl ServerManager {
339325 F : Fn ( ServerConnection ) -> P ,
340326 P : Future < Output = Result < R > > ,
341327 {
342- println ! ( "ANY" ) ;
343328 let limit = self . driver_options . replica_discovery_attempts . unwrap_or ( usize:: MAX ) ;
344329 let mut connection_errors = HashMap :: new ( ) ;
345330 for ( attempt, replica) in enumerate ( replicas. into_iter ( ) ) {
346- println ! ( "ATTEMPT {attempt} with {limit}" ) ;
347331 if attempt == limit {
348- println ! ( "BREAK" ) ;
349332 break ;
350333 }
351334 // TODO: If we only use eventual consistency, we won't ever reconnect to disconnected /
@@ -355,7 +338,6 @@ impl ServerManager {
355338 return Err ( ConnectionError :: NotPrimaryOnReadOnly { address : replica. address ( ) . clone ( ) } . into ( ) ) ;
356339 }
357340 Err ( Error :: Connection ( error) ) => {
358- println ! ( "CONNECTION ERROR ANY: {error:?}" ) ;
359341 debug ! ( "Unable to connect to {}: {error:?}. May attempt the next server." , replica. address( ) ) ;
360342 connection_errors. insert ( replica. address ( ) . clone ( ) , error. into ( ) ) ;
361343 }
@@ -384,7 +366,6 @@ impl ServerManager {
384366 & self ,
385367 source_replicas : impl IntoIterator < Item = AvailableServerReplica > ,
386368 ) -> Result < AvailableServerReplica > {
387- println ! ( "SEEK" ) ;
388369 let result = self
389370 . execute_on_any ( source_replicas, |replica_connection| async {
390371 let result = self . seek_primary_replica ( replica_connection) . await ;
@@ -411,9 +392,7 @@ impl ServerManager {
411392 async fn seek_primary_replica ( & self , replica_connection : ServerConnection ) -> Result < AvailableServerReplica > {
412393 let address_translation = self . read_address_translation ( ) . clone ( ) ;
413394 if self . driver_options . use_replication {
414- println ! ( "SEEK PRIMARY REPLICA" ) ;
415395 let replicas = Self :: fetch_replicas_from_connection ( & replica_connection, & address_translation) . await ?;
416- println ! ( "WRITE NEW PRIMARY" ) ;
417396 * self . replicas . write ( ) . expect ( "Expected replicas write lock" ) =
418397 filter_available_replicas ! ( replicas) . collect ( ) ;
419398 }
@@ -427,7 +406,6 @@ impl ServerManager {
427406
428407 #[ cfg_attr( feature = "sync" , maybe_async:: must_be_sync) ]
429408 async fn wait_for_primary_replica_selection ( ) {
430- println ! ( "Wait for primary" ) ;
431409 // FIXME: blocking sleep! Can't do agnostic async sleep.
432410 sleep ( Self :: WAIT_FOR_PRIMARY_REPLICA_SELECTION ) ;
433411 }
@@ -444,9 +422,7 @@ impl ServerManager {
444422 ) -> Result < ( HashMap < Address , ServerConnection > , HashSet < ServerReplica > ) > {
445423 let address_translation = addresses. address_translation ( ) ;
446424 let mut errors = Vec :: with_capacity ( addresses. len ( ) ) ;
447- println ! ( "Fetch replicas from addresses: {addresses:?}" ) ;
448425 for address in addresses. addresses ( ) {
449- println ! ( "Fetch replicas. Address: {address:?}" ) ;
450426 let replica_connection = ServerConnection :: new (
451427 background_runtime. clone ( ) ,
452428 address. clone ( ) ,
@@ -474,17 +450,14 @@ impl ServerManager {
474450 }
475451 }
476452 Err ( Error :: Connection ( err) ) => {
477- println ! ( "Fetch replicas from addresses: push error {err:?}" ) ;
478453 debug ! ( "Unable to fetch replicas from {}: {err:?}. Attempting next server." , address) ;
479454 errors. push ( err) ;
480455 }
481456 Err ( err) => {
482- println ! ( "UNEXPECTED ERR: {err:?}" ) ;
483457 return Err ( err) ;
484458 }
485459 }
486460 }
487- println ! ( "Fetch replicas from addresses: SERVER CONNECTION FAILED! {errors:?}" ) ;
488461 Err ( ConnectionError :: ServerConnectionFailed {
489462 configured_addresses : addresses. clone ( ) ,
490463 accessed_addresses : addresses. clone ( ) ,
0 commit comments