@@ -3796,72 +3796,11 @@ def _refresh_node_list_and_token_map(self, connection, preloaded_results=None,
37963796 local_row = local_rows [0 ]
37973797 cluster_name = local_row ["cluster_name" ]
37983798 self ._cluster .metadata .cluster_name = cluster_name
3799-
38003799 partitioner = local_row .get ("partitioner" )
3801- tokens = local_row .get ("tokens" )
3802-
38033800 host = self ._cluster .metadata .get_host (connection .original_endpoint )
38043801 if not host :
38053802 log .info ("[control connection] Local host %s not found in metadata, adding it" , connection .original_endpoint )
38063803 peers_result .insert (0 , local_row )
3807- else :
3808- datacenter = local_row .get ("data_center" )
3809- rack = local_row .get ("rack" )
3810- self ._update_location_info (host , datacenter , rack )
3811-
3812- # support the use case of connecting only with public address
3813- if isinstance (self ._cluster .endpoint_factory , SniEndPointFactory ):
3814- new_endpoint = self ._cluster .endpoint_factory .create (local_row )
3815-
3816- if new_endpoint .address :
3817- host .endpoint = new_endpoint
3818-
3819- host .host_id = local_row .get ("host_id" )
3820-
3821- found_host_ids .add (host .host_id )
3822- found_endpoints .add (host .endpoint )
3823-
3824- host .listen_address = local_row .get ("listen_address" )
3825- host .listen_port = local_row .get ("listen_port" )
3826- host .broadcast_address = _NodeInfo .get_broadcast_address (local_row )
3827- host .broadcast_port = _NodeInfo .get_broadcast_port (local_row )
3828-
3829- host .broadcast_rpc_address = _NodeInfo .get_broadcast_rpc_address (local_row )
3830- host .broadcast_rpc_port = _NodeInfo .get_broadcast_rpc_port (local_row )
3831- if host .broadcast_rpc_address is None :
3832- if self ._token_meta_enabled :
3833- # local rpc_address is not available, use the connection endpoint
3834- host .broadcast_rpc_address = connection .endpoint .address
3835- host .broadcast_rpc_port = connection .endpoint .port
3836- else :
3837- # local rpc_address has not been queried yet, try to fetch it
3838- # separately, which might fail because C* < 2.1.6 doesn't have rpc_address
3839- # in system.local. See CASSANDRA-9436.
3840- local_rpc_address_query = QueryMessage (
3841- query = maybe_add_timeout_to_query (self ._SELECT_LOCAL_NO_TOKENS_RPC_ADDRESS , self ._metadata_request_timeout ),
3842- consistency_level = ConsistencyLevel .ONE )
3843- success , local_rpc_address_result = connection .wait_for_response (
3844- local_rpc_address_query , timeout = self ._timeout , fail_on_error = False )
3845- if success :
3846- row = dict_factory (
3847- local_rpc_address_result .column_names ,
3848- local_rpc_address_result .parsed_rows )
3849- host .broadcast_rpc_address = _NodeInfo .get_broadcast_rpc_address (row [0 ])
3850- host .broadcast_rpc_port = _NodeInfo .get_broadcast_rpc_port (row [0 ])
3851- else :
3852- host .broadcast_rpc_address = connection .endpoint .address
3853- host .broadcast_rpc_port = connection .endpoint .port
3854-
3855- host .release_version = local_row .get ("release_version" )
3856- host .dse_version = local_row .get ("dse_version" )
3857- host .dse_workload = local_row .get ("workload" )
3858- host .dse_workloads = local_row .get ("workloads" )
3859-
3860- if partitioner and tokens :
3861- token_map [host ] = tokens
3862-
3863- self ._cluster .metadata .update_host (host , old_endpoint = connection .endpoint )
3864- connection .original_endpoint = connection .endpoint = host .endpoint
38653804 # Check metadata.partitioner to see if we haven't built anything yet. If
38663805 # every node in the cluster was in the contact points, we won't discover
38673806 # any new nodes, so we need this additional check. (See PYTHON-90)
0 commit comments