@@ -3950,9 +3950,6 @@ def _refresh_node_list_and_token_map(self, connection, preloaded_results=None,
3950
3950
should_rebuild_token_map = force_token_rebuild or self ._cluster .metadata .partitioner is None
3951
3951
for row in peers_result :
3952
3952
if not self ._is_valid_peer (row ):
3953
- log .warning (
3954
- "Found an invalid row for peer (%s). Ignoring host." %
3955
- _NodeInfo .get_broadcast_rpc_address (row ))
3956
3953
continue
3957
3954
3958
3955
endpoint = self ._cluster .endpoint_factory .create (row )
@@ -4019,9 +4016,40 @@ def _refresh_node_list_and_token_map(self, connection, preloaded_results=None,
4019
4016
4020
4017
@staticmethod
4021
4018
def _is_valid_peer (row ):
4022
- return bool (_NodeInfo .get_broadcast_rpc_address (row ) and row .get ("host_id" ) and
4023
- row .get ("data_center" ) and row .get ("rack" ) and
4024
- ('tokens' not in row or row .get ('tokens' )))
4019
+ broadcast_rpc = _NodeInfo .get_broadcast_rpc_address (row )
4020
+ host_id = row .get ("host_id" )
4021
+
4022
+ if not broadcast_rpc :
4023
+ log .warning (
4024
+ "Found an invalid row for peer - missing broadcast_rpc (full row: %s). Ignoring host." %
4025
+ row )
4026
+ return False
4027
+
4028
+ if not host_id :
4029
+ log .warning (
4030
+ "Found an invalid row for peer - missing host_id (broadcast_rpc: %s). Ignoring host." %
4031
+ broadcast_rpc )
4032
+ return False
4033
+
4034
+ if not row .get ("data_center" ):
4035
+ log .warning (
4036
+ "Found an invalid row for peer - missing data_center (broadcast_rpc: %s, host_id: %s). Ignoring host." %
4037
+ (broadcast_rpc , host_id ))
4038
+ return False
4039
+
4040
+ if not row .get ("rack" ):
4041
+ log .warning (
4042
+ "Found an invalid row for peer - missing rack (broadcast_rpc: %s, host_id: %s). Ignoring host." %
4043
+ (broadcast_rpc , host_id ))
4044
+ return False
4045
+
4046
+ if "tokens" in row and not row .get ("tokens" ):
4047
+ log .warning (
4048
+ "Found an invalid row for peer - tokens is None (broadcast_rpc: %s, host_id: %s). Ignoring host." %
4049
+ (broadcast_rpc , host_id ))
4050
+ return False
4051
+
4052
+ return True
4025
4053
4026
4054
def _update_location_info (self , host , datacenter , rack ):
4027
4055
if host .datacenter == datacenter and host .rack == rack :
0 commit comments