apache / cassandra-gocql-driver

GoCQL Driver for Apache Cassandra®
https://cassandra.apache.org/
Apache License 2.0
2.57k stars 620 forks source link

Impossible to set CONSISTENCY SERIAL (select consistency) #1832

Open danthegoodman1 opened 21 hours ago

danthegoodman1 commented 21 hours ago

Please answer these questions before submitting your issue. Thanks!

What version of Cassandra are you using?

ScyllaDB

What version of Gocql are you using?

1.7.0

What version of Go are you using?

1.22.5

The .Consistency options don't allow for setting SERIAL or LOCAL_SERIAL, despite them being supported by both Cassandra and Scylla for reads to use Paxos.

type Consistency uint16

const (
    Any         Consistency = 0x00
    One         Consistency = 0x01
    Two         Consistency = 0x02
    Three       Consistency = 0x03
    Quorum      Consistency = 0x04
    All         Consistency = 0x05
    LocalQuorum Consistency = 0x06
    EachQuorum  Consistency = 0x07
    LocalOne    Consistency = 0x0A
)

Because the driver does not allow you to session.Query("CONSISTENCY SERIAL").Exec() (get's error no viable alternative at input 'CONSISTENCY'), it seems to be currently impossible to set SELECT consistency to SERIAL

dkropachev commented 20 hours ago

@danthegoodman1 , have you tried Query.SerialConsistency ? Also if you working with ScyllaDB, it is better to submit issues at https://github.com/scylladb/gocql

danthegoodman1 commented 20 hours ago

@dkropachev sorry I was inspecting this issue more at the package level, it seems like they support it https://github.com/scylladb/gocql/blob/master/frame.go#L187-L188 but this package does not (which is strange, considering cassandra supports it: https://docs.datastax.com/en/cql/hcd-1.0/reference/cqlsh-commands/consistency.html#setting-a-consistency-level)