scylladb / scylla-rust-driver

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

Enable enforcing coordinator for request #1031

Open wprzytula opened 1 month ago

wprzytula commented 1 month ago

Motivation

cpp-driver provides an option to explicitly set a node to be coordinator for a specific request. It argues for that option this way:

In general, this should not be used, but it can be useful in the following situations:

  • To query node-local tables such as system and virtual tables.
  • To apply a sequence of schema changes where it makes sense for all the changes to be applied on a single node.

Solution

Let's expose a setter for explicit coordinator - consider identifying by address or host_id. If an explicit coordinator is set for a statement, then:

wprzytula commented 1 month ago

This should be in line with #738 requirements about enforcing a particular coordinator.

Lorak-mmk commented 1 month ago

This can already be done by setting a custom LBP on the query, which yields only 1 element.

wprzytula commented 1 month ago

This can already be done by setting a custom LBP on the query, which yields only 1 element.

Yes, it can be done, but it's fairly inconvenient. The driver's duty is to provide convenient and shorthands to operate with Scylla, and by cpp-driver's documentation (see Motivation) the shorthand for setting an explicit coordinator for a statement is useful.