@@ -2550,7 +2550,8 @@ def on_down_potentially_blocking(
25502550 self , host : Host , is_host_addition : bool ,
25512551 down_epoch : Optional [int ] = None ,
25522552 expected_endpoint : Optional [EndPoint ] = None ,
2553- profile_manager_already_notified : bool = False ) -> Any :
2553+ profile_manager_already_notified : bool = False ,
2554+ control_connection_already_notified : bool = False ) -> Any :
25542555 pending_up_epoch = None
25552556 try :
25562557 down_endpoint = None
@@ -2580,7 +2581,8 @@ def on_down_potentially_blocking(
25802581 else :
25812582 if not profile_manager_already_notified :
25822583 self .profile_manager .on_down (host )
2583- self .control_connection .on_down (host )
2584+ if not control_connection_already_notified :
2585+ self .control_connection .on_down (host )
25842586 else :
25852587 log .debug ("Not signalling down for stale down handling on node %s; endpoint changed from %s" ,
25862588 host , expected_endpoint )
@@ -2640,7 +2642,8 @@ def on_down_potentially_blocking(
26402642 self ._handle_pending_node_up (host , pending_up_epoch )
26412643
26422644 def on_down (self , host , is_host_addition , expect_host_to_be_down = False ,
2643- expected_endpoint = None , profile_manager_already_notified = False ):
2645+ expected_endpoint = None , profile_manager_already_notified = False ,
2646+ control_connection_already_notified = False ):
26442647 """
26452648 Intended for internal use only.
26462649 """
@@ -2725,7 +2728,8 @@ def on_down(self, host, is_host_addition, expect_host_to_be_down=False,
27252728
27262729 future = self .on_down_potentially_blocking (
27272730 host , is_host_addition , down_epoch , expected_endpoint ,
2728- profile_manager_already_notified )
2731+ profile_manager_already_notified ,
2732+ control_connection_already_notified )
27292733 if future is None :
27302734 pending_down = None
27312735 pending_up_epoch = None
@@ -5024,18 +5028,20 @@ def _refresh_node_list_and_token_map(self, connection, preloaded_results=None,
50245028 reconnector .cancel ()
50255029 with host .lock :
50265030 old_endpoint = host .endpoint
5031+ self ._cluster .profile_manager .on_down (host )
5032+ self .on_down (host )
50275033 self ._cluster .on_down (
50285034 host , is_host_addition = False , expect_host_to_be_down = True ,
50295035 expected_endpoint = old_endpoint ,
5030- profile_manager_already_notified = True )
5036+ profile_manager_already_notified = True ,
5037+ control_connection_already_notified = True )
50315038
50325039 with host .lock :
50335040 if not self ._cluster ._endpoints_match (host .endpoint , old_endpoint ):
50345041 log .debug ("[control connection] Not updating host ip from %s to %s for (%s); "
50355042 "endpoint changed to %s" ,
50365043 old_endpoint , endpoint , host_id , host .endpoint )
50375044 continue
5038- self ._cluster .profile_manager .on_down (host )
50395045 host .endpoint = endpoint
50405046 self ._cluster .metadata .update_host (host , old_endpoint )
50415047 self ._cluster .on_up (host , expected_endpoint = endpoint )
0 commit comments