Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Apply query options as bind markers to avoid new PreparedStatement creation #1401

Closed
chringwer opened this issue Jun 29, 2023 · 1 comment
Closed
Assignees
Labels
type: enhancement A general enhancement

Comments

@chringwer
Copy link

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.

update = (Update) ((UpdateStart) update).usingTimestamp(writeOptions.getTimestamp());

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 of select * from system.prepared_statements ;.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Jun 29, 2023
@mp911de
Copy link
Member

mp911de commented Jun 29, 2023

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.

@mp911de mp911de added status: pending-design-work Needs design work before any code can be developed type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged labels Jun 29, 2023
@mp911de mp911de changed the title Setting timestamp in UpdateOptions will create a new PreparedStatement everytime Apply query options as bind markers to avoid new PreparedStatement creation Jun 29, 2023
@mp911de mp911de self-assigned this Jun 30, 2023
@mp911de mp911de removed the status: pending-design-work Needs design work before any code can be developed label Jun 30, 2023
@mp911de mp911de added this to the 4.2 M1 (2023.1.0) milestone Jun 30, 2023
mp911de added a commit that referenced this issue Jul 5, 2023
When using bind markers (named/by index) we now apply bind markers for LIMIT to avoid excessive prepared statement amounts.

See #1401
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

3 participants