Skip to content

Commit b089741

Browse files
committed
Merge pull request apache#218 from datastax/PYTHON-163
PYTHON-163 - Don't try to connect to peers with incomplete meta
2 parents 360b2a9 + 4f7dfe3 commit b089741

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

cassandra/cluster.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2061,6 +2061,11 @@ def _refresh_node_list_and_token_map(self, connection, preloaded_results=None,
20612061
if not addr or addr in ["0.0.0.0", "::"]:
20622062
addr = row.get("peer")
20632063

2064+
tokens = row.get("tokens")
2065+
if not tokens:
2066+
log.warn("Excluding host (%s) with no tokens in system.peers table of %s." % (addr, connection.host))
2067+
continue
2068+
20642069
found_hosts.add(addr)
20652070

20662071
host = self._cluster.metadata.get_host(addr)
@@ -2073,7 +2078,6 @@ def _refresh_node_list_and_token_map(self, connection, preloaded_results=None,
20732078
else:
20742079
should_rebuild_token_map |= self._update_location_info(host, datacenter, rack)
20752080

2076-
tokens = row.get("tokens")
20772081
if partitioner and tokens:
20782082
token_map[host] = tokens
20792083

0 commit comments

Comments
 (0)