scylladb / python-driver

ScyllaDB Python Driver, originally DataStax Python Driver for Apache Cassandra

Home Page:https://python-driver.docs.scylladb.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`Cluster.refresh_nodes` immediately throws exception if control connection is down

avelanarius opened this issue · comments

As reported in scylladb/scylladb#17616, when a user calls Cluster's refresh_nodes() while the control connection is down, refresh_nodes() will fail with an exception:

cassandra.DriverException: Node list was not refreshed. See log for details.

As also suggested in #273, maybe the default behavior of the driver should be to wait for the (control) connection to come back instead of failing immediately.

Such a behavior should have some (configurable?) timeout to avoid waiting for an infinity. For this particular usecase, it might be an overkill to introduce a retry mechanism for this specific method.

Another "solution" to the problem would be to better signal to the driver users that this function can throw - or maybe redesign it to return a boolean (or some more detailed type) whether the operation succeed or failed - it would be the responsibility of the user to retry it (and the user would be more aware of this fact).