Skip to content

Commit 230b938

Browse files
committed
Update entrypoint and host_id only when SniEndPointFactory used
Since there are use cases when the user uses external address (i.e. not the node broadcast address), and not using `AddressTranslator`) the assumption of the user is that it would be able to connect and use the control connection without creating any more connection to other nodes. when we chnage the logic to work based on host_id, we decided to remove the initial control connection host, since it didn't had a correct host_name, which break this use case. so for now we'll leave the removal only for case we are sure it's the expect thing to happen, i.e. when `SniEndPointFactory` is used. Fix: #184
1 parent ce3a7b4 commit 230b938

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

cassandra/cluster.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3837,9 +3837,14 @@ def _refresh_node_list_and_token_map(self, connection, preloaded_results=None,
38373837
datacenter = local_row.get("data_center")
38383838
rack = local_row.get("rack")
38393839
self._update_location_info(host, datacenter, rack)
3840-
new_endpoint = self._cluster.endpoint_factory.create(local_row)
3841-
if new_endpoint.address:
3842-
host.endpoint = new_endpoint
3840+
3841+
# support the use case of connecting only with public address
3842+
if isinstance(self._cluster.endpoint_factory, SniEndPointFactory):
3843+
new_endpoint = self._cluster.endpoint_factory.create(local_row)
3844+
3845+
if new_endpoint.address:
3846+
host.endpoint = new_endpoint
3847+
38433848
host.host_id = local_row.get("host_id")
38443849

38453850
found_host_ids.add(host.host_id)

0 commit comments

Comments
 (0)