diff --git a/cassandra/cluster.py b/cassandra/cluster.py index 4e099b1d72..de4b43b35b 100644 --- a/cassandra/cluster.py +++ b/cassandra/cluster.py @@ -2060,6 +2060,11 @@ def _refresh_node_list_and_token_map(self, connection, preloaded_results=None, if not addr or addr in ["0.0.0.0", "::"]: addr = row.get("peer") + tokens = row.get("tokens") + if not tokens: + log.warn("Excluding host (%s) with no tokens in system.peers table of %s." % (addr, connection.host)) + continue + found_hosts.add(addr) host = self._cluster.metadata.get_host(addr) @@ -2072,7 +2077,6 @@ def _refresh_node_list_and_token_map(self, connection, preloaded_results=None, else: should_rebuild_token_map |= self._update_location_info(host, datacenter, rack) - tokens = row.get("tokens") if partitioner and tokens: token_map[host] = tokens