scylladb / java-driver

ScyllaDB Java Driver for ScyllaDB and Apache Cassandra, based on the DataStax Java Driver
Apache License 2.0
63 stars 37 forks source link

Re-preparing of prepared statements should be throttled and limited #126

Open avelanarius opened 2 years ago

avelanarius commented 2 years ago

As we observed in issue #124, if there is some problem server-side with preparing statements, the driver will infinitely retry preparing the statement, without any delays between retries.

This could happen in two cases: if there is a bug in Scylla/Cassandra (like scylladb/scylla#10440) or if the prepared statement cache is too small to hold all prepared statements of a batch statement.

In such cases, the driver should throw an Exception, instead of endlessly looping and causing a massive load onto Scylla.

avelanarius commented 2 years ago

I have not checked whether other drivers have the same problem, but if they do, they too should be fixed.

roydahan commented 5 months ago

Can be done on the client side as well for additional hardening.