Skip to content

Commit

Permalink
SUPPORTED rewrite (#991)
Browse files Browse the repository at this point in the history
  • Loading branch information
conorbros committed Jan 31, 2023
1 parent fc54773 commit 2664fa8
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 5 deletions.
11 changes: 11 additions & 0 deletions shotover-proxy/src/codec/cassandra.rs
Expand Up @@ -6,6 +6,7 @@ use anyhow::{anyhow, Result};
use bytes::{Buf, BufMut, BytesMut};
use cassandra_protocol::compression::Compression;
use cassandra_protocol::frame::message_error::{ErrorBody, ErrorType};
use cassandra_protocol::frame::message_supported::BodyResSupported;
use cassandra_protocol::frame::{
CheckEnvelopeSizeError, Envelope as RawCassandraFrame, Opcode, Version,
};
Expand Down Expand Up @@ -80,6 +81,16 @@ impl Decoder for CassandraCodec {
return Err(reject_compression(frame.stream_id, compression));
}
}

if let CassandraOperation::Supported(BodyResSupported { data }) =
&mut frame.operation
{
if let Some(value) = data.get_mut("COMPRESSION") {
*value = vec![];
}

message.invalidate_cache();
}
}

if let Ok(Metadata::Cassandra(CassandraMetadata {
Expand Down
11 changes: 6 additions & 5 deletions shotover-proxy/src/transforms/mod.rs
@@ -1,10 +1,11 @@
use self::cassandra::sink_cluster::CassandraSinkClusterBuilder;
use crate::error::ChainResponse;
use crate::message::Messages;
use crate::transforms::cassandra::peers_rewrite::CassandraPeersRewrite;
use crate::transforms::cassandra::peers_rewrite::CassandraPeersRewriteConfig;
use crate::transforms::cassandra::sink_cluster::CassandraSinkCluster;
use crate::transforms::cassandra::sink_cluster::CassandraSinkClusterConfig;
use crate::transforms::cassandra::peers_rewrite::{
CassandraPeersRewrite, CassandraPeersRewriteConfig,
};
use crate::transforms::cassandra::sink_cluster::{
CassandraSinkCluster, CassandraSinkClusterBuilder, CassandraSinkClusterConfig,
};
use crate::transforms::cassandra::sink_single::{CassandraSinkSingle, CassandraSinkSingleConfig};
use crate::transforms::chain::{TransformChain, TransformChainBuilder};
use crate::transforms::coalesce::{Coalesce, CoalesceConfig};
Expand Down
1 change: 1 addition & 0 deletions test-helpers/src/connection/cassandra.rs
Expand Up @@ -179,6 +179,7 @@ impl CassandraConnection {
)
.user("cassandra", "cassandra")
.default_consistency(Consistency::One)
.compression(Some(scylla::transport::Compression::Snappy))
.build()
.await
.unwrap();
Expand Down

0 comments on commit 2664fa8

Please sign in to comment.