-
Notifications
You must be signed in to change notification settings - Fork 16
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
Cassandra flags #853
Cassandra flags #853
Conversation
Why do we need to carry the flags around? |
Because tracing_id is None for requests, but the tracing flag is set so Cassandra attaches a tracing_id to the response. |
Oooh, I see, thanks! |
A critical goal for shotover's message format is to make it so that transform developers can modify or read fields of the message with the expectation that there is a single source of truth. And I think this design could be improved to meet that. Sure, a transform can change the tracing_id and have the flag automatically set to the correct value at encode time. I can think of two alternative approaches. Alternative 1enum Tracing {
Request { request_tracing_id: bool }
Response (Uuid)
}
struct CassandraFrame {
tracing: Tracing,
...
} This does introduce a new way to represent an invalid state: Alternative 2pub enum CassandraOperationRequest {
Query {
query: Box<CassandraStatement>,
params: Box<QueryParams>,
},
Execute(Box<BodyReqExecuteOwned>),
Register(BodyReqRegister),
Batch(CassandraBatch),
...
}
pub enum CassandraOperationResponse {
Result(CassandraResult),
Error(ErrorBody),
Prepare(Vec<u8>),
Event(ServerEvent),
...
}
pub enum Direction {
Request { operation: CassandraOperationRequest, tracing: bool },
Response { operation: CassandraOperationResponse, tracing: Uuid },
}
struct CassandraFrame {
direction: Direction,
...
} This completely eliminates invalid states, but it is pretty invasive so we could leave it as a possible follow up refactor if you want. |
I decided to go with option 1 since it's much simpler to implement and doesn't block this PR anymore. I'll add note to add considering option 2 for a followup. |
In the interest of moving this pre-req PR forward since it's blocking token aware routing, I think we should carry on with reviews and I'll open a followup PR with the above changes mentioned. Technically we are not regressing since it was always possible to modify the |
I've made a prereq PR to unblock this while avoiding adding the flags field. #869 This API is not ideal, but its progressing in the right direction. |
we will also need to make a shotover/cassandra-cpp fork in order to progress this PR, since we havent heard back about cassandra-rs/cassandra-rs#147 |
1 benchmark regressed. 0 benchmark improved. Please check the benchmark workflow logs for full details: https://github.com/shotover/shotover-proxy/actions/runs/3294545039
|
Pre-reqs:
cassandra-cpp
cassandra-protocol
At the moment Shotover is just stripping flags from messages. This PR implements support for flags. Currently this PR just tests we can send flags without error, but the followup: #854 uses this support to get tracing information from queries sent through Shotover.