Closed chringwer closed 1 year ago
Thanks for bringing this up. I agree that in the context of prepared statements, this behavior could be better. QueryOptionsUtil
isn't aware of whether the statement is being used with bind markers and how values are bound to these. That being said, such a change requires a bit more thought to find a way for a generic approach, similar to StatementBuilder
.
There is an overloaded version of
UpdateStart usingTimestamp(@NonNull BindMarker bindMarker)
that should probably be used here in order to avoid having a new prepared statement to be created for each timestamp.https://github.com/spring-projects/spring-data-cassandra/blob/e950084f993edea049c9dbd540515bd686b6066d/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/core/cql/QueryOptionsUtil.java#L171
I was alerted by warnings logged from the cassandra nodes like:
157 prepared statements discarded in the last minute because cache limit reached (10 MB)
Verified that this is due to the timestamp not being specified as a
BindMarker
but as a literal value. This can be observed by inspecting the output ofselect * from system.prepared_statements ;
.