scylladb / python-driver

ScyllaDB Python Driver, originally DataStax Python Driver for Apache Cassandra
https://python-driver.docs.scylladb.com
Apache License 2.0
70 stars 42 forks source link

Using WhiteListRoundRobinPolicy with public address, while node uses public address is broken #184

Closed fruch closed 1 year ago

fruch commented 1 year ago

When WhiteListRoundRobinPolicy is configured with the list of contact_points which are all public addresses the new code introduced by for cloud bundle, seems to be removing those from the list of host, while adding the new host with internal ips (cause this have the same host_ids), and we are left with no host to connect to

Ref: https://github.com/scylladb/scylla-cluster-tests/issues/5473

< t:2022-11-23 17:17:54,973 f:interface.py    l:97   c:cassandra.cluster    p:DEBUG > Connecting to cluster, contact points: ['13.51.52.79', '13.53.252.230', '13.49.166.9']; protocol version: 4
< t:2022-11-23 17:17:54,973 f:interface.py    l:97   c:cassandra.pool       p:DEBUG > Host **.**.**.**:9042 is now marked up
< t:2022-11-23 17:17:54,973 f:interface.py    l:97   c:cassandra.pool       p:DEBUG > Host **.**.**.**:9042 is now marked up
< t:2022-11-23 17:17:54,973 f:interface.py    l:97   c:cassandra.pool       p:DEBUG > Host **.**.**.**:9042 is now marked up
< t:2022-11-23 17:17:54,973 f:interface.py    l:97   c:cassandra.cluster    p:DEBUG > [control connection] Opening new connection to 13.51.52.79:9042
< t:2022-11-23 17:17:55,087 f:libevreactor.py l:87   c:cassandra.io.libevreactor p:DEBUG > Starting libev event loop
< t:2022-11-23 17:17:55,432 f:interface.py    l:97   c:cassandra.cluster    p:DEBUG > [control connection] Established new connection <LibevConnection(140128925615728) 13.51.52.79:9042>, registering watchers and refreshing schema and topology
< t:2022-11-23 17:17:55,885 f:interface.py    l:97   c:cassandra.cluster    p:DEBUG > [control connection] Refreshing node list and token map using preloaded results
< t:2022-11-23 17:17:55,886 f:interface.py    l:97   c:cassandra.cluster    p:DEBUG > [control connection] Found new host to connect to: 10.0.1.247:9042
< t:2022-11-23 17:17:55,886 f:interface.py    l:97   c:cassandra.cluster    p:INFO  > New Cassandra host <Host: 10.0.1.247:9042 eu-north> discovered
< t:2022-11-23 17:17:55,886 f:interface.py    l:97   c:cassandra.cluster    p:DEBUG > Handling new host <Host: 10.0.1.247:9042 eu-north> and notifying listeners
< t:2022-11-23 17:17:55,886 f:interface.py    l:97   c:cassandra.cluster    p:DEBUG > Not adding connection pool for new host <Host: 10.0.1.247:9042 eu-north> because the load balancing policy has marked it as IGNORED
< t:2022-11-23 17:17:55,886 f:interface.py    l:97   c:cassandra.cluster    p:DEBUG > [control connection] Found new host to connect to: 10.0.2.59:9042
< t:2022-11-23 17:17:55,886 f:interface.py    l:97   c:cassandra.cluster    p:INFO  > New Cassandra host <Host: 10.0.2.59:9042 eu-north> discovered
< t:2022-11-23 17:17:55,886 f:interface.py    l:97   c:cassandra.cluster    p:DEBUG > Handling new host <Host: 10.0.2.59:9042 eu-north> and notifying listeners
< t:2022-11-23 17:17:55,887 f:interface.py    l:97   c:cassandra.cluster    p:DEBUG > Not adding connection pool for new host <Host: 10.0.2.59:9042 eu-north> because the load balancing policy has marked it as IGNORED
< t:2022-11-23 17:17:55,887 f:interface.py    l:97   c:cassandra.cluster    p:DEBUG > [control connection] Removing host not found in peers metadata: <Host: 10.0.2.153:9042 eu-north>
< t:2022-11-23 17:17:55,887 f:interface.py    l:97   c:cassandra.cluster    p:DEBUG > [control connection] Removing host not found in peers metadata: <Host: **.**.**.**:9042>
< t:2022-11-23 17:17:55,887 f:interface.py    l:97   c:cassandra.cluster    p:DEBUG > [control connection] Removing host not found in peers metadata: <Host: **.**.**.**:9042>
< t:2022-11-23 17:17:55,887 f:interface.py    l:97   c:cassandra.cluster    p:DEBUG > [control connection] Finished fetching ring info
< t:2022-11-23 17:17:55,887 f:interface.py    l:97   c:cassandra.cluster    p:DEBUG > [control connection] Rebuilding token map due to topology changes
< t:2022-11-23 17:17:56,583 f:interface.py    l:97   c:cassandra.cluster    p:DEBUG > Control connection created
< t:2022-11-23 17:17:56,584 f:tester.py       l:370  c:LongevityTest        p:WARNING > Unable to set up Argus connection: Unable to connect to any servers
fruch commented 1 year ago

@zimnx seems like we been a bit too eager with the host_id implementation.

doesn't the gocql have something similar to WhiteListRoundRobinPolicy ? would it work ?