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

Add support for ScyllaDB's per partition rate limiting's new error #251

Closed sylwiaszunejko closed 1 year ago

sylwiaszunejko commented 1 year ago

This PR adds support for a Scylla-specific type of error returned from the database: RateLimitExceeded. The RateLimitExceeded error is sent when Scylla detects that the per-partition rate limit is exceeded.

In order for Scylla to be able to send this error, the driver must tell the database during connection handshake that it is able to interpret it (otherwise Scylla falls back to the ConfigurationExceptionerror). This PR adds support for Scylla-specific protocol extensions, negotiates the SCYLLA_RATE_LIMIT_ERROR during handshake and adds support for the RateLimitExceeded error decoding.

Fixes: #173

fruch commented 1 year ago

@sylwiaszunejko

sylwiaszunejko commented 1 year ago

@sylwiaszunejko

* it would be nice if there would be a part in the docs, explaining the usage of the feature, with a small code sample

* unittest for the newly introduced code/logic might be helpful as well

Where in the docs should this part be placed? In a new file or in one of the existing ones??

fruch commented 1 year ago

@sylwiaszunejko

* it would be nice if there would be a part in the docs, explaining the usage of the feature, with a small code sample

* unittest for the newly introduced code/logic might be helpful as well

Where in the docs should this part be placed? In a new file or in one of the existing ones??

I think: https://github.com/scylladb/python-driver/blob/master/docs/scylla-specific.rst

should be a good place to add it, we don't have that many scylla specific features (and one of them need to be remove, we don't support in memory anymore)