shotover / shotover-proxy

L7 data-layer proxy
https://docs.shotover.io
Apache License 2.0
82 stars 16 forks source link

Cassandra 5 vector support #1676

Closed rukai closed 3 days ago

rukai commented 3 weeks ago

This PR fixes a bug causing shotover to error out when processing cassandra custom types. In doing so we enable support for cassandra 5's new vector types.

The problem is that the cassandra-protocol crate will return an Error when it tries to parse a Custom cassandra value, this makes sense from the perspective of the crate since it does not know how to handle this type. If the user wants to use the custom type they should use a driver that knows about this type. However from the shotover perspective its reasonable for the client and cassandra to use a custom type that shotover knows nothing about, in this case we should just pass on the bytes as is.

To achieve this we add an enum CustomOrStandardType which allows us to store either a Custom type (not supported by cassandra-protocol) or any other standard type supported by cassandra-protocol. Long term I consider this a hack, but unless we have a push to improve cassandra performance I think we'll be living with this hack forever.

As demonstrated here the java driver only supports 4 data types for use with vectors. So even though cassandra returns results for the other data types that could in theory be interpreted by a driver, we dont test those since there's no way to do that through the java driver. Shotover doesn't parse these anyway so in reality the coverage isnt important.

codspeed-hq[bot] commented 3 weeks ago

CodSpeed Performance Report

Merging #1676 will not alter performance

Comparing rukai:vector_support (723447f) with main (aa0c320)

Summary

✅ 39 untouched benchmarks