Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

[0.16] the ability to specify a default consistency level for statements / batches on either Cluster or Session #109

Open
jhgg opened this issue Jan 20, 2021 · 1 comment
Labels
enhancement help wanted improved-api Work towards a 1.0 release (initially 0.18)

Comments

@jhgg
Copy link
Collaborator

jhgg commented Jan 20, 2021

Currently, the underlying C++ library defaults everything to a consistency level of ONE. (https://docs.datastax.com/en/developer/cpp-driver/2.15/api/struct.CassStatement/#function-cass_statement_set_consistency)

It doesn't allow you to specify a more sensible default. Since we're wrapping this library, we could very easily support setting a consistency level on a Cluster or Session level, and propagating that change down into the execution handler.

This has been a footgun for us, where we forget to set consistency level on a query to have it be doing ONE reads/writes instead of QUORUM read/writes. By providing an API that lets us set the default consistency level, this will let users of the library opt out of this nonsense default from the C++ driver, and not have to worry about setting the consistency level with each statement they execute. Perhaps even we should be opinionated here and say that the default consistency level should be LOCAL_QUORUM, because honestly, ONE is an insane default that can lead to data loss/inconsistency.

Our code right now has a LOT of x.set_consistency(cassandra::Consistency::LOCAL_QUORUM)?; and it's pretty dangerous if forgotten.

@kw217
Copy link
Collaborator

kw217 commented Jan 22, 2021

Very happy with this proposal, and yes a sensible default default for us would be LOCAL_QUORUM too.

@kw217 kw217 added enhancement help wanted new-api improved-api Work towards a 1.0 release (initially 0.18) and removed new-api labels May 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement help wanted improved-api Work towards a 1.0 release (initially 0.18)
Projects
None yet
Development

No branches or pull requests

2 participants