|
63 | 63 | BatchMessage, RESULT_KIND_PREPARED, |
64 | 64 | RESULT_KIND_SET_KEYSPACE, RESULT_KIND_ROWS, |
65 | 65 | RESULT_KIND_SCHEMA_CHANGE, ProtocolHandler, |
66 | | - RESULT_KIND_VOID) |
| 66 | + RESULT_KIND_VOID, ProtocolException) |
67 | 67 | from cassandra.metadata import Metadata, protect_name, murmur3, _NodeInfo |
68 | 68 | from cassandra.policies import (TokenAwarePolicy, DCAwareRoundRobinPolicy, SimpleConvictionPolicy, |
69 | 69 | ExponentialReconnectionPolicy, HostDistance, |
@@ -3548,6 +3548,14 @@ def _try_connect(self, host): |
3548 | 3548 | break |
3549 | 3549 | except ProtocolVersionUnsupported as e: |
3550 | 3550 | self._cluster.protocol_downgrade(host.endpoint, e.startup_version) |
| 3551 | + except ProtocolException as e: |
| 3552 | + # protocol v5 is out of beta in C* >=4.0-beta5 and is now the default driver |
| 3553 | + # protocol version. If the protocol version was not explicitly specified, |
| 3554 | + # and that the server raises a beta protocol error, we should downgrade. |
| 3555 | + if not self._cluster._protocol_version_explicit and e.is_beta_protocol_error: |
| 3556 | + self._cluster.protocol_downgrade(host.endpoint, self._cluster.protocol_version) |
| 3557 | + else: |
| 3558 | + raise |
3551 | 3559 |
|
3552 | 3560 | log.debug("[control connection] Established new connection %r, " |
3553 | 3561 | "registering watchers and refreshing schema and topology", |
|
0 commit comments