scylladb / scylla-rust-driver

Async CQL driver for Rust, optimized for ScyllaDB!
Apache License 2.0
582 stars 101 forks source link

Don't use LocalQuorum as default consistency for SimpleStrategy keyspaces #662

Open cvybhu opened 1 year ago

cvybhu commented 1 year ago

By default the driver performs each query with the LocalQuorum consistency.

This choice of consistency causes trouble for multi-dc clusters with SimpleStrategy. Imagine a cluster with 3 datacenters (dc1, dc2, dc3), with 3 nodes in each datacenter.

Now let's say there's a keyspace:

CREATE KEYSPACE ks WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 3};

'replication_factor': 3 means that for each partition there are 3 nodes in the whole cluster that are replicas for this partition. Let's say the replicas are: A (in dc1), B (in dc1) and C (in dc2).

Now the user performs a query, and let's say that the load balancing chooses C to be the coordinator. Because the query uses LocalQuorum as the default consistency, the query will fail - there aren't enough nodes in dc2 to fulfill the consistency requirement, there would need to be at least 2.

I think it would be generally better to have the default be Quorum instead of LocalQuorum. It's the safest option. Sadly changing this would count as a breaking change.

mykaul commented 1 year ago

Note that we'd like to deprecate SimpleStrategy (see https://github.com/scylladb/scylladb/issues/5224 and others).

roydahan commented 4 months ago

@Lorak-mmk / @wprzytula since we shouldn't support SimpleStartegy with multiDC, can we close this one?

wprzytula commented 4 months ago

@Lorak-mmk / @wprzytula since we shouldn't support SimpleStartegy with multiDC, can we close this one?

If the reason for that is that Scylla won't support SimpleStrategy with multiDC, then remember that Cassandra will still support it, and we want to correctly support Cassandra as well. Right?

roydahan commented 4 months ago

Yes, but also for Cassandra it's highly advisable not using SimpleStrategy with Multi DC configuration.