scylladb / gocql

Package gocql implements a fast and robust ScyllaDB client for the Go programming language.
https://docs.scylladb.com/stable/using-scylla/drivers/cql-drivers/scylla-go-driver.html
BSD 3-Clause "New" or "Revised" License
186 stars 59 forks source link

support for Statement request size #51

Open tarzanek opened 4 years ago

tarzanek commented 4 years ago

Java driver has requestSizeInBytes to give a higher estimate of Statement size for counting the batch size https://docs.datastax.com/en/drivers/java/3.7/com/datastax/driver/core/Statement.html#requestSizeInBytes-com.datastax.driver.core.ProtocolVersion-com.datastax.driver.core.CodecRegistry-

go has only Batch::Size()

so when client wants to do exact batch splitting, it's hard to count the statement size

Could above be ported over from java to go?

Java logic is in: https://github.com/scylladb/java-driver/blob/3.7.1-scylla-2/driver-core/src/main/java/com/datastax/driver/core/BatchStatement.java#L203 or https://github.com/scylladb/java-driver/blob/3.7.1-scylla-2/driver-core/src/main/java/com/datastax/driver/core/RegularStatement.java#L185 or https://github.com/scylladb/java-driver/blob/3.7.1-scylla-2/driver-core/src/main/java/com/datastax/driver/core/BoundStatement.java#L307 (and similar, just query java driver tree for requestSizeInBytes)

mmatczuk commented 4 years ago

I'd say yes and it needs to be added upstream in gocql/gocql.

Flamefork commented 3 years ago

https://github.com/gocql/gocql/issues/1448