Improve warning message when protocol downgrade is used
also don't log error when we're defuncting for unsupported protocol PYTHON-157
This commit is contained in:
@@ -868,7 +868,9 @@ class Cluster(object):
|
|||||||
new_version = previous_version - 1
|
new_version = previous_version - 1
|
||||||
if new_version < self.protocol_version:
|
if new_version < self.protocol_version:
|
||||||
if new_version >= MIN_SUPPORTED_VERSION:
|
if new_version >= MIN_SUPPORTED_VERSION:
|
||||||
log.warning("Downgrading core protocol version from %d to %d for %s", self.protocol_version, new_version, host_addr)
|
log.warning("Downgrading core protocol version from %d to %d for %s. "
|
||||||
|
"To avoid this, it is best practice to explicitly set Cluster(protocol_version) to the version supported by your cluster. "
|
||||||
|
"http://datastax.github.io/python-driver/api/cassandra/cluster.html#cassandra.cluster.Cluster.protocol_version", self.protocol_version, new_version, host_addr)
|
||||||
self.protocol_version = new_version
|
self.protocol_version = new_version
|
||||||
else:
|
else:
|
||||||
raise DriverException("Cannot downgrade protocol version (%d) below minimum supported version: %d" % (new_version, MIN_SUPPORTED_VERSION))
|
raise DriverException("Cannot downgrade protocol version (%d) below minimum supported version: %d" % (new_version, MIN_SUPPORTED_VERSION))
|
||||||
|
|||||||
@@ -601,8 +601,8 @@ class Connection(object):
|
|||||||
if isinstance(response, ProtocolException):
|
if isinstance(response, ProtocolException):
|
||||||
if 'unsupported protocol version' in response.message:
|
if 'unsupported protocol version' in response.message:
|
||||||
self.is_unsupported_proto_version = True
|
self.is_unsupported_proto_version = True
|
||||||
|
else:
|
||||||
log.error("Closing connection %s due to protocol error: %s", self, response.summary_msg())
|
log.error("Closing connection %s due to protocol error: %s", self, response.summary_msg())
|
||||||
self.defunct(response)
|
self.defunct(response)
|
||||||
if callback is not None:
|
if callback is not None:
|
||||||
callback(response)
|
callback(response)
|
||||||
|
|||||||
Reference in New Issue
Block a user