From 2bb4ed3bac9d855f77a18c9383e374a2833865f2 Mon Sep 17 00:00:00 2001 From: ronycsdu Date: Fri, 22 Nov 2024 11:44:45 +1100 Subject: [PATCH] Update Redis to Valkey Part 2 (#1830) Co-authored-by: Lucas Kent --- .cargo/config.toml | 2 +- .github/workflows/windsock_benches.yaml | 2 +- .../config/topology.yaml | 6 +- custom-transforms-example/src/main.rs | 2 +- .../src/redis_get_rewrite.rs | 20 +-- custom-transforms-example/tests/test.rs | 2 +- ec2-cargo/src/main.rs | 10 +- .../benches/windsock/redis/bench.rs | 154 +++++++++--------- shotover-proxy/benches/windsock/redis/mod.rs | 6 +- shotover-proxy/config/topology.yaml | 2 +- .../tests/cassandra_int_tests/cache/assert.rs | 4 +- .../tests/cassandra_int_tests/cache/mod.rs | 12 +- .../tests/cassandra_int_tests/mod.rs | 6 +- .../redis_int_tests/basic_driver_tests.rs | 30 ++-- shotover-proxy/tests/redis_int_tests/mod.rs | 16 +- .../tests/runner/observability_int_tests.rs | 120 +++++++------- .../tests/runner/runner_int_tests.rs | 18 +- .../cassandra/redis-cache/topology.yaml | 4 +- .../invalid_non_terminating_last.yaml | 2 +- .../invalid_protocol_mismatch.yaml | 2 +- .../tests/test-configs/invalid_subchains.yaml | 4 +- .../invalid_terminating_not_last.yaml | 2 +- .../test-configs/log-to-file/topology.yaml | 4 +- .../test-configs/null-redis/topology.yaml | 4 +- .../query_type_filter/simple.yaml | 4 +- .../redis/cluster-auth/topology.yaml | 8 +- .../redis/cluster-dr/topology.yaml | 6 +- .../redis/cluster-handling/topology.yaml | 4 +- .../redis/cluster-hiding/topology-encode.yaml | 4 +- .../redis/cluster-hiding/topology.yaml | 4 +- .../redis/cluster-ports-rewrite/topology.yaml | 6 +- .../redis/cluster-tls/topology-encode.yaml | 4 +- .../topology-no-source-encryption.yaml | 4 +- .../redis/cluster-tls/topology.yaml | 4 +- .../redis/passthrough/topology-encode.yaml | 4 +- .../redis/passthrough/topology.yaml | 4 +- .../redis/tls-no-client-auth/topology.yaml | 4 +- .../tls-no-verify-hostname/topology.yaml | 4 +- .../redis/tls/topology-encode.yaml | 4 +- .../test-configs/redis/tls/topology.yaml | 4 +- .../tests/test-configs/tee/fail.yaml | 2 +- .../test-configs/tee/fail_with_mismatch.yaml | 2 +- .../tests/test-configs/tee/ignore.yaml | 2 +- .../tee/ignore_with_mismatch.yaml | 2 +- .../tests/test-configs/tee/log.yaml | 2 +- .../test-configs/tee/log_with_mismatch.yaml | 2 +- .../tests/test-configs/tee/subchain.yaml | 4 +- .../tee/subchain_with_mismatch.yaml | 4 +- .../tests/test-configs/tee/switch_chain.yaml | 6 +- shotover-proxy/tests/transforms/tee.rs | 18 +- shotover/benches/benches/chain.rs | 8 +- shotover/src/config/chain.rs | 4 +- shotover/src/config/topology.rs | 16 +- shotover/src/transforms/redis/cache.rs | 126 +++++++------- .../transforms/redis/cluster_ports_rewrite.rs | 24 +-- shotover/src/transforms/redis/mod.rs | 16 +- shotover/src/transforms/redis/sink_cluster.rs | 72 ++++---- shotover/src/transforms/redis/sink_single.rs | 28 ++-- test-helpers/src/cert.rs | 2 +- .../src/connection/redis_connection.rs | 4 +- test-helpers/src/docker_compose.rs | 9 +- 61 files changed, 428 insertions(+), 431 deletions(-) diff --git a/.cargo/config.toml b/.cargo/config.toml index 5be6a0376..c4f14118e 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -13,7 +13,7 @@ windsock = "test --release --bench windsock --features kafka,alpha-transforms,ka windsock-debug = "test --bench windsock --features kafka,alpha-transforms,kafka-cpp-driver-tests,cassandra,redis --" # Can only run benchmarks specific to the protocol but compiles a lot faster -windsock-redis = "test --release --bench windsock --no-default-features --features redis,alpha-transforms --" +windsock-valkey = "test --release --bench windsock --no-default-features --features redis,alpha-transforms --" windsock-kafka = "test --release --bench windsock --no-default-features --features kafka,alpha-transforms,kafka-cpp-driver-tests --" windsock-cassandra = "test --release --bench windsock --no-default-features --features cassandra,alpha-transforms --" diff --git a/.github/workflows/windsock_benches.yaml b/.github/workflows/windsock_benches.yaml index 0714d4149..cf42db602 100644 --- a/.github/workflows/windsock_benches.yaml +++ b/.github/workflows/windsock_benches.yaml @@ -40,7 +40,7 @@ jobs: cargo windsock local-run --bench-length-seconds 5 --operations-per-second 100 --profilers flamegraph db=cassandra,compression=none,connection_count=1,driver=scylla,operation=read_i64,protocol=v4,shotover=standard,topology=single cargo windsock local-run --bench-length-seconds 5 --operations-per-second 100 --profilers samply db=cassandra,compression=none,connection_count=1,driver=scylla,operation=read_i64,protocol=v4,shotover=standard,topology=single cargo windsock local-run --bench-length-seconds 5 --operations-per-second 100 --profilers sys_monitor db=kafka,shotover=standard,size=12B,topology=single - cargo windsock local-run --bench-length-seconds 5 --operations-per-second 100 --profilers shotover_metrics db=redis,encryption=none,operation=get,shotover=standard,topology=single + cargo windsock local-run --bench-length-seconds 5 --operations-per-second 100 --profilers shotover_metrics db=valkey,encryption=none,operation=get,shotover=standard,topology=single - name: Ensure that tests did not create or modify any files that arent .gitignore'd run: | if [ -n "$(git status --porcelain)" ]; then diff --git a/custom-transforms-example/config/topology.yaml b/custom-transforms-example/config/topology.yaml index 10c343f14..f5663b0ba 100644 --- a/custom-transforms-example/config/topology.yaml +++ b/custom-transforms-example/config/topology.yaml @@ -1,11 +1,11 @@ --- sources: - Valkey: - name: "redis" + name: "valkey" listen_addr: "127.0.0.1:6379" chain: - - RedisGetRewrite: + - ValkeyGetRewrite: result: "Rewritten value" - - RedisSinkSingle: + - ValkeySinkSingle: remote_address: "127.0.0.1:1111" connect_timeout_ms: 3000 diff --git a/custom-transforms-example/src/main.rs b/custom-transforms-example/src/main.rs index c4bae05f8..f4714f7d8 100644 --- a/custom-transforms-example/src/main.rs +++ b/custom-transforms-example/src/main.rs @@ -3,7 +3,7 @@ use shotover::runner::Shotover; #[cfg(feature = "redis")] mod redis_get_rewrite; #[cfg(feature = "redis")] -shotover::import_transform!(redis_get_rewrite::RedisGetRewriteConfig); +shotover::import_transform!(redis_get_rewrite::ValkeyGetRewriteConfig); fn main() { Shotover::new().run_block(); diff --git a/custom-transforms-example/src/redis_get_rewrite.rs b/custom-transforms-example/src/redis_get_rewrite.rs index ee6af5129..f12d83014 100644 --- a/custom-transforms-example/src/redis_get_rewrite.rs +++ b/custom-transforms-example/src/redis_get_rewrite.rs @@ -10,19 +10,19 @@ use shotover::transforms::{DownChainProtocol, TransformContextBuilder, UpChainPr #[derive(Serialize, Deserialize, Debug)] #[serde(deny_unknown_fields)] -pub struct RedisGetRewriteConfig { +pub struct ValkeyGetRewriteConfig { pub result: String, } -const NAME: &str = "RedisGetRewrite"; -#[typetag::serde(name = "RedisGetRewrite")] +const NAME: &str = "ValkeyGetRewrite"; +#[typetag::serde(name = "ValkeyGetRewrite")] #[async_trait(?Send)] -impl TransformConfig for RedisGetRewriteConfig { +impl TransformConfig for ValkeyGetRewriteConfig { async fn get_builder( &self, _transform_context: TransformContextConfig, ) -> Result> { - Ok(Box::new(RedisGetRewriteBuilder { + Ok(Box::new(ValkeyGetRewriteBuilder { result: self.result.clone(), })) } @@ -36,13 +36,13 @@ impl TransformConfig for RedisGetRewriteConfig { } } -pub struct RedisGetRewriteBuilder { +pub struct ValkeyGetRewriteBuilder { result: String, } -impl TransformBuilder for RedisGetRewriteBuilder { +impl TransformBuilder for ValkeyGetRewriteBuilder { fn build(&self, _transform_context: TransformContextBuilder) -> Box { - Box::new(RedisGetRewrite { + Box::new(ValkeyGetRewrite { get_requests: MessageIdSet::default(), result: self.result.clone(), }) @@ -53,13 +53,13 @@ impl TransformBuilder for RedisGetRewriteBuilder { } } -pub struct RedisGetRewrite { +pub struct ValkeyGetRewrite { get_requests: MessageIdSet, result: String, } #[async_trait] -impl Transform for RedisGetRewrite { +impl Transform for ValkeyGetRewrite { fn get_name(&self) -> &'static str { NAME } diff --git a/custom-transforms-example/tests/test.rs b/custom-transforms-example/tests/test.rs index b0ebaca12..d3ee2646e 100644 --- a/custom-transforms-example/tests/test.rs +++ b/custom-transforms-example/tests/test.rs @@ -8,7 +8,7 @@ use test_helpers::shotover_process::{bin_path, BinProcess, EventMatcher, Level}; #[tokio::test(flavor = "multi_thread")] async fn test_custom_transform() { - // Setup shotover and the redis server it connects to + // Setup shotover and the valkey server it connects to let _compose = docker_compose("config/docker-compose.yaml"); let shotover = shotover_proxy("config/topology.yaml").await; let mut connection = redis_connection::new_async("127.0.0.1", 6379).await; diff --git a/ec2-cargo/src/main.rs b/ec2-cargo/src/main.rs index d20daf182..b9fcae6ac 100644 --- a/ec2-cargo/src/main.rs +++ b/ec2-cargo/src/main.rs @@ -155,10 +155,10 @@ fi ), ); shell.commands.insert( - "windsock-redis", + "windsock-valkey", Command::new_async( - "Uploads changes and runs `cargo windsock-redis $args`. Windsock results are downloaded to target/windsock_data".to_owned(), - async_fn!(State, windsock_redis), + "Uploads changes and runs `cargo windsock-valkey $args`. Windsock results are downloaded to target/windsock_data".to_owned(), + async_fn!(State, windsock_valkey), ), ); shell.commands.insert( @@ -212,8 +212,8 @@ async fn windsock_cassandra(state: &mut State, args: Vec) -> Result<(), windsock_inner("windsock-cassandra", state, args).await } -async fn windsock_redis(state: &mut State, args: Vec) -> Result<(), Box> { - windsock_inner("windsock-redis", state, args).await +async fn windsock_valkey(state: &mut State, args: Vec) -> Result<(), Box> { + windsock_inner("windsock-valkey", state, args).await } async fn windsock_inner( diff --git a/shotover-proxy/benches/windsock/redis/bench.rs b/shotover-proxy/benches/windsock/redis/bench.rs index f4bd75bf0..4cf87fd7a 100644 --- a/shotover-proxy/benches/windsock/redis/bench.rs +++ b/shotover-proxy/benches/windsock/redis/bench.rs @@ -24,7 +24,7 @@ use shotover::{ tls::{TlsAcceptorConfig, TlsConnectorConfig}, transforms::{ debug::force_parse::DebugForceEncodeConfig, - redis::{sink_cluster::RedisSinkClusterConfig, sink_single::RedisSinkSingleConfig}, + redis::{sink_cluster::ValkeySinkClusterConfig, sink_single::ValkeySinkSingleConfig}, TransformConfig, }, }; @@ -44,13 +44,13 @@ use tokio::sync::mpsc::UnboundedSender; use windsock::{Bench, BenchParameters, BenchTask, Profiling, Report}; #[derive(Clone, Copy)] -pub enum RedisOperation { +pub enum ValkeyOperation { Set, Get, } #[derive(Clone, Copy)] -pub enum RedisTopology { +pub enum ValkeyTopology { Single, Cluster3, } @@ -61,21 +61,21 @@ pub enum Encryption { Tls, } -pub struct RedisBench { - topology: RedisTopology, +pub struct ValkeyBench { + topology: ValkeyTopology, shotover: Shotover, - operation: RedisOperation, + operation: ValkeyOperation, encryption: Encryption, } -impl RedisBench { +impl ValkeyBench { pub fn new( - topology: RedisTopology, + topology: ValkeyTopology, shotover: Shotover, - operation: RedisOperation, + operation: ValkeyOperation, encryption: Encryption, ) -> Self { - RedisBench { + ValkeyBench { topology, shotover, operation, @@ -83,7 +83,7 @@ impl RedisBench { } } - fn generate_topology_yaml(&self, host_address: String, redis_address: String) -> String { + fn generate_topology_yaml(&self, host_address: String, valkey_address: String) -> String { let certs = "tests/test-configs/redis/tls/certs"; let tls_connector = match self.encryption { Encryption::Tls => Some(TlsConnectorConfig { @@ -112,18 +112,18 @@ impl RedisBench { } match self.topology { - RedisTopology::Cluster3 => { - transforms.push(Box::new(RedisSinkClusterConfig { - first_contact_points: vec![redis_address], + ValkeyTopology::Cluster3 => { + transforms.push(Box::new(ValkeySinkClusterConfig { + first_contact_points: vec![valkey_address], direct_destination: None, tls: tls_connector, connection_count: None, connect_timeout_ms: 3000, })); } - RedisTopology::Single => { - transforms.push(Box::new(RedisSinkSingleConfig { - address: redis_address, + ValkeyTopology::Single => { + transforms.push(Box::new(ValkeySinkSingleConfig { + address: valkey_address, tls: tls_connector, connect_timeout_ms: 3000, })); @@ -132,7 +132,7 @@ impl RedisBench { common::generate_topology(SourceConfig::Valkey( shotover::sources::redis::ValkeyConfig { - name: "redis".to_owned(), + name: "valkey".to_owned(), listen_addr: host_address, connection_limit: None, hard_connection_limit: None, @@ -146,12 +146,12 @@ impl RedisBench { async fn run_aws_shotover( &self, instance: Option>, - redis_ip: String, + valkey_ip: String, ) -> Option { if let Some(instance) = instance { let ip = instance.instance.private_ip().to_string(); let topology = - self.generate_topology_yaml(format!("{ip}:6379"), format!("{redis_ip}:6379")); + self.generate_topology_yaml(format!("{ip}:6379"), format!("{valkey_ip}:6379")); Some(instance.run_shotover(&topology).await) } else { None @@ -160,25 +160,25 @@ impl RedisBench { } #[async_trait] -impl Bench for RedisBench { +impl Bench for ValkeyBench { type CloudResourcesRequired = CloudResourcesRequired; type CloudResources = CloudResources; fn tags(&self) -> HashMap { [ - ("db".to_owned(), "redis".to_owned()), + ("db".to_owned(), "valkey".to_owned()), ( "topology".to_owned(), match &self.topology { - RedisTopology::Single => "single".to_owned(), - RedisTopology::Cluster3 => "cluster3".to_owned(), + ValkeyTopology::Single => "single".to_owned(), + ValkeyTopology::Cluster3 => "cluster3".to_owned(), }, ), ( "operation".to_owned(), match &self.operation { - RedisOperation::Set => "set".to_owned(), - RedisOperation::Get => "get".to_owned(), + ValkeyOperation::Set => "set".to_owned(), + ValkeyOperation::Get => "get".to_owned(), }, ), ( @@ -210,8 +210,8 @@ impl Bench for RedisBench { 0 }; let docker_instance_count = match self.topology { - RedisTopology::Single => 1, - RedisTopology::Cluster3 => 7, + ValkeyTopology::Single => 1, + ValkeyTopology::Cluster3 => 7, }; CloudResourcesRequired { shotover_instance_count, @@ -229,7 +229,7 @@ impl Bench for RedisBench { ) -> Result<()> { let bench_instance = cloud_resources.bencher.unwrap(); let shotover_instance = cloud_resources.shotover.pop(); - let redis_instances = RedisCluster::create(cloud_resources.docker, self.topology); + let valkey_instances = ValkeyCluster::create(cloud_resources.docker, self.topology); let mut profiler_instances: HashMap = [("bencher".to_owned(), &bench_instance.instance)].into(); @@ -239,18 +239,18 @@ impl Bench for RedisBench { &shotover_instance.as_ref().unwrap().instance, ); } - match &redis_instances { - RedisCluster::Cluster3 { instances, .. } => { + match &valkey_instances { + ValkeyCluster::Cluster3 { instances, .. } => { for (i, instance) in instances.iter().enumerate() { - profiler_instances.insert(format!("redis{i}"), &instance.instance); + profiler_instances.insert(format!("valkey{i}"), &instance.instance); } } - RedisCluster::Single(instance) => { - profiler_instances.insert("redis".to_owned(), &instance.instance); + ValkeyCluster::Single(instance) => { + profiler_instances.insert("valkey".to_owned(), &instance.instance); } } - let redis_ip = redis_instances.private_ips()[0].to_string(); + let valkey_ip = valkey_instances.private_ips()[0].to_string(); let shotover_ip = shotover_instance .as_ref() .map(|x| x.instance.private_ip().to_string()); @@ -267,16 +267,16 @@ impl Bench for RedisBench { .await; let (_, running_shotover) = futures::join!( - redis_instances.run(self.encryption), - self.run_aws_shotover(shotover_instance.clone(), redis_ip.clone()) + valkey_instances.run(self.encryption), + self.run_aws_shotover(shotover_instance.clone(), valkey_ip.clone()) ); let destination_ip = if let Some(shotover_ip) = shotover_ip { - format!("redis://{shotover_ip}") + format!("valkey://{shotover_ip}") } else { match self.topology { - RedisTopology::Single => format!("redis://{redis_ip}"), - RedisTopology::Cluster3 => format!("redis-cluster://{redis_ip}"), + ValkeyTopology::Single => format!("valkey://{valkey_ip}"), + ValkeyTopology::Cluster3 => format!("valkey-cluster://{valkey_ip}"), } }; @@ -298,35 +298,35 @@ impl Bench for RedisBench { profiling: Profiling, parameters: BenchParameters, ) -> Result<()> { - test_helpers::cert::generate_redis_test_certs(); + test_helpers::cert::generate_valkey_test_certs(); - // rediss:// url is not needed to enable TLS because we overwrite the TLS config later on + // valkey:// url is not needed to enable TLS because we overwrite the TLS config later on let client_url = match (self.topology, self.shotover) { - (RedisTopology::Single, Shotover::None) => "redis://127.0.0.1:1111", - (RedisTopology::Cluster3, Shotover::None) => "redis-cluster://172.16.1.2:6379", + (ValkeyTopology::Single, Shotover::None) => "valkey://127.0.0.1:1111", + (ValkeyTopology::Cluster3, Shotover::None) => "valkey-cluster://172.16.1.2:6379", ( - RedisTopology::Single | RedisTopology::Cluster3, + ValkeyTopology::Single | ValkeyTopology::Cluster3, Shotover::Standard | Shotover::ForcedMessageParsed, - ) => "redis://127.0.0.1:6379", + ) => "valkey://127.0.0.1:6379", }; - let redis_address = match self.topology { - RedisTopology::Single => "127.0.0.1:1111", - RedisTopology::Cluster3 => "172.16.1.2:6379", + let valkey_address = match self.topology { + ValkeyTopology::Single => "127.0.0.1:1111", + ValkeyTopology::Cluster3 => "172.16.1.2:6379", }; let config_dir = match (self.topology, self.encryption) { - (RedisTopology::Single, Encryption::None) => "tests/test-configs/redis/passthrough", - (RedisTopology::Cluster3, Encryption::None) => { + (ValkeyTopology::Single, Encryption::None) => "tests/test-configs/redis/passthrough", + (ValkeyTopology::Cluster3, Encryption::None) => { "tests/test-configs/redis/cluster-hiding" } - (RedisTopology::Single, Encryption::Tls) => "tests/test-configs/redis/tls", - (RedisTopology::Cluster3, Encryption::Tls) => "tests/test-configs/redis/cluster-tls", + (ValkeyTopology::Single, Encryption::Tls) => "tests/test-configs/redis/tls", + (ValkeyTopology::Cluster3, Encryption::Tls) => "tests/test-configs/redis/cluster-tls", }; let _compose = docker_compose(&format!("{config_dir}/docker-compose.yaml")); let mut profiler = ProfilerRunner::new(self.name(), profiling); let shotover = match self.shotover { Shotover::Standard | Shotover::ForcedMessageParsed => { let topology_yaml = self - .generate_topology_yaml("127.0.0.1:6379".to_owned(), redis_address.to_owned()); + .generate_topology_yaml("127.0.0.1:6379".to_owned(), valkey_address.to_owned()); Some(shotover_process_custom_topology(&topology_yaml, &profiler).await) } Shotover::None => None, @@ -339,7 +339,7 @@ impl Bench for RedisBench { shotover .shutdown_and_then_consume_events(&[EventMatcher::new() .with_level(Level::Error) - .with_message("encountered error in redis stream: Io(Kind(UnexpectedEof))") + .with_message("encountered error in valkey stream: Io(Kind(UnexpectedEof))") .with_target("shotover::transforms::redis::sink_single") .with_count(Count::Any)]) .await; @@ -378,11 +378,11 @@ impl Bench for RedisBench { let shutdown_handle = client.connect(); client.wait_for_connect().await.unwrap(); - if let RedisOperation::Get = self.operation { + if let ValkeyOperation::Get = self.operation { let _: () = client.set("foo", 42, None, None, false).await.unwrap(); } - let tasks = BenchTaskRedis { + let tasks = BenchTaskValkey { client: client.clone(), operation: self.operation, } @@ -443,23 +443,23 @@ fn load_ca(path: &str) -> Result { } #[derive(Clone)] -struct BenchTaskRedis { +struct BenchTaskValkey { client: Arc, - operation: RedisOperation, + operation: ValkeyOperation, } #[async_trait] -impl BenchTask for BenchTaskRedis { +impl BenchTask for BenchTaskValkey { async fn run_one_operation(&self) -> Result<(), String> { match self.operation { - RedisOperation::Set => { + ValkeyOperation::Set => { let _: () = self .client .set("foo", "bar", None, None, false) .await .map_err(|err| format!("{err}"))?; } - RedisOperation::Get => { + ValkeyOperation::Get => { let result: u32 = self .client .get("foo") @@ -472,7 +472,7 @@ impl BenchTask for BenchTaskRedis { } } -enum RedisCluster { +enum ValkeyCluster { Single(Arc), Cluster3 { instances: [Arc; 6], @@ -480,11 +480,11 @@ enum RedisCluster { }, } -impl RedisCluster { - fn create(mut instances: Vec>, topology: RedisTopology) -> Self { +impl ValkeyCluster { + fn create(mut instances: Vec>, topology: ValkeyTopology) -> Self { match topology { - RedisTopology::Single => RedisCluster::Single(instances.pop().unwrap()), - RedisTopology::Cluster3 => RedisCluster::Cluster3 { + ValkeyTopology::Single => ValkeyCluster::Single(instances.pop().unwrap()), + ValkeyTopology::Cluster3 => ValkeyCluster::Cluster3 { cluster_creator: instances.pop().unwrap(), instances: [ instances.pop().unwrap(), @@ -500,11 +500,11 @@ impl RedisCluster { async fn run(&self, encryption: Encryption) { match self { - RedisCluster::Single(instance) => match encryption { + ValkeyCluster::Single(instance) => match encryption { Encryption::None => instance.run_container("library/redis:5.0.9", &[]).await, Encryption::Tls => todo!(), }, - RedisCluster::Cluster3 { + ValkeyCluster::Cluster3 { instances, cluster_creator, } => { @@ -518,11 +518,11 @@ impl RedisCluster { wait_for.push(tokio::spawn(async move { instance .run_container( - "bitnami/redis-cluster:6.2.12-debian-11-r26", + "bitnami/valkey-cluster:7.2.5-debian-12-r4", &[ ("ALLOW_EMPTY_PASSWORD".to_owned(), "yes".to_owned()), ( - "REDIS_NODES".to_owned(), + "VALKEY_NODES".to_owned(), node_addresses.iter().map(|x| x.to_string()).join(" "), ), ], @@ -534,15 +534,15 @@ impl RedisCluster { let node_addresses = self.private_ips(); cluster_creator .run_container( - "bitnami/redis-cluster:6.2.12-debian-11-r26", + "bitnami/valkey-cluster:7.2.5-debian-12-r4", &[ ("ALLOW_EMPTY_PASSWORD".to_owned(), "yes".to_owned()), ( - "REDIS_NODES".to_owned(), + "VALKEY_NODES".to_owned(), node_addresses.iter().map(|x| x.to_string()).join(" "), ), - ("REDIS_CLUSTER_REPLICAS".to_owned(), "1".to_owned()), - ("REDIS_CLUSTER_CREATOR".to_owned(), "yes".to_owned()), + ("VALKEY_CLUSTER_REPLICAS".to_owned(), "1".to_owned()), + ("VALKEY_CLUSTER_CREATOR".to_owned(), "yes".to_owned()), ], ) .await; @@ -556,8 +556,8 @@ impl RedisCluster { fn private_ips(&self) -> Vec { match self { - RedisCluster::Single(instance) => vec![instance.instance.private_ip()], - RedisCluster::Cluster3 { instances, .. } => { + ValkeyCluster::Single(instance) => vec![instance.instance.private_ip()], + ValkeyCluster::Cluster3 { instances, .. } => { instances.iter().map(|x| x.instance.private_ip()).collect() } } diff --git a/shotover-proxy/benches/windsock/redis/mod.rs b/shotover-proxy/benches/windsock/redis/mod.rs index 9c10058cf..bcddc0739 100644 --- a/shotover-proxy/benches/windsock/redis/mod.rs +++ b/shotover-proxy/benches/windsock/redis/mod.rs @@ -6,17 +6,17 @@ use bench::*; pub fn benches() -> Vec { itertools::iproduct!( - [RedisTopology::Cluster3, RedisTopology::Single], + [ValkeyTopology::Cluster3, ValkeyTopology::Single], [ Shotover::None, Shotover::Standard, Shotover::ForcedMessageParsed ], - [RedisOperation::Get, RedisOperation::Set], + [ValkeyOperation::Get, ValkeyOperation::Set], [Encryption::None, Encryption::Tls] ) .map(|(topology, shotover, operation, encryption)| { - Box::new(RedisBench::new(topology, shotover, operation, encryption)) as ShotoverBench + Box::new(ValkeyBench::new(topology, shotover, operation, encryption)) as ShotoverBench }) .collect() } diff --git a/shotover-proxy/config/topology.yaml b/shotover-proxy/config/topology.yaml index 9f357ee39..66fa99b1a 100644 --- a/shotover-proxy/config/topology.yaml +++ b/shotover-proxy/config/topology.yaml @@ -5,7 +5,7 @@ sources: # The source, change from Valkey to the source type of the database protocol you are receiving messages in. # For a list of possible sources: https://docs.shotover.io/sources - Valkey: - name: "redis" + name: "valkey" listen_addr: "127.0.0.1:6379" chain: # A DebugPrinter transform, reports an INFO log for every message that passes through this transform. diff --git a/shotover-proxy/tests/cassandra_int_tests/cache/assert.rs b/shotover-proxy/tests/cassandra_int_tests/cache/assert.rs index a99dc55fc..a2ab0638a 100644 --- a/shotover-proxy/tests/cassandra_int_tests/cache/assert.rs +++ b/shotover-proxy/tests/cassandra_int_tests/cache/assert.rs @@ -64,11 +64,11 @@ pub async fn assert_query_is_uncacheable( } pub fn assert_sorted_set_equals( - redis_connection: &mut redis::Connection, + valkey_connection: &mut redis::Connection, key: &str, expected_values: &[&str], ) { let expected_values: HashSet = expected_values.iter().map(|x| x.to_string()).collect(); - let values: HashSet = redis_connection.hkeys(key).unwrap(); + let values: HashSet = valkey_connection.hkeys(key).unwrap(); assert_eq!(values, expected_values) } diff --git a/shotover-proxy/tests/cassandra_int_tests/cache/mod.rs b/shotover-proxy/tests/cassandra_int_tests/cache/mod.rs index 1f3f554d9..e1f740446 100644 --- a/shotover-proxy/tests/cassandra_int_tests/cache/mod.rs +++ b/shotover-proxy/tests/cassandra_int_tests/cache/mod.rs @@ -7,9 +7,9 @@ use test_helpers::connection::cassandra::{run_query, CassandraConnection, Result pub async fn test( cassandra_session: &CassandraConnection, - redis_connection: &mut redis::Connection, + valkey_connection: &mut redis::Connection, ) { - redis::cmd("FLUSHDB").execute(redis_connection); + redis::cmd("FLUSHDB").execute(valkey_connection); run_query(cassandra_session, "CREATE KEYSPACE test_cache_keyspace_simple WITH REPLICATION = { 'class' : 'SimpleStrategy', 'replication_factor' : 1 };").await; run_query( @@ -104,7 +104,7 @@ pub async fn test( ) .await; - let result: HashSet = redis_connection.keys("*").unwrap(); + let result: HashSet = valkey_connection.keys("*").unwrap(); let expected = HashSet::from([ "test_cache_keyspace_simple.test_table:1".to_string(), "test_cache_keyspace_simple.test_table:2".to_string(), @@ -113,17 +113,17 @@ pub async fn test( assert_eq!(result, expected); assert::assert_sorted_set_equals( - redis_connection, + valkey_connection, "test_cache_keyspace_simple.test_table:1", &["id, x, name WHERE "], ); assert::assert_sorted_set_equals( - redis_connection, + valkey_connection, "test_cache_keyspace_simple.test_table:2", &["id, x, name WHERE "], ); assert::assert_sorted_set_equals( - redis_connection, + valkey_connection, "test_cache_keyspace_simple.test_table:3", &["id, x, name WHERE "], ); diff --git a/shotover-proxy/tests/cassandra_int_tests/mod.rs b/shotover-proxy/tests/cassandra_int_tests/mod.rs index 5fe7a66ba..a7170740b 100644 --- a/shotover-proxy/tests/cassandra_int_tests/mod.rs +++ b/shotover-proxy/tests/cassandra_int_tests/mod.rs @@ -562,14 +562,14 @@ async fn source_tls_and_cluster_tls(#[case] driver: CassandraDriver) { #[apply(all_cassandra_drivers)] #[tokio::test(flavor = "multi_thread")] -async fn cassandra_redis_cache(#[case] driver: CassandraDriver) { +async fn cassandra_valkey_cache(#[case] driver: CassandraDriver) { let _compose = docker_compose("tests/test-configs/cassandra/redis-cache/docker-compose.yaml"); let shotover = shotover_process("tests/test-configs/cassandra/redis-cache/topology.yaml") .start() .await; - let mut redis_connection = redis_connection::new(6379); + let mut valkey_connection = redis_connection::new(6379); let connection_creator = || CassandraConnectionBuilder::new("127.0.0.1", 9042, driver).build(); let connection = connection_creator().await; @@ -580,7 +580,7 @@ async fn cassandra_redis_cache(#[case] driver: CassandraDriver) { // collections::test // TODO: for some reason this test case fails here prepared_statements_simple::test(&connection, connection_creator, 1).await; batch_statements::test(&connection).await; - cache::test(&connection, &mut redis_connection).await; + cache::test(&connection, &mut valkey_connection).await; shotover.shutdown_and_then_consume_events(&[]).await; } diff --git a/shotover-proxy/tests/redis_int_tests/basic_driver_tests.rs b/shotover-proxy/tests/redis_int_tests/basic_driver_tests.rs index ab5cd1606..1286d5d34 100644 --- a/shotover-proxy/tests/redis_int_tests/basic_driver_tests.rs +++ b/shotover-proxy/tests/redis_int_tests/basic_driver_tests.rs @@ -196,7 +196,8 @@ async fn test_time_cluster(connection: &mut Connection) { .unwrap_err() .detail() .unwrap(), - "unknown command - Shotover RedisSinkCluster does not not support this command".to_string(), + "unknown command - Shotover ValkeySinkCluster does not not support this command" + .to_string(), ); } @@ -209,13 +210,14 @@ async fn test_hello_cluster(connection: &mut Connection) { .unwrap_err() .detail() .unwrap(), - "unknown command - Shotover RedisSinkCluster does not not support this command".to_string(), + "unknown command - Shotover ValkeySinkCluster does not not support this command" + .to_string(), ); } async fn test_client_name_cluster(connection: &mut Connection) { assert_ok(redis::cmd("CLIENT").arg("SETNAME").arg("FOO"), connection).await; - // RedisSinkCluster does not support SETNAME/GETNAME so GETNAME always returns nil + // ValkeySinkCluster does not support SETNAME/GETNAME so GETNAME always returns nil assert_nil(redis::cmd("CLIENT").arg("GETNAME"), connection).await; } @@ -772,7 +774,7 @@ pub async fn test_auth(connection: &mut Connection) { Some("NOAUTH") ); - // Ensure RedisClusterPortsRewrite correctly handles NOAUTH errors + // Ensure ValkeyClusterPortsRewrite correctly handles NOAUTH errors assert_eq!( redis::cmd("CLUSTER") .arg("SLOTS") @@ -1049,7 +1051,7 @@ pub async fn test_cluster_ports_rewrite_nodes(connection: &mut Connection, new_p panic!("CLUSTER REPLICAS never became ready"); } - // refetch master ID, sometimes redis incorrectly reports slave nodes as master nodes during startup. + // refetch master ID, sometimes valkey incorrectly reports slave nodes as master nodes during startup. master_id = get_master_id(connection).await; } tracing::info!("CLUSTER REPLICAS is ready after {:?}", instant.elapsed()); @@ -1087,11 +1089,11 @@ fn assert_cluster_ports_rewrite_nodes(res: Value, new_port: u16) { if let Value::Data(item) = &data[0] { item.to_vec() } else { - panic!("Invalid response from Redis") + panic!("Invalid response from Valkey") } } Value::Data(data) => data.to_vec(), - _ => panic!("Invalid response from Redis"), + _ => panic!("Invalid response from Valkey"), }; let read_cursor = std::io::Cursor::new(data); @@ -1285,7 +1287,7 @@ pub async fn test_trigger_transform_failure_driver(client: &RedisClient) { assert_eq!( // fred sends a `CLIENT` command on startup to which shotover will reply with an error client.wait_for_connect().await.unwrap_err().details(), - format!("ERR Internal shotover (or custom transform) bug: Chain failed to send and/or receive messages, the connection will now be closed. Caused by: 0: RedisSinkSingle transform failed 1: Failed to connect to destination 127.0.0.1:1111 2: Connection refused (os error {CONNECTION_REFUSED_OS_ERROR})") + format!("ERR Internal shotover (or custom transform) bug: Chain failed to send and/or receive messages, the connection will now be closed. Caused by: 0: ValkeySinkSingle transform failed 1: Failed to connect to destination 127.0.0.1:1111 2: Connection refused (os error {CONNECTION_REFUSED_OS_ERROR})") ); } @@ -1294,7 +1296,7 @@ pub async fn test_trigger_transform_failure_driver(client: &RedisClient) { /// CAREFUL: This lacks any kind of check that shotover is ready, /// so make sure shotover_manager.redis_connection is run on 6379 before calling this. pub async fn test_trigger_transform_failure_raw() { - // Send invalid redis command + // Send invalid valkey command // To correctly handle this shotover should close the connection let mut connection = tcp::tcp_stream(Duration::from_secs(3), "127.0.0.1:6379") .await @@ -1304,7 +1306,7 @@ pub async fn test_trigger_transform_failure_raw() { assert_eq!( read_redis_message(&mut connection).await, - ValkeyFrame::Error(format!("ERR Internal shotover (or custom transform) bug: Chain failed to send and/or receive messages, the connection will now be closed. Caused by: 0: RedisSinkSingle transform failed 1: Failed to connect to destination 127.0.0.1:1111 2: Connection refused (os error {CONNECTION_REFUSED_OS_ERROR})").into()) + ValkeyFrame::Error(format!("ERR Internal shotover (or custom transform) bug: Chain failed to send and/or receive messages, the connection will now be closed. Caused by: 0: ValkeySinkSingle transform failed 1: Failed to connect to destination 127.0.0.1:1111 2: Connection refused (os error {CONNECTION_REFUSED_OS_ERROR})").into()) ); // If the connection was closed by shotover then we will succesfully read 0 bytes. @@ -1337,7 +1339,7 @@ async fn read_redis_message(connection: &mut TcpStream) -> ValkeyFrame { /// CAREFUL: This lacks any kind of check that shotover is ready, /// so make sure shotover_manager.redis_connection is run on 6379 before calling this. pub async fn test_invalid_frame() { - // Send invalid redis command + // Send invalid valkey command // To correctly handle this shotover should close the connection let mut connection = tcp::tcp_stream(Duration::from_secs(3), "127.0.0.1:6379") .await @@ -1417,7 +1419,7 @@ async fn test_pubsub_automatic_unsubscription( let mut pubsub_conn = sub_connection.into_pubsub(); pubsub_conn.subscribe(SUBSCRIPTION_KEY).await.unwrap(); // Dropping the connection is whats significant here. - // Redis detects the closed connection and closes the appropriate subscriptions + // Valkey detects the closed connection and closes the appropriate subscriptions drop(pubsub_conn); let mut subscription_count = 1; @@ -1639,7 +1641,7 @@ impl Flusher { connections: vec![ // shotover - shotover might have internal handling for flush that we want to run redis_connection::new_async("127.0.0.1", 6379).await, - // redis cluster instances - shotover may or may not run flush on all cluster instances + // valkey cluster instances - shotover may or may not run flush on all cluster instances redis_connection::new_async("172.16.1.2", 6379).await, redis_connection::new_async("172.16.1.3", 6379).await, redis_connection::new_async("172.16.1.4", 6379).await, @@ -1655,7 +1657,7 @@ impl Flusher { connections: vec![ // shotover - shotover might have internal handling for flush that we want to run redis_connection::new_async("127.0.0.1", 6379).await, - // redis cluster instances - shotover may or may not run flush on all cluster instances + // valkey cluster instances - shotover may or may not run flush on all cluster instances redis_connection::new_async_tls("172.16.1.2", 6379).await, redis_connection::new_async_tls("172.16.1.3", 6379).await, redis_connection::new_async_tls("172.16.1.4", 6379).await, diff --git a/shotover-proxy/tests/redis_int_tests/mod.rs b/shotover-proxy/tests/redis_int_tests/mod.rs index 0388aed9a..9c4beca83 100644 --- a/shotover-proxy/tests/redis_int_tests/mod.rs +++ b/shotover-proxy/tests/redis_int_tests/mod.rs @@ -75,7 +75,7 @@ async fn passthrough_redis_down() { Caused by: 0: Chain failed to send and/or receive messages, the connection will now be closed. - 1: RedisSinkSingle transform failed + 1: ValkeySinkSingle transform failed 2: Failed to connect to destination 127.0.0.1:1111 3: Connection refused (os error {CONNECTION_REFUSED_OS_ERROR})"# )) @@ -88,10 +88,10 @@ Caused by: .with_level(Level::Error) .with_target("shotover::server") .with_message(&format!( - r#"encountered an error when flushing the chain redis for shutdown + r#"encountered an error when flushing the chain valkey for shutdown Caused by: - 0: RedisSinkSingle transform failed + 0: ValkeySinkSingle transform failed 1: Failed to connect to destination 127.0.0.1:1111 2: Connection refused (os error {CONNECTION_REFUSED_OS_ERROR})"# )) @@ -103,7 +103,7 @@ Caused by: #[tokio::test(flavor = "multi_thread")] async fn tls_cluster_sink() { - test_helpers::cert::generate_redis_test_certs(); + test_helpers::cert::generate_valkey_test_certs(); let _compose = docker_compose("tests/test-configs/redis/cluster-tls/docker-compose.yaml"); let shotover = @@ -122,7 +122,7 @@ async fn tls_cluster_sink() { #[tokio::test(flavor = "multi_thread")] async fn tls_source_and_tls_single_sink() { - test_helpers::cert::generate_redis_test_certs(); + test_helpers::cert::generate_valkey_test_certs(); { let _compose = docker_compose("tests/test-configs/redis/tls/docker-compose.yaml"); @@ -337,10 +337,10 @@ pub async fn assert_failed_requests_metric_is_incremented_on_error_response() { .await .unwrap_err(); - // Redis client driver initialization sends 2 CLIENT SETINFO commands which trigger 2 errors - // because those commands are not available in the currently used redis version. + // Valkey client driver initialization sends 2 CLIENT SETINFO commands which trigger 2 errors + // because those commands are not available in the currently used valkey version. assert_metrics_key_value( - r#"shotover_failed_requests_count{chain="redis",transform="RedisSinkSingle"}"#, + r#"shotover_failed_requests_count{chain="valkey",transform="ValkeySinkSingle"}"#, "3", ) .await; diff --git a/shotover-proxy/tests/runner/observability_int_tests.rs b/shotover-proxy/tests/runner/observability_int_tests.rs index f510f1323..61a2f41a7 100644 --- a/shotover-proxy/tests/runner/observability_int_tests.rs +++ b/shotover-proxy/tests/runner/observability_int_tests.rs @@ -23,51 +23,51 @@ async fn test_metrics() { # TYPE shotover_transform_failures_count counter # TYPE shotover_transform_latency_seconds summary # TYPE shotover_transform_total_count counter -connections_opened{source="redis"} -shotover_available_connections_count{source="redis"} -shotover_chain_failures_count{chain="redis"} -shotover_chain_messages_per_batch_count_count{chain="redis"} -shotover_chain_messages_per_batch_count_sum{chain="redis"} -shotover_chain_messages_per_batch_count{chain="redis",quantile="0"} -shotover_chain_messages_per_batch_count{chain="redis",quantile="0.1"} -shotover_chain_messages_per_batch_count{chain="redis",quantile="0.5"} -shotover_chain_messages_per_batch_count{chain="redis",quantile="0.9"} -shotover_chain_messages_per_batch_count{chain="redis",quantile="0.95"} -shotover_chain_messages_per_batch_count{chain="redis",quantile="0.99"} -shotover_chain_messages_per_batch_count{chain="redis",quantile="0.999"} -shotover_chain_messages_per_batch_count{chain="redis",quantile="1"} -shotover_chain_requests_batch_size_count{chain="redis"} -shotover_chain_requests_batch_size_sum{chain="redis"} -shotover_chain_requests_batch_size{chain="redis",quantile="0"} -shotover_chain_requests_batch_size{chain="redis",quantile="0.1"} -shotover_chain_requests_batch_size{chain="redis",quantile="0.5"} -shotover_chain_requests_batch_size{chain="redis",quantile="0.9"} -shotover_chain_requests_batch_size{chain="redis",quantile="0.95"} -shotover_chain_requests_batch_size{chain="redis",quantile="0.99"} -shotover_chain_requests_batch_size{chain="redis",quantile="0.999"} -shotover_chain_requests_batch_size{chain="redis",quantile="1"} -shotover_chain_responses_batch_size_count{chain="redis"} -shotover_chain_responses_batch_size_sum{chain="redis"} -shotover_chain_responses_batch_size{chain="redis",quantile="0"} -shotover_chain_responses_batch_size{chain="redis",quantile="0.1"} -shotover_chain_responses_batch_size{chain="redis",quantile="0.5"} -shotover_chain_responses_batch_size{chain="redis",quantile="0.9"} -shotover_chain_responses_batch_size{chain="redis",quantile="0.95"} -shotover_chain_responses_batch_size{chain="redis",quantile="0.99"} -shotover_chain_responses_batch_size{chain="redis",quantile="0.999"} -shotover_chain_responses_batch_size{chain="redis",quantile="1"} -shotover_chain_total_count{chain="redis"} -shotover_query_count{name="redis-chain"} -shotover_sink_to_source_latency_seconds_count{source="redis"} -shotover_sink_to_source_latency_seconds_sum{source="redis"} -shotover_sink_to_source_latency_seconds{source="redis",quantile="0"} -shotover_sink_to_source_latency_seconds{source="redis",quantile="0.1"} -shotover_sink_to_source_latency_seconds{source="redis",quantile="0.5"} -shotover_sink_to_source_latency_seconds{source="redis",quantile="0.9"} -shotover_sink_to_source_latency_seconds{source="redis",quantile="0.95"} -shotover_sink_to_source_latency_seconds{source="redis",quantile="0.99"} -shotover_sink_to_source_latency_seconds{source="redis",quantile="0.999"} -shotover_sink_to_source_latency_seconds{source="redis",quantile="1"} +connections_opened{source="valkey"} +shotover_available_connections_count{source="valkey"} +shotover_chain_failures_count{chain="valkey"} +shotover_chain_messages_per_batch_count_count{chain="valkey"} +shotover_chain_messages_per_batch_count_sum{chain="valkey"} +shotover_chain_messages_per_batch_count{chain="valkey",quantile="0"} +shotover_chain_messages_per_batch_count{chain="valkey",quantile="0.1"} +shotover_chain_messages_per_batch_count{chain="valkey",quantile="0.5"} +shotover_chain_messages_per_batch_count{chain="valkey",quantile="0.9"} +shotover_chain_messages_per_batch_count{chain="valkey",quantile="0.95"} +shotover_chain_messages_per_batch_count{chain="valkey",quantile="0.99"} +shotover_chain_messages_per_batch_count{chain="valkey",quantile="0.999"} +shotover_chain_messages_per_batch_count{chain="valkey",quantile="1"} +shotover_chain_requests_batch_size_count{chain="valkey"} +shotover_chain_requests_batch_size_sum{chain="valkey"} +shotover_chain_requests_batch_size{chain="valkey",quantile="0"} +shotover_chain_requests_batch_size{chain="valkey",quantile="0.1"} +shotover_chain_requests_batch_size{chain="valkey",quantile="0.5"} +shotover_chain_requests_batch_size{chain="valkey",quantile="0.9"} +shotover_chain_requests_batch_size{chain="valkey",quantile="0.95"} +shotover_chain_requests_batch_size{chain="valkey",quantile="0.99"} +shotover_chain_requests_batch_size{chain="valkey",quantile="0.999"} +shotover_chain_requests_batch_size{chain="valkey",quantile="1"} +shotover_chain_responses_batch_size_count{chain="valkey"} +shotover_chain_responses_batch_size_sum{chain="valkey"} +shotover_chain_responses_batch_size{chain="valkey",quantile="0"} +shotover_chain_responses_batch_size{chain="valkey",quantile="0.1"} +shotover_chain_responses_batch_size{chain="valkey",quantile="0.5"} +shotover_chain_responses_batch_size{chain="valkey",quantile="0.9"} +shotover_chain_responses_batch_size{chain="valkey",quantile="0.95"} +shotover_chain_responses_batch_size{chain="valkey",quantile="0.99"} +shotover_chain_responses_batch_size{chain="valkey",quantile="0.999"} +shotover_chain_responses_batch_size{chain="valkey",quantile="1"} +shotover_chain_total_count{chain="valkey"} +shotover_query_count{name="valkey-chain"} +shotover_sink_to_source_latency_seconds_count{source="valkey"} +shotover_sink_to_source_latency_seconds_sum{source="valkey"} +shotover_sink_to_source_latency_seconds{source="valkey",quantile="0"} +shotover_sink_to_source_latency_seconds{source="valkey",quantile="0.1"} +shotover_sink_to_source_latency_seconds{source="valkey",quantile="0.5"} +shotover_sink_to_source_latency_seconds{source="valkey",quantile="0.9"} +shotover_sink_to_source_latency_seconds{source="valkey",quantile="0.95"} +shotover_sink_to_source_latency_seconds{source="valkey",quantile="0.99"} +shotover_sink_to_source_latency_seconds{source="valkey",quantile="0.999"} +shotover_sink_to_source_latency_seconds{source="valkey",quantile="1"} shotover_transform_failures_count{transform="NullSink"} shotover_transform_failures_count{transform="QueryCounter"} shotover_transform_latency_seconds_count{transform="NullSink"} @@ -119,29 +119,29 @@ shotover_transform_total_count{transform="QueryCounter"} let expected_new = r#" # TYPE shotover_chain_latency_seconds summary -shotover_chain_latency_seconds_count{chain="redis",client_details="127.0.0.1"} -shotover_chain_latency_seconds_sum{chain="redis",client_details="127.0.0.1"} -shotover_chain_latency_seconds{chain="redis",client_details="127.0.0.1",quantile="0"} -shotover_chain_latency_seconds{chain="redis",client_details="127.0.0.1",quantile="0.1"} -shotover_chain_latency_seconds{chain="redis",client_details="127.0.0.1",quantile="0.5"} -shotover_chain_latency_seconds{chain="redis",client_details="127.0.0.1",quantile="0.9"} -shotover_chain_latency_seconds{chain="redis",client_details="127.0.0.1",quantile="0.95"} -shotover_chain_latency_seconds{chain="redis",client_details="127.0.0.1",quantile="0.99"} -shotover_chain_latency_seconds{chain="redis",client_details="127.0.0.1",quantile="0.999"} -shotover_chain_latency_seconds{chain="redis",client_details="127.0.0.1",quantile="1"} -shotover_query_count{name="redis-chain",query="CLIENT",type="valkey"} -shotover_query_count{name="redis-chain",query="GET",type="valkey"} -shotover_query_count{name="redis-chain",query="SET",type="valkey"} +shotover_chain_latency_seconds_count{chain="valkey",client_details="127.0.0.1"} +shotover_chain_latency_seconds_sum{chain="valkey",client_details="127.0.0.1"} +shotover_chain_latency_seconds{chain="valkey",client_details="127.0.0.1",quantile="0"} +shotover_chain_latency_seconds{chain="valkey",client_details="127.0.0.1",quantile="0.1"} +shotover_chain_latency_seconds{chain="valkey",client_details="127.0.0.1",quantile="0.5"} +shotover_chain_latency_seconds{chain="valkey",client_details="127.0.0.1",quantile="0.9"} +shotover_chain_latency_seconds{chain="valkey",client_details="127.0.0.1",quantile="0.95"} +shotover_chain_latency_seconds{chain="valkey",client_details="127.0.0.1",quantile="0.99"} +shotover_chain_latency_seconds{chain="valkey",client_details="127.0.0.1",quantile="0.999"} +shotover_chain_latency_seconds{chain="valkey",client_details="127.0.0.1",quantile="1"} +shotover_query_count{name="valkey-chain",query="CLIENT",type="valkey"} +shotover_query_count{name="valkey-chain",query="GET",type="valkey"} +shotover_query_count{name="valkey-chain",query="SET",type="valkey"} "#; assert_metrics_has_keys(expected, expected_new).await; assert_metrics_key_value( - r#"shotover_query_count{name="redis-chain",query="GET",type="valkey"}"#, + r#"shotover_query_count{name="valkey-chain",query="GET",type="valkey"}"#, "1", ) .await; assert_metrics_key_value( - r#"shotover_query_count{name="redis-chain",query="SET",type="valkey"}"#, + r#"shotover_query_count{name="valkey-chain",query="SET",type="valkey"}"#, "2", ) .await; diff --git a/shotover-proxy/tests/runner/runner_int_tests.rs b/shotover-proxy/tests/runner/runner_int_tests.rs index 5400c79ce..c439e52cc 100644 --- a/shotover-proxy/tests/runner/runner_int_tests.rs +++ b/shotover-proxy/tests/runner/runner_int_tests.rs @@ -57,8 +57,8 @@ async fn test_shotover_shutdown_when_invalid_topology_non_terminating_last() { Caused by: Topology errors - redis source: - redis chain: + valkey source: + valkey chain: Non-terminating transform \"DebugPrinter\" is last in chain. Last transform must be terminating. ")]) .await; @@ -76,8 +76,8 @@ async fn test_shotover_shutdown_when_invalid_topology_terminating_not_last() { Caused by: Topology errors - redis source: - redis chain: + valkey source: + valkey chain: Terminating transform \"NullSink\" is not last in chain. Terminating transform must be last in chain. ")]) .await; @@ -95,13 +95,13 @@ async fn test_shotover_shutdown_when_topology_invalid_topology_subchains() { Caused by: Topology errors - redis1 source: - redis1 chain: + valkey1 source: + valkey1 chain: Terminating transform "NullSink" is not last in chain. Terminating transform must be last in chain. Terminating transform "NullSink" is not last in chain. Terminating transform must be last in chain. Non-terminating transform "DebugPrinter" is last in chain. Last transform must be terminating. - redis2 source: - redis2 chain: + valkey2 source: + valkey2 chain: ParallelMap: parallel_map_chain chain: Terminating transform "NullSink" is not last in chain. Terminating transform must be last in chain. @@ -123,7 +123,7 @@ async fn test_shotover_shutdown_when_protocol_mismatch() { Caused by: Topology errors - Transform RedisSinkSingle requires upchain protocol to be one of [Valkey] but was Cassandra + Transform ValkeySinkSingle requires upchain protocol to be one of [Valkey] but was Cassandra "#, )]) .await; diff --git a/shotover-proxy/tests/test-configs/cassandra/redis-cache/topology.yaml b/shotover-proxy/tests/test-configs/cassandra/redis-cache/topology.yaml index 10347ad1a..61f6bcb62 100644 --- a/shotover-proxy/tests/test-configs/cassandra/redis-cache/topology.yaml +++ b/shotover-proxy/tests/test-configs/cassandra/redis-cache/topology.yaml @@ -4,7 +4,7 @@ sources: name: "cassandra" listen_addr: "127.0.0.1:9042" chain: - - RedisCache: + - ValkeyCache: caching_schema: test_cache_keyspace_batch_insert.test_table: partition_key: [id] @@ -13,7 +13,7 @@ sources: partition_key: [id] range_key: [] chain: - - RedisSinkSingle: + - ValkeySinkSingle: remote_address: "127.0.0.1:6379" connect_timeout_ms: 3000 - CassandraSinkSingle: diff --git a/shotover-proxy/tests/test-configs/invalid_non_terminating_last.yaml b/shotover-proxy/tests/test-configs/invalid_non_terminating_last.yaml index 150bc64c9..bf279adcb 100644 --- a/shotover-proxy/tests/test-configs/invalid_non_terminating_last.yaml +++ b/shotover-proxy/tests/test-configs/invalid_non_terminating_last.yaml @@ -1,7 +1,7 @@ --- sources: - Valkey: - name: "redis" + name: "valkey" listen_addr: "127.0.0.1:6379" chain: - DebugPrinter diff --git a/shotover-proxy/tests/test-configs/invalid_protocol_mismatch.yaml b/shotover-proxy/tests/test-configs/invalid_protocol_mismatch.yaml index c884de90e..adecb3915 100644 --- a/shotover-proxy/tests/test-configs/invalid_protocol_mismatch.yaml +++ b/shotover-proxy/tests/test-configs/invalid_protocol_mismatch.yaml @@ -6,6 +6,6 @@ sources: chain: - QueryCounter: name: cassandra - - RedisSinkSingle: + - ValkeySinkSingle: remote_address: "127.0.0.1:1111" connect_timeout_ms: 3000 diff --git a/shotover-proxy/tests/test-configs/invalid_subchains.yaml b/shotover-proxy/tests/test-configs/invalid_subchains.yaml index e2d888270..2975b479b 100644 --- a/shotover-proxy/tests/test-configs/invalid_subchains.yaml +++ b/shotover-proxy/tests/test-configs/invalid_subchains.yaml @@ -1,14 +1,14 @@ --- sources: - Valkey: - name: "redis1" + name: "valkey1" listen_addr: "127.0.0.1:6379" chain: - NullSink - NullSink - DebugPrinter - Valkey: - name: "redis2" + name: "valkey2" listen_addr: "127.0.0.1:6379" chain: - DebugPrinter diff --git a/shotover-proxy/tests/test-configs/invalid_terminating_not_last.yaml b/shotover-proxy/tests/test-configs/invalid_terminating_not_last.yaml index 59f33c30e..32e801790 100644 --- a/shotover-proxy/tests/test-configs/invalid_terminating_not_last.yaml +++ b/shotover-proxy/tests/test-configs/invalid_terminating_not_last.yaml @@ -1,7 +1,7 @@ --- sources: - Valkey: - name: "redis" + name: "valkey" listen_addr: "127.0.0.1:6379" chain: - NullSink diff --git a/shotover-proxy/tests/test-configs/log-to-file/topology.yaml b/shotover-proxy/tests/test-configs/log-to-file/topology.yaml index 06451cc70..ed4248ec0 100644 --- a/shotover-proxy/tests/test-configs/log-to-file/topology.yaml +++ b/shotover-proxy/tests/test-configs/log-to-file/topology.yaml @@ -1,10 +1,10 @@ --- sources: - Valkey: - name: "redis" + name: "valkey" listen_addr: "127.0.0.1:6379" chain: - DebugLogToFile - - RedisSinkSingle: + - ValkeySinkSingle: remote_address: "127.0.0.1:1111" connect_timeout_ms: 3000 diff --git a/shotover-proxy/tests/test-configs/null-redis/topology.yaml b/shotover-proxy/tests/test-configs/null-redis/topology.yaml index fb11e49ae..828744dc0 100644 --- a/shotover-proxy/tests/test-configs/null-redis/topology.yaml +++ b/shotover-proxy/tests/test-configs/null-redis/topology.yaml @@ -1,9 +1,9 @@ --- sources: - Valkey: - name: "redis" + name: "valkey" listen_addr: "127.0.0.1:6379" chain: - QueryCounter: - name: redis-chain + name: valkey-chain - NullSink diff --git a/shotover-proxy/tests/test-configs/query_type_filter/simple.yaml b/shotover-proxy/tests/test-configs/query_type_filter/simple.yaml index 7ff4dc357..6a694bcce 100644 --- a/shotover-proxy/tests/test-configs/query_type_filter/simple.yaml +++ b/shotover-proxy/tests/test-configs/query_type_filter/simple.yaml @@ -1,7 +1,7 @@ --- sources: - Valkey: - name: "redis1" + name: "valkey1" listen_addr: "127.0.0.1:6379" connection_limit: 3000000 chain: @@ -10,7 +10,7 @@ sources: - DebugReturner: Valkey: "42" - Valkey: - name: "redis2" + name: "valkey2" listen_addr: "127.0.0.1:6380" connection_limit: 3000000 chain: diff --git a/shotover-proxy/tests/test-configs/redis/cluster-auth/topology.yaml b/shotover-proxy/tests/test-configs/redis/cluster-auth/topology.yaml index 70a0b09c1..f5344d1ae 100644 --- a/shotover-proxy/tests/test-configs/redis/cluster-auth/topology.yaml +++ b/shotover-proxy/tests/test-configs/redis/cluster-auth/topology.yaml @@ -1,14 +1,14 @@ --- sources: - Valkey: - name: "redis" + name: "valkey" listen_addr: "127.0.0.1:6379" chain: # This transform is only here to ensure that the transform correctly handles the case where - # redis returns an error due to being unauthenticated - - RedisClusterPortsRewrite: + # valkey returns an error due to being unauthenticated + - ValkeyClusterPortsRewrite: new_port: 6379 - - RedisSinkCluster: + - ValkeySinkCluster: first_contact_points: [ "127.0.0.1:2230", diff --git a/shotover-proxy/tests/test-configs/redis/cluster-dr/topology.yaml b/shotover-proxy/tests/test-configs/redis/cluster-dr/topology.yaml index 1e40d7989..eb35f3968 100644 --- a/shotover-proxy/tests/test-configs/redis/cluster-dr/topology.yaml +++ b/shotover-proxy/tests/test-configs/redis/cluster-dr/topology.yaml @@ -2,7 +2,7 @@ --- sources: - Valkey: - name: "redis" + name: "valkey" listen_addr: "127.0.0.1:6379" connection_limit: 3000000 chain: @@ -18,11 +18,11 @@ sources: flush_when_millis_since_last_flush: 1000000000 - QueryCounter: name: "DR chain" - - RedisSinkCluster: + - ValkeySinkCluster: first_contact_points: [ "127.0.0.1:2120", "127.0.0.1:2121", "127.0.0.1:2122", "127.0.0.1:2123", "127.0.0.1:2124", "127.0.0.1:2125" ] connect_timeout_ms: 3000 - QueryCounter: name: "Main chain" - - RedisSinkCluster: + - ValkeySinkCluster: first_contact_points: [ "127.0.0.1:2220", "127.0.0.1:2221", "127.0.0.1:2222", "127.0.0.1:2223", "127.0.0.1:2224", "127.0.0.1:2225" ] connect_timeout_ms: 3000 diff --git a/shotover-proxy/tests/test-configs/redis/cluster-handling/topology.yaml b/shotover-proxy/tests/test-configs/redis/cluster-handling/topology.yaml index 355c71c6b..5af7415a0 100644 --- a/shotover-proxy/tests/test-configs/redis/cluster-handling/topology.yaml +++ b/shotover-proxy/tests/test-configs/redis/cluster-handling/topology.yaml @@ -1,10 +1,10 @@ --- sources: - Valkey: - name: "redis" + name: "valkey" listen_addr: "127.0.0.1:6379" chain: - - RedisSinkCluster: + - ValkeySinkCluster: first_contact_points: - "172.16.1.2:6379" - "172.16.1.3:6379" diff --git a/shotover-proxy/tests/test-configs/redis/cluster-hiding/topology-encode.yaml b/shotover-proxy/tests/test-configs/redis/cluster-hiding/topology-encode.yaml index a9ea2bae0..46e2642a1 100644 --- a/shotover-proxy/tests/test-configs/redis/cluster-hiding/topology-encode.yaml +++ b/shotover-proxy/tests/test-configs/redis/cluster-hiding/topology-encode.yaml @@ -1,13 +1,13 @@ --- sources: - Valkey: - name: "redis" + name: "valkey" listen_addr: "127.0.0.1:6379" chain: - DebugForceEncode: encode_requests: true encode_responses: true - - RedisSinkCluster: + - ValkeySinkCluster: first_contact_points: - "172.16.1.2:6379" - "172.16.1.3:6379" diff --git a/shotover-proxy/tests/test-configs/redis/cluster-hiding/topology.yaml b/shotover-proxy/tests/test-configs/redis/cluster-hiding/topology.yaml index 2f4aae166..4ce346d5c 100644 --- a/shotover-proxy/tests/test-configs/redis/cluster-hiding/topology.yaml +++ b/shotover-proxy/tests/test-configs/redis/cluster-hiding/topology.yaml @@ -1,10 +1,10 @@ --- sources: - Valkey: - name: "redis" + name: "valkey" listen_addr: "127.0.0.1:6379" chain: - - RedisSinkCluster: + - ValkeySinkCluster: first_contact_points: - "172.16.1.2:6379" - "172.16.1.3:6379" diff --git a/shotover-proxy/tests/test-configs/redis/cluster-ports-rewrite/topology.yaml b/shotover-proxy/tests/test-configs/redis/cluster-ports-rewrite/topology.yaml index 17f5a8d64..5c3e9cfaf 100644 --- a/shotover-proxy/tests/test-configs/redis/cluster-ports-rewrite/topology.yaml +++ b/shotover-proxy/tests/test-configs/redis/cluster-ports-rewrite/topology.yaml @@ -1,11 +1,11 @@ --- sources: - Valkey: - name: "redis" + name: "valkey" listen_addr: "127.0.0.1:6380" chain: - - RedisClusterPortsRewrite: + - ValkeyClusterPortsRewrite: new_port: 6380 - - RedisSinkCluster: + - ValkeySinkCluster: first_contact_points: ["127.0.0.1:2220", "127.0.0.1:2221", "127.0.0.1:2222", "127.0.0.1:2223", "127.0.0.1:2224", "127.0.0.1:2225"] connect_timeout_ms: 3000 diff --git a/shotover-proxy/tests/test-configs/redis/cluster-tls/topology-encode.yaml b/shotover-proxy/tests/test-configs/redis/cluster-tls/topology-encode.yaml index 6ace09980..76c355dbd 100644 --- a/shotover-proxy/tests/test-configs/redis/cluster-tls/topology-encode.yaml +++ b/shotover-proxy/tests/test-configs/redis/cluster-tls/topology-encode.yaml @@ -1,7 +1,7 @@ --- sources: - Valkey: - name: "redis" + name: "valkey" listen_addr: "127.0.0.1:6379" tls: certificate_path: "tests/test-configs/redis/tls/certs/localhost.crt" @@ -10,7 +10,7 @@ sources: - DebugForceEncode: encode_requests: true encode_responses: true - - RedisSinkCluster: + - ValkeySinkCluster: first_contact_points: - "172.16.1.2:6379" - "172.16.1.3:6379" diff --git a/shotover-proxy/tests/test-configs/redis/cluster-tls/topology-no-source-encryption.yaml b/shotover-proxy/tests/test-configs/redis/cluster-tls/topology-no-source-encryption.yaml index 5ba5e954d..c5ce05254 100644 --- a/shotover-proxy/tests/test-configs/redis/cluster-tls/topology-no-source-encryption.yaml +++ b/shotover-proxy/tests/test-configs/redis/cluster-tls/topology-no-source-encryption.yaml @@ -1,10 +1,10 @@ --- sources: - Valkey: - name: "redis" + name: "valkey" listen_addr: "127.0.0.1:6379" chain: - - RedisSinkCluster: + - ValkeySinkCluster: first_contact_points: - "172.16.1.2:6379" - "172.16.1.3:6379" diff --git a/shotover-proxy/tests/test-configs/redis/cluster-tls/topology.yaml b/shotover-proxy/tests/test-configs/redis/cluster-tls/topology.yaml index a71886b13..4c3534742 100644 --- a/shotover-proxy/tests/test-configs/redis/cluster-tls/topology.yaml +++ b/shotover-proxy/tests/test-configs/redis/cluster-tls/topology.yaml @@ -1,13 +1,13 @@ --- sources: - Valkey: - name: "redis" + name: "valkey" listen_addr: "127.0.0.1:6379" tls: certificate_path: "tests/test-configs/redis/tls/certs/localhost.crt" private_key_path: "tests/test-configs/redis/tls/certs/localhost.key" chain: - - RedisSinkCluster: + - ValkeySinkCluster: first_contact_points: - "172.16.1.2:6379" - "172.16.1.3:6379" diff --git a/shotover-proxy/tests/test-configs/redis/passthrough/topology-encode.yaml b/shotover-proxy/tests/test-configs/redis/passthrough/topology-encode.yaml index 3a5f35aa1..7bd15dde9 100644 --- a/shotover-proxy/tests/test-configs/redis/passthrough/topology-encode.yaml +++ b/shotover-proxy/tests/test-configs/redis/passthrough/topology-encode.yaml @@ -1,12 +1,12 @@ --- sources: - Valkey: - name: "redis" + name: "valkey" listen_addr: "127.0.0.1:6379" chain: - DebugForceEncode: encode_requests: true encode_responses: true - - RedisSinkSingle: + - ValkeySinkSingle: remote_address: "127.0.0.1:1111" connect_timeout_ms: 3000 diff --git a/shotover-proxy/tests/test-configs/redis/passthrough/topology.yaml b/shotover-proxy/tests/test-configs/redis/passthrough/topology.yaml index 3b7f1726b..f4bc78724 100644 --- a/shotover-proxy/tests/test-configs/redis/passthrough/topology.yaml +++ b/shotover-proxy/tests/test-configs/redis/passthrough/topology.yaml @@ -1,9 +1,9 @@ --- sources: - Valkey: - name: "redis" + name: "valkey" listen_addr: "127.0.0.1:6379" chain: - - RedisSinkSingle: + - ValkeySinkSingle: remote_address: "127.0.0.1:1111" connect_timeout_ms: 3000 diff --git a/shotover-proxy/tests/test-configs/redis/tls-no-client-auth/topology.yaml b/shotover-proxy/tests/test-configs/redis/tls-no-client-auth/topology.yaml index 523b2a7d9..e56bd01e9 100644 --- a/shotover-proxy/tests/test-configs/redis/tls-no-client-auth/topology.yaml +++ b/shotover-proxy/tests/test-configs/redis/tls-no-client-auth/topology.yaml @@ -1,13 +1,13 @@ --- sources: - Valkey: - name: "redis" + name: "valkey" listen_addr: "127.0.0.1:6379" tls: certificate_path: "tests/test-configs/redis/tls/certs/localhost.crt" private_key_path: "tests/test-configs/redis/tls/certs/localhost.key" chain: - - RedisSinkSingle: + - ValkeySinkSingle: remote_address: "localhost:1111" connect_timeout_ms: 3000 tls: diff --git a/shotover-proxy/tests/test-configs/redis/tls-no-verify-hostname/topology.yaml b/shotover-proxy/tests/test-configs/redis/tls-no-verify-hostname/topology.yaml index ebfaed89d..a6c92920f 100644 --- a/shotover-proxy/tests/test-configs/redis/tls-no-verify-hostname/topology.yaml +++ b/shotover-proxy/tests/test-configs/redis/tls-no-verify-hostname/topology.yaml @@ -1,13 +1,13 @@ --- sources: - Valkey: - name: "redis" + name: "valkey" listen_addr: "127.0.0.1:6379" tls: certificate_path: "tests/test-configs/redis/tls/certs/localhost.crt" private_key_path: "tests/test-configs/redis/tls/certs/localhost.key" chain: - - RedisSinkSingle: + - ValkeySinkSingle: remote_address: "localhost:1111" connect_timeout_ms: 3000 tls: diff --git a/shotover-proxy/tests/test-configs/redis/tls/topology-encode.yaml b/shotover-proxy/tests/test-configs/redis/tls/topology-encode.yaml index e2a056933..037f7659f 100644 --- a/shotover-proxy/tests/test-configs/redis/tls/topology-encode.yaml +++ b/shotover-proxy/tests/test-configs/redis/tls/topology-encode.yaml @@ -1,7 +1,7 @@ --- sources: - Valkey: - name: "redis" + name: "valkey" listen_addr: "127.0.0.1:6379" tls: certificate_path: "tests/test-configs/redis/tls/certs/localhost.crt" @@ -10,7 +10,7 @@ sources: - DebugForceEncode: encode_requests: true encode_responses: true - - RedisSinkSingle: + - ValkeySinkSingle: remote_address: "localhost:1111" connect_timeout_ms: 3000 tls: diff --git a/shotover-proxy/tests/test-configs/redis/tls/topology.yaml b/shotover-proxy/tests/test-configs/redis/tls/topology.yaml index 629eab380..93b46d9fe 100644 --- a/shotover-proxy/tests/test-configs/redis/tls/topology.yaml +++ b/shotover-proxy/tests/test-configs/redis/tls/topology.yaml @@ -1,13 +1,13 @@ --- sources: - Valkey: - name: "redis" + name: "valkey" listen_addr: "127.0.0.1:6379" tls: certificate_path: "tests/test-configs/redis/tls/certs/localhost.crt" private_key_path: "tests/test-configs/redis/tls/certs/localhost.key" chain: - - RedisSinkSingle: + - ValkeySinkSingle: remote_address: "localhost:1111" connect_timeout_ms: 3000 tls: diff --git a/shotover-proxy/tests/test-configs/tee/fail.yaml b/shotover-proxy/tests/test-configs/tee/fail.yaml index 84af5f1c4..7dcfeb25b 100644 --- a/shotover-proxy/tests/test-configs/tee/fail.yaml +++ b/shotover-proxy/tests/test-configs/tee/fail.yaml @@ -1,7 +1,7 @@ --- sources: - Valkey: - name: "redis" + name: "valkey" listen_addr: "127.0.0.1:6379" connection_limit: 3000000 chain: diff --git a/shotover-proxy/tests/test-configs/tee/fail_with_mismatch.yaml b/shotover-proxy/tests/test-configs/tee/fail_with_mismatch.yaml index fec8798ec..e4cf4e2d0 100644 --- a/shotover-proxy/tests/test-configs/tee/fail_with_mismatch.yaml +++ b/shotover-proxy/tests/test-configs/tee/fail_with_mismatch.yaml @@ -1,7 +1,7 @@ --- sources: - Valkey: - name: "redis" + name: "valkey" listen_addr: "127.0.0.1:6379" connection_limit: 3000000 chain: diff --git a/shotover-proxy/tests/test-configs/tee/ignore.yaml b/shotover-proxy/tests/test-configs/tee/ignore.yaml index 22966bc99..acbd69f1b 100644 --- a/shotover-proxy/tests/test-configs/tee/ignore.yaml +++ b/shotover-proxy/tests/test-configs/tee/ignore.yaml @@ -1,7 +1,7 @@ --- sources: - Valkey: - name: "redis" + name: "valkey" listen_addr: "127.0.0.1:6379" connection_limit: 3000000 chain: diff --git a/shotover-proxy/tests/test-configs/tee/ignore_with_mismatch.yaml b/shotover-proxy/tests/test-configs/tee/ignore_with_mismatch.yaml index 5f0fb21a8..d45e1072c 100644 --- a/shotover-proxy/tests/test-configs/tee/ignore_with_mismatch.yaml +++ b/shotover-proxy/tests/test-configs/tee/ignore_with_mismatch.yaml @@ -1,7 +1,7 @@ --- sources: - Valkey: - name: "redis" + name: "valkey" listen_addr: "127.0.0.1:6379" connection_limit: 3000000 chain: diff --git a/shotover-proxy/tests/test-configs/tee/log.yaml b/shotover-proxy/tests/test-configs/tee/log.yaml index 36e042c19..063818dec 100644 --- a/shotover-proxy/tests/test-configs/tee/log.yaml +++ b/shotover-proxy/tests/test-configs/tee/log.yaml @@ -1,7 +1,7 @@ --- sources: - Valkey: - name: "redis" + name: "valkey" listen_addr: "127.0.0.1:6379" connection_limit: 3000000 chain: diff --git a/shotover-proxy/tests/test-configs/tee/log_with_mismatch.yaml b/shotover-proxy/tests/test-configs/tee/log_with_mismatch.yaml index 5320244f2..44d5c43a1 100644 --- a/shotover-proxy/tests/test-configs/tee/log_with_mismatch.yaml +++ b/shotover-proxy/tests/test-configs/tee/log_with_mismatch.yaml @@ -1,7 +1,7 @@ --- sources: - Valkey: - name: "redis" + name: "valkey" listen_addr: "127.0.0.1:6379" connection_limit: 3000000 chain: diff --git a/shotover-proxy/tests/test-configs/tee/subchain.yaml b/shotover-proxy/tests/test-configs/tee/subchain.yaml index f9e542162..9532467d4 100644 --- a/shotover-proxy/tests/test-configs/tee/subchain.yaml +++ b/shotover-proxy/tests/test-configs/tee/subchain.yaml @@ -1,7 +1,7 @@ --- sources: - Valkey: - name: "redis" + name: "valkey" listen_addr: "127.0.0.1:6379" connection_limit: 3000000 chain: @@ -10,7 +10,7 @@ sources: SubchainOnMismatch: - QueryTypeFilter: DenyList: [Read] - - RedisSinkSingle: + - ValkeySinkSingle: remote_address: "127.0.0.1:1111" connect_timeout_ms: 3000 buffer_size: 10000 diff --git a/shotover-proxy/tests/test-configs/tee/subchain_with_mismatch.yaml b/shotover-proxy/tests/test-configs/tee/subchain_with_mismatch.yaml index afe89c0ad..bcca9419d 100644 --- a/shotover-proxy/tests/test-configs/tee/subchain_with_mismatch.yaml +++ b/shotover-proxy/tests/test-configs/tee/subchain_with_mismatch.yaml @@ -1,7 +1,7 @@ --- sources: - Valkey: - name: "redis" + name: "valkey" listen_addr: "127.0.0.1:6379" connection_limit: 3000000 chain: @@ -11,7 +11,7 @@ sources: SubchainOnMismatch: - QueryTypeFilter: DenyList: [Read] - - RedisSinkSingle: + - ValkeySinkSingle: remote_address: "127.0.0.1:1111" connect_timeout_ms: 3000 chain: diff --git a/shotover-proxy/tests/test-configs/tee/switch_chain.yaml b/shotover-proxy/tests/test-configs/tee/switch_chain.yaml index d68af33ce..4d4d60c51 100644 --- a/shotover-proxy/tests/test-configs/tee/switch_chain.yaml +++ b/shotover-proxy/tests/test-configs/tee/switch_chain.yaml @@ -1,7 +1,7 @@ --- sources: - Valkey: - name: "redis-1" + name: "valkey-1" listen_addr: "127.0.0.1:6371" connection_limit: chain: @@ -15,7 +15,7 @@ sources: - DebugReturner: Valkey: "a" - Valkey: - name: "redis-2" + name: "valkey-2" listen_addr: "127.0.0.1:6372" connection_limit: chain: @@ -31,7 +31,7 @@ sources: - DebugReturner: Valkey: "a" - Valkey: - name: "redis-3" + name: "valkey-3" listen_addr: "127.0.0.1:6373" connection_limit: chain: diff --git a/shotover-proxy/tests/transforms/tee.rs b/shotover-proxy/tests/transforms/tee.rs index c4a1f5a0b..0f715b0e7 100644 --- a/shotover-proxy/tests/transforms/tee.rs +++ b/shotover-proxy/tests/transforms/tee.rs @@ -138,11 +138,11 @@ async fn test_subchain_matches() { .await; let mut shotover_connection = redis_connection::new_async("127.0.0.1", 6379).await; - let mut mismatch_chain_redis = redis_connection::new_async("127.0.0.1", 1111).await; + let mut mismatch_chain_valkey = redis_connection::new_async("127.0.0.1", 1111).await; redis::cmd("SET") .arg("key") .arg("myvalue") - .query_async::<_, String>(&mut mismatch_chain_redis) + .query_async::<_, String>(&mut mismatch_chain_valkey) .await .unwrap(); @@ -157,7 +157,7 @@ async fn test_subchain_matches() { result = redis::cmd("GET") .arg("key") - .query_async::<_, String>(&mut mismatch_chain_redis) + .query_async::<_, String>(&mut mismatch_chain_valkey) .await .unwrap(); @@ -173,9 +173,9 @@ async fn test_subchain_with_mismatch() { .await; let mut shotover_connection = redis_connection::new_async("127.0.0.1", 6379).await; - let mut mismatch_chain_redis = redis_connection::new_async("127.0.0.1", 1111).await; + let mut mismatch_chain_valkey = redis_connection::new_async("127.0.0.1", 1111).await; - // Set the value on the top level chain redis + // Set the value on the top level chain valkey let mut result = redis::cmd("SET") .arg("key") .arg("myvalue") @@ -185,10 +185,10 @@ async fn test_subchain_with_mismatch() { assert_eq!(result, "42"); - // When the mismatch occurs, the value should be sent to the mismatch chain's redis + // When the mismatch occurs, the value should be sent to the mismatch chain's valkey result = redis::cmd("GET") .arg("key") - .query_async::<_, String>(&mut mismatch_chain_redis) + .query_async::<_, String>(&mut mismatch_chain_valkey) .await .unwrap(); @@ -204,10 +204,10 @@ async fn test_switch_main_chain() { for i in 1..=3 { println!("{i}"); - let redis_port = 6370 + i; + let valkey_port = 6370 + i; let switch_port = 1230 + i; - let mut connection = redis_connection::new_async("127.0.0.1", redis_port).await; + let mut connection = redis_connection::new_async("127.0.0.1", valkey_port).await; let result = redis::cmd("SET") .arg("key") diff --git a/shotover/benches/benches/chain.rs b/shotover/benches/benches/chain.rs index 9b783be8e..28817e460 100644 --- a/shotover/benches/benches/chain.rs +++ b/shotover/benches/benches/chain.rs @@ -17,7 +17,7 @@ use shotover::transforms::null::NullSink; #[cfg(feature = "alpha-transforms")] use shotover::transforms::protect::{KeyManagerConfig, ProtectConfig}; use shotover::transforms::query_counter::QueryCounter; -use shotover::transforms::redis::cluster_ports_rewrite::RedisClusterPortsRewrite; +use shotover::transforms::redis::cluster_ports_rewrite::ValkeyClusterPortsRewrite; use shotover::transforms::throttling::RequestThrottlingConfig; use shotover::transforms::{ ChainState, TransformConfig, TransformContextBuilder, TransformContextConfig, @@ -88,7 +88,7 @@ fn criterion_benchmark(c: &mut Criterion) { "127.0.0.1:6379".parse().unwrap(), ); - group.bench_function("redis_filter", |b| { + group.bench_function("valkey_filter", |b| { b.to_async(&rt).iter_batched( || BenchInput::new_pre_used(&chain, &chain_state), BenchInput::bench, @@ -100,7 +100,7 @@ fn criterion_benchmark(c: &mut Criterion) { { let chain = TransformChainBuilder::new( vec![ - Box::new(RedisClusterPortsRewrite::new(2004)), + Box::new(ValkeyClusterPortsRewrite::new(2004)), Box::::default(), ], "bench", @@ -116,7 +116,7 @@ fn criterion_benchmark(c: &mut Criterion) { "127.0.0.1:6379".parse().unwrap(), ); - group.bench_function("redis_cluster_ports_rewrite", |b| { + group.bench_function("valkey_cluster_ports_rewrite", |b| { b.to_async(&rt).iter_batched( || BenchInput::new_pre_used(&chain, &chain_state), BenchInput::bench, diff --git a/shotover/src/config/chain.rs b/shotover/src/config/chain.rs index f9aad153a..3d19ee69a 100644 --- a/shotover/src/config/chain.rs +++ b/shotover/src/config/chain.rs @@ -62,7 +62,7 @@ impl TransformChainConfig { /// e.g. with typetag + yaml + the default serializer: /// this would fail to deserialize: /// ```yaml -/// Redis: +/// Valkey: /// ... /// chain: /// - NullSink @@ -70,7 +70,7 @@ impl TransformChainConfig { /// /// but this would work fine: /// ```yaml -/// Redis: +/// Valkey: /// ... /// chain: /// - NullSink: {} diff --git a/shotover/src/config/topology.rs b/shotover/src/config/topology.rs index 162b1a523..fffb80be8 100644 --- a/shotover/src/config/topology.rs +++ b/shotover/src/config/topology.rs @@ -89,7 +89,7 @@ mod topology_tests { use crate::{ sources::{redis::ValkeyConfig, Source, SourceConfig}, transforms::{ - parallel_map::ParallelMapConfig, redis::cache::RedisConfig as RedisCacheConfig, + parallel_map::ParallelMapConfig, redis::cache::ValkeyConfig as ValkeyCacheConfig, }, }; use pretty_assertions::assert_eq; @@ -266,7 +266,7 @@ foo source: run_test_topology_cassandra(vec![ Box::new(DebugPrinterConfig), Box::new(DebugPrinterConfig), - Box::new(RedisCacheConfig { + Box::new(ValkeyCacheConfig { chain: TransformChainConfig(vec![ Box::new(DebugPrinterConfig), Box::new(DebugPrinterConfig), @@ -285,7 +285,7 @@ foo source: let expected = r#"Topology errors foo source: foo chain: - RedisCache: + ValkeyCache: cache_chain chain: Terminating transform "NullSink" is not last in chain. Terminating transform must be last in chain. "#; @@ -293,7 +293,7 @@ foo source: let error = run_test_topology_cassandra(vec![ Box::new(DebugPrinterConfig), Box::new(DebugPrinterConfig), - Box::new(RedisCacheConfig { + Box::new(ValkeyCacheConfig { chain: TransformChainConfig(vec![ Box::new(DebugPrinterConfig), Box::new(NullSinkConfig), @@ -494,13 +494,13 @@ Source name "foo" occurred more than once. Make sure all source names are unique .to_string(); let expected = r#"Topology errors -redis1 source: - redis1 chain: +valkey1 source: + valkey1 chain: Terminating transform "NullSink" is not last in chain. Terminating transform must be last in chain. Terminating transform "NullSink" is not last in chain. Terminating transform must be last in chain. Non-terminating transform "DebugPrinter" is last in chain. Last transform must be terminating. -redis2 source: - redis2 chain: +valkey2 source: + valkey2 chain: ParallelMap: parallel_map_chain chain: Terminating transform "NullSink" is not last in chain. Terminating transform must be last in chain. diff --git a/shotover/src/transforms/redis/cache.rs b/shotover/src/transforms/redis/cache.rs index 2e848c0d8..f7d9102eb 100644 --- a/shotover/src/transforms/redis/cache.rs +++ b/shotover/src/transforms/redis/cache.rs @@ -80,15 +80,15 @@ impl From<&TableCacheSchemaConfig> for TableCacheSchema { #[derive(Serialize, Deserialize, Debug)] #[serde(deny_unknown_fields)] -pub struct RedisConfig { +pub struct ValkeyConfig { pub caching_schema: HashMap, pub chain: TransformChainConfig, } -const NAME: &str = "RedisCache"; -#[typetag::serde(name = "RedisCache")] +const NAME: &str = "ValkeyCache"; +#[typetag::serde(name = "ValkeyCache")] #[async_trait(?Send)] -impl TransformConfig for RedisConfig { +impl TransformConfig for ValkeyConfig { async fn get_builder( &self, _transform_context: TransformContextConfig, @@ -106,7 +106,7 @@ impl TransformConfig for RedisConfig { up_chain_protocol: MessageType::Valkey, }; - Ok(Box::new(SimpleRedisCacheBuilder { + Ok(Box::new(SimpleValkeyCacheBuilder { cache_chain: self.chain.get_builder(transform_context_config).await?, caching_schema, missed_requests, @@ -122,15 +122,15 @@ impl TransformConfig for RedisConfig { } } -pub struct SimpleRedisCacheBuilder { +pub struct SimpleValkeyCacheBuilder { cache_chain: TransformChainBuilder, caching_schema: HashMap, missed_requests: Counter, } -impl TransformBuilder for SimpleRedisCacheBuilder { +impl TransformBuilder for SimpleValkeyCacheBuilder { fn build(&self, transform_context: TransformContextBuilder) -> Box { - Box::new(SimpleRedisCache { + Box::new(SimpleValkeyCache { cache_chain: self.cache_chain.build(transform_context.clone()), caching_schema: self.caching_schema.clone(), missed_requests: self.missed_requests.clone(), @@ -160,7 +160,7 @@ impl TransformBuilder for SimpleRedisCacheBuilder { } } -pub struct SimpleRedisCache { +pub struct SimpleValkeyCache { cache_chain: TransformChain, caching_schema: HashMap, missed_requests: Counter, @@ -172,7 +172,7 @@ pub struct SimpleRedisCache { cache_miss_cassandra_requests: Vec, } -impl SimpleRedisCache { +impl SimpleValkeyCache { fn build_cache_query(&mut self, request: &mut Message) -> Option { if let Some(Frame::Cassandra(CassandraFrame { operation: CassandraOperation::Query { query, .. }, @@ -182,7 +182,7 @@ impl SimpleRedisCache { if let CacheableState::CacheRow = is_cacheable(query) { if let Some(table_name) = query.get_table_name() { if let Some(table_cache_schema) = self.caching_schema.get(table_name) { - match build_redis_key_from_cql3(query, table_cache_schema) { + match build_valkey_key_from_cql3(query, table_cache_schema) { Ok(address) => { return Some(Message::from_frame_diverged( Frame::Valkey(ValkeyFrame::Array(vec![ @@ -193,7 +193,7 @@ impl SimpleRedisCache { request, )); } - Err(_e) => {} // TODO match Err(()) here or just have build_redis_key_from_cql3 return Option + Err(_e) => {} // TODO match Err(()) here or just have build_valkey_key_from_cql3 return Option } } } @@ -203,26 +203,28 @@ impl SimpleRedisCache { None } - fn unwrap_cache_response(&mut self, redis_responses: Messages) { - for mut redis_response in redis_responses { + fn unwrap_cache_response(&mut self, valkey_responses: Messages) { + for mut valkey_response in valkey_responses { let original_request = self .pending_cache_requests .remove( - &redis_response + &valkey_response .request_id() - .expect("This must have a request, since we dont use redis pubsub"), + .expect("This must have a request, since we dont use valkey pubsub"), ) - .expect("There must be a pending request, since we store a pending request for all redis requests"); - let cassandra_frame = match redis_response.frame() { - Some(Frame::Valkey(redis_frame)) => { - match redis_frame { + .expect("There must be a pending request, since we store a pending request for all valkey requests"); + let cassandra_frame = match valkey_response.frame() { + Some(Frame::Valkey(valkey_frame)) => { + match valkey_frame { ValkeyFrame::Error(err) => { - error!("Redis cache server returned error: {err:?}"); + error!("Valkey cache server returned error: {err:?}"); None } - ValkeyFrame::BulkString(redis_bytes) => { - match CassandraFrame::from_bytes(redis_bytes.clone(), Compression::None) - { + ValkeyFrame::BulkString(valkey_bytes) => { + match CassandraFrame::from_bytes( + valkey_bytes.clone(), + Compression::None, + ) { Ok(mut response_frame) => { match original_request.metadata() { Ok(Metadata::Cassandra(meta)) => { @@ -266,7 +268,7 @@ impl SimpleRedisCache { self.cache_hit_cassandra_responses .push(Message::from_frame_diverged( Frame::Cassandra(cassandra_frame), - &redis_response, + &valkey_response, )); } None => self.cache_miss_cassandra_requests.push(original_request), @@ -279,27 +281,27 @@ impl SimpleRedisCache { cassandra_requests: &mut Messages, local_addr: SocketAddr, ) -> Result<()> { - let mut redis_requests = Vec::with_capacity(cassandra_requests.len()); + let mut valkey_requests = Vec::with_capacity(cassandra_requests.len()); for mut cassandra_request in cassandra_requests.drain(..) { match self.build_cache_query(&mut cassandra_request) { - // The request is cacheable, store the cassandra request for later and send the redis request - Some(redis_request) => { + // The request is cacheable, store the cassandra request for later and send the valkey request + Some(valkey_request) => { self.pending_cache_requests .insert(cassandra_request.id(), cassandra_request); - redis_requests.push(redis_request); + valkey_requests.push(valkey_request); } // The request is not cacheable, add it directly to the cache miss list None => self.cache_miss_cassandra_requests.push(cassandra_request), } } - let redis_responses = self + let valkey_responses = self .cache_chain - .process_request(&mut ChainState::new_with_addr(redis_requests, local_addr)) + .process_request(&mut ChainState::new_with_addr(valkey_requests, local_addr)) .await?; - self.unwrap_cache_response(redis_responses); + self.unwrap_cache_response(valkey_responses); Ok(()) } @@ -315,7 +317,7 @@ impl SimpleRedisCache { ) } - /// clear the cache for the single row specified by the redis_key + /// clear the cache for the single row specified by the valkey_key fn delete_row( &mut self, statement: &CassandraStatement, @@ -325,7 +327,7 @@ impl SimpleRedisCache { if let Some(table_cache_schema) = self.caching_schema.get(table_name) { if let Ok(address) = // TODO: handle errors - build_redis_key_from_cql3(statement, table_cache_schema) + build_valkey_key_from_cql3(statement, table_cache_schema) { return Some(Message::from_frame_at_instant( Frame::Valkey(ValkeyFrame::Array(vec![ @@ -349,7 +351,7 @@ impl SimpleRedisCache { if let Some(table_cache_schema) = self.caching_schema.get(table_name) { if let Ok(address) = // TODO: handle errors - build_redis_key_from_cql3(statement, table_cache_schema) + build_valkey_key_from_cql3(statement, table_cache_schema) { if let Some(Frame::Cassandra(frame)) = response.frame() { // TODO: two performance issues here: @@ -441,10 +443,10 @@ fn is_cacheable(statement: &CassandraStatement) -> CacheableState { } } -/// build the redis key for the query. +/// build the valkey key for the query. /// key is cassandra partition key (must be completely specified) prepended to /// the cassandra range key (may be partially specified) -fn build_query_redis_key_from_value_map( +fn build_query_valkey_key_from_value_map( table_cache_schema: &TableCacheSchema, query_values: &BTreeMap>, table_name: &str, @@ -488,10 +490,10 @@ fn build_query_redis_key_from_value_map( Ok(Bytes::from(key)) } -/// build the redis key for the query. +/// build the valkey key for the query. /// key is cassandra partition key (must be completely specified) prepended to /// the cassandra range key (may be partially specified) -fn build_query_redis_field_from_value_map( +fn build_query_valkey_field_from_value_map( table_cache_schema: &TableCacheSchema, mut query_values: BTreeMap>, select: &Select, @@ -542,7 +544,7 @@ struct HashAddress { field: Bytes, } -fn build_redis_key_from_cql3( +fn build_valkey_key_from_cql3( statement: &CassandraStatement, table_cache_schema: &TableCacheSchema, ) -> Result { @@ -560,12 +562,12 @@ fn build_redis_key_from_cql3( CassandraStatement::Select(select) => { populate_value_map_from_where_clause(&mut value_map, &select.where_clause); Ok(HashAddress { - key: build_query_redis_key_from_value_map( + key: build_query_valkey_key_from_value_map( table_cache_schema, &value_map, &select.table_name.to_string(), )?, - field: build_query_redis_field_from_value_map( + field: build_query_valkey_field_from_value_map( table_cache_schema, value_map, select, @@ -589,7 +591,7 @@ fn build_redis_key_from_cql3( }; } Ok(HashAddress { - key: build_query_redis_key_from_value_map( + key: build_query_valkey_key_from_value_map( table_cache_schema, &value_map, &insert.table_name.to_string(), @@ -600,7 +602,7 @@ fn build_redis_key_from_cql3( CassandraStatement::Update(update) => { populate_value_map_from_where_clause(&mut value_map, &update.where_clause); Ok(HashAddress { - key: build_query_redis_key_from_value_map( + key: build_query_valkey_key_from_value_map( table_cache_schema, &value_map, &update.table_name.to_string(), @@ -608,12 +610,12 @@ fn build_redis_key_from_cql3( field: Bytes::new(), }) } - _ => unreachable!("{statement} should not be passed to build_redis_key_from_cql3",), + _ => unreachable!("{statement} should not be passed to build_valkey_key_from_cql3",), } } #[async_trait] -impl Transform for SimpleRedisCache { +impl Transform for SimpleValkeyCache { fn get_name(&self) -> &'static str { NAME } @@ -651,7 +653,7 @@ mod test { use crate::transforms::debug::printer::DebugPrinter; use crate::transforms::null::NullSink; use crate::transforms::redis::cache::{ - build_redis_key_from_cql3, HashAddress, SimpleRedisCacheBuilder, TableCacheSchema, + build_valkey_key_from_cql3, HashAddress, SimpleValkeyCacheBuilder, TableCacheSchema, }; use crate::transforms::TransformBuilder; use bytes::Bytes; @@ -670,7 +672,7 @@ mod test { let ast = parse_statement_single("SELECT * FROM foo WHERE z = 1 AND x = 123 AND y = 965"); assert_eq!( - build_redis_key_from_cql3(&ast, &table_cache_schema).unwrap(), + build_valkey_key_from_cql3(&ast, &table_cache_schema).unwrap(), HashAddress { key: Bytes::from("foo:1:123:965"), field: Bytes::from("* WHERE "), @@ -688,7 +690,7 @@ mod test { let ast = parse_statement_single("INSERT INTO foo (z, v) VALUES (1, 123)"); assert_eq!( - build_redis_key_from_cql3(&ast, &table_cache_schema).unwrap(), + build_valkey_key_from_cql3(&ast, &table_cache_schema).unwrap(), HashAddress { key: Bytes::from("foo:1"), field: Bytes::from(""), @@ -706,7 +708,7 @@ mod test { let ast = parse_statement_single("INSERT INTO foo (z, c, v) VALUES (1, 'yo' , 123)"); assert_eq!( - build_redis_key_from_cql3(&ast, &table_cache_schema).unwrap(), + build_valkey_key_from_cql3(&ast, &table_cache_schema).unwrap(), HashAddress { key: Bytes::from("foo:1:'yo'"), field: Bytes::from(""), @@ -724,7 +726,7 @@ mod test { let ast = parse_statement_single("UPDATE foo SET c = 'yo', v = 123 WHERE z = 1"); assert_eq!( - build_redis_key_from_cql3(&ast, &table_cache_schema).unwrap(), + build_valkey_key_from_cql3(&ast, &table_cache_schema).unwrap(), HashAddress { key: Bytes::from("foo:1"), field: Bytes::from(""), @@ -740,10 +742,10 @@ mod test { }; let ast = parse_statement_single("SELECT * FROM foo WHERE z = 1 AND x = 123 AND y = 965"); - let query_one = build_redis_key_from_cql3(&ast, &table_cache_schema).unwrap(); + let query_one = build_valkey_key_from_cql3(&ast, &table_cache_schema).unwrap(); let ast = parse_statement_single("SELECT * FROM foo WHERE y = 965 AND z = 1 AND x = 123"); - let query_two = build_redis_key_from_cql3(&ast, &table_cache_schema).unwrap(); + let query_two = build_valkey_key_from_cql3(&ast, &table_cache_schema).unwrap(); // Semantically databases treat the order of AND clauses differently, Cassandra however requires clustering key predicates be in order // So here we will just expect the order is correct in the query. TODO: we may need to revisit this as support for other databases is added @@ -760,7 +762,7 @@ mod test { let ast = parse_statement_single("SELECT * FROM foo WHERE z = 1 AND x > 123 AND x < 999"); assert_eq!( - build_redis_key_from_cql3(&ast, &table_cache_schema).unwrap(), + build_valkey_key_from_cql3(&ast, &table_cache_schema).unwrap(), HashAddress { key: Bytes::from("foo:1"), field: Bytes::from("* WHERE x > 123 AND x < 999"), @@ -778,7 +780,7 @@ mod test { let ast = parse_statement_single("SELECT * FROM foo WHERE z = 1 AND x >= 123 AND x <= 999"); assert_eq!( - build_redis_key_from_cql3(&ast, &table_cache_schema).unwrap(), + build_valkey_key_from_cql3(&ast, &table_cache_schema).unwrap(), HashAddress { key: Bytes::from("foo:1"), field: Bytes::from("* WHERE x >= 123 AND x <= 999"), @@ -798,7 +800,7 @@ mod test { ); assert_eq!( - build_redis_key_from_cql3(&ast, &table_cache_schema).unwrap(), + build_valkey_key_from_cql3(&ast, &table_cache_schema).unwrap(), HashAddress { key: Bytes::from("test_cache_keyspace_simple.test_table:1"), field: Bytes::from("id, x, name WHERE ") @@ -816,7 +818,7 @@ mod test { let ast = parse_statement_single("SELECT thing FROM foo WHERE z = 1 AND y = 2"); assert_eq!( - build_redis_key_from_cql3(&ast, &table_cache_schema).unwrap(), + build_valkey_key_from_cql3(&ast, &table_cache_schema).unwrap(), HashAddress { key: Bytes::from("foo:1:2"), field: Bytes::from("thing WHERE ") @@ -834,7 +836,7 @@ mod test { let ast = parse_statement_single("SELECT * FROM foo WHERE z = 1 AND x >= 123"); assert_eq!( - build_redis_key_from_cql3(&ast, &table_cache_schema).unwrap(), + build_valkey_key_from_cql3(&ast, &table_cache_schema).unwrap(), HashAddress { key: Bytes::from("foo:1"), field: Bytes::from("* WHERE x >= 123") @@ -844,7 +846,7 @@ mod test { let ast = parse_statement_single("SELECT * FROM foo WHERE z = 1 AND x <= 123"); assert_eq!( - build_redis_key_from_cql3(&ast, &table_cache_schema).unwrap(), + build_valkey_key_from_cql3(&ast, &table_cache_schema).unwrap(), HashAddress { key: Bytes::from("foo:1"), field: Bytes::from("* WHERE x <= 123") @@ -854,7 +856,7 @@ mod test { #[test] fn test_validate_invalid_chain() { - let transform = SimpleRedisCacheBuilder { + let transform = SimpleValkeyCacheBuilder { cache_chain: TransformChainBuilder::new(vec![], "test-chain"), caching_schema: HashMap::new(), missed_requests: counter!("cache_miss"), @@ -863,7 +865,7 @@ mod test { assert_eq!( transform.validate(), vec![ - "RedisCache:", + "ValkeyCache:", " test-chain chain:", " Chain cannot be empty" ] @@ -881,7 +883,7 @@ mod test { "test-chain", ); - let transform = SimpleRedisCacheBuilder { + let transform = SimpleValkeyCacheBuilder { cache_chain, caching_schema: HashMap::new(), missed_requests: counter!("cache_miss"), diff --git a/shotover/src/transforms/redis/cluster_ports_rewrite.rs b/shotover/src/transforms/redis/cluster_ports_rewrite.rs index a35996cee..3090caf4b 100644 --- a/shotover/src/transforms/redis/cluster_ports_rewrite.rs +++ b/shotover/src/transforms/redis/cluster_ports_rewrite.rs @@ -15,19 +15,19 @@ use serde::Serialize; #[derive(Serialize, Deserialize, Debug)] #[serde(deny_unknown_fields)] -pub struct RedisClusterPortsRewriteConfig { +pub struct ValkeyClusterPortsRewriteConfig { pub new_port: u16, } -const NAME: &str = "RedisClusterPortsRewrite"; -#[typetag::serde(name = "RedisClusterPortsRewrite")] +const NAME: &str = "ValkeyClusterPortsRewrite"; +#[typetag::serde(name = "ValkeyClusterPortsRewrite")] #[async_trait(?Send)] -impl TransformConfig for RedisClusterPortsRewriteConfig { +impl TransformConfig for ValkeyClusterPortsRewriteConfig { async fn get_builder( &self, _transform_context: TransformContextConfig, ) -> Result> { - Ok(Box::new(RedisClusterPortsRewrite::new(self.new_port))) + Ok(Box::new(ValkeyClusterPortsRewrite::new(self.new_port))) } fn up_chain_protocol(&self) -> UpChainProtocol { @@ -39,7 +39,7 @@ impl TransformConfig for RedisClusterPortsRewriteConfig { } } -impl TransformBuilder for RedisClusterPortsRewrite { +impl TransformBuilder for ValkeyClusterPortsRewrite { fn build(&self, _transform_context: TransformContextBuilder) -> Box { Box::new(self.clone()) } @@ -50,7 +50,7 @@ impl TransformBuilder for RedisClusterPortsRewrite { } #[derive(Clone)] -pub struct RedisClusterPortsRewrite { +pub struct ValkeyClusterPortsRewrite { new_port: u16, request_type: MessageIdMap, } @@ -61,9 +61,9 @@ enum RequestType { ClusterNodes, } -impl RedisClusterPortsRewrite { +impl ValkeyClusterPortsRewrite { pub fn new(new_port: u16) -> Self { - RedisClusterPortsRewrite { + ValkeyClusterPortsRewrite { new_port, request_type: MessageIdMap::default(), } @@ -71,7 +71,7 @@ impl RedisClusterPortsRewrite { } #[async_trait] -impl Transform for RedisClusterPortsRewrite { +impl Transform for ValkeyClusterPortsRewrite { fn get_name(&self) -> &'static str { NAME } @@ -222,7 +222,7 @@ fn rewrite_port_node(frame: &mut Frame, new_port: u16) -> Result<()> { Ok(()) } -/// Determines if the supplied Redis Frame is a `CLUSTER NODES` request +/// Determines if the supplied Valkey Frame is a `CLUSTER NODES` request /// or `CLUSTER REPLICAS` which returns the same response as `CLUSTER NODES` fn is_cluster_nodes(frame: &Frame) -> bool { if let Frame::Valkey(ValkeyFrame::Array(array)) = frame { @@ -238,7 +238,7 @@ fn is_cluster_nodes(frame: &Frame) -> bool { } } -/// Determines if the supplied Redis Frame is a `CLUSTER SLOTS` request +/// Determines if the supplied Valkey Frame is a `CLUSTER SLOTS` request fn is_cluster_slots(frame: &Frame) -> bool { if let Frame::Valkey(ValkeyFrame::Array(array)) = frame { match array.as_slice() { diff --git a/shotover/src/transforms/redis/mod.rs b/shotover/src/transforms/redis/mod.rs index c2957053e..9165f6e05 100644 --- a/shotover/src/transforms/redis/mod.rs +++ b/shotover/src/transforms/redis/mod.rs @@ -8,7 +8,7 @@ pub mod sink_single; pub mod timestamp_tagging; #[derive(thiserror::Error, Clone, Debug)] -pub enum RedisError { +pub enum ValkeyError { #[error("authentication is required")] NotAuthenticated, @@ -22,13 +22,13 @@ pub enum RedisError { Other(String), } -impl RedisError { - fn from_message(error: &str) -> RedisError { +impl ValkeyError { + fn from_message(error: &str) -> ValkeyError { match error.split_once(' ').map(|x| x.0) { - Some("NOAUTH") => RedisError::NotAuthenticated, - Some("NOPERM") => RedisError::NotAuthorized, - Some("WRONGPASS") => RedisError::BadCredentials, - _ => RedisError::Other(error.to_string()), + Some("NOAUTH") => ValkeyError::NotAuthenticated, + Some("NOPERM") => ValkeyError::NotAuthorized, + Some("WRONGPASS") => ValkeyError::BadCredentials, + _ => ValkeyError::Other(error.to_string()), } } } @@ -36,7 +36,7 @@ impl RedisError { #[derive(thiserror::Error, Debug)] pub enum TransformError { #[error(transparent)] - Upstream(#[from] RedisError), + Upstream(#[from] ValkeyError), #[error("protocol error: {0}")] Protocol(String), diff --git a/shotover/src/transforms/redis/sink_cluster.rs b/shotover/src/transforms/redis/sink_cluster.rs index dc8fb4ff2..f7e6e90c5 100644 --- a/shotover/src/transforms/redis/sink_cluster.rs +++ b/shotover/src/transforms/redis/sink_cluster.rs @@ -3,8 +3,8 @@ use crate::codec::{CodecBuilder, Direction}; use crate::frame::{Frame, MessageType, ValkeyFrame}; use crate::message::{Message, Messages}; use crate::tls::TlsConnectorConfig; -use crate::transforms::redis::RedisError; use crate::transforms::redis::TransformError; +use crate::transforms::redis::ValkeyError; use crate::transforms::util::cluster_connection_pool::{Authenticator, ConnectionPool}; use crate::transforms::util::{Request, Response}; use crate::transforms::{ @@ -39,7 +39,7 @@ type ChannelMap = HashMap>>; #[derive(Serialize, Deserialize, Debug)] #[serde(deny_unknown_fields)] -pub struct RedisSinkClusterConfig { +pub struct ValkeySinkClusterConfig { pub first_contact_points: Vec, pub direct_destination: Option, pub tls: Option, @@ -47,21 +47,21 @@ pub struct RedisSinkClusterConfig { pub connect_timeout_ms: u64, } -const NAME: &str = "RedisSinkCluster"; -#[typetag::serde(name = "RedisSinkCluster")] +const NAME: &str = "ValkeySinkCluster"; +#[typetag::serde(name = "ValkeySinkCluster")] #[async_trait(?Send)] -impl TransformConfig for RedisSinkClusterConfig { +impl TransformConfig for ValkeySinkClusterConfig { async fn get_builder( &self, transform_context: TransformContextConfig, ) -> Result> { let connection_pool = ConnectionPool::new_with_auth( Duration::from_millis(self.connect_timeout_ms), - ValkeyCodecBuilder::new(Direction::Sink, "RedisSinkCluster".to_owned()), - RedisAuthenticator {}, + ValkeyCodecBuilder::new(Direction::Sink, "ValkeySinkCluster".to_owned()), + ValkeyAuthenticator {}, self.tls.clone(), )?; - Ok(Box::new(RedisSinkClusterBuilder::new( + Ok(Box::new(ValkeySinkClusterBuilder::new( self.first_contact_points.clone(), self.direct_destination.clone(), self.connection_count.unwrap_or(1), @@ -80,29 +80,29 @@ impl TransformConfig for RedisSinkClusterConfig { } } -pub struct RedisSinkClusterBuilder { +pub struct ValkeySinkClusterBuilder { first_contact_points: Vec, direct_destination: Option, connection_count: usize, - connection_pool: ConnectionPool, + connection_pool: ConnectionPool, shared_topology: Arc>, failed_requests: Counter, } -impl RedisSinkClusterBuilder { +impl ValkeySinkClusterBuilder { fn new( first_contact_points: Vec, direct_destination: Option, connection_count: usize, connection_pool: ConnectionPool< ValkeyCodecBuilder, - RedisAuthenticator, + ValkeyAuthenticator, UsernamePasswordToken, >, chain_name: String, shared_topology: Arc>, ) -> Self { - RedisSinkClusterBuilder { + ValkeySinkClusterBuilder { first_contact_points, direct_destination, connection_count, @@ -113,9 +113,9 @@ impl RedisSinkClusterBuilder { } } -impl TransformBuilder for RedisSinkClusterBuilder { +impl TransformBuilder for ValkeySinkClusterBuilder { fn build(&self, _transform_context: TransformContextBuilder) -> Box { - Box::new(RedisSinkCluster::new( + Box::new(ValkeySinkCluster::new( self.first_contact_points.clone(), self.direct_destination.clone(), self.connection_count, @@ -149,7 +149,7 @@ impl Topology { } } -pub struct RedisSinkCluster { +pub struct ValkeySinkCluster { has_run_init: bool, topology: Topology, shared_topology: Arc>, @@ -157,7 +157,7 @@ pub struct RedisSinkCluster { load_scores: HashMap<(String, usize), usize>, rng: SmallRng, connection_count: usize, - connection_pool: ConnectionPool, + connection_pool: ConnectionPool, reason_for_no_nodes: Option<&'static str>, rebuild_connections: bool, first_contact_points: Vec, @@ -166,7 +166,7 @@ pub struct RedisSinkCluster { failed_requests: Counter, } -impl RedisSinkCluster { +impl ValkeySinkCluster { fn new( first_contact_points: Vec, direct_destination: Option, @@ -174,12 +174,12 @@ impl RedisSinkCluster { shared_topology: Arc>, connection_pool: ConnectionPool< ValkeyCodecBuilder, - RedisAuthenticator, + ValkeyAuthenticator, UsernamePasswordToken, >, failed_requests: Counter, ) -> Self { - RedisSinkCluster { + ValkeySinkCluster { has_run_init: false, first_contact_points, direct_destination, @@ -245,7 +245,7 @@ impl RedisSinkCluster { } else { self.send_error_response( self.reason_for_no_nodes - .unwrap_or("ERR Shotover RedisSinkCluster does not know of a node containing the required slot") + .unwrap_or("ERR Shotover ValkeySinkCluster does not know of a node containing the required slot") ) } } @@ -260,7 +260,7 @@ impl RedisSinkCluster { // Return an error as we cant send anything if there are no channels. 0 => self.send_error_response( self.reason_for_no_nodes - .unwrap_or("ERR Shotover RedisSinkCluster does not know of any nodes"), + .unwrap_or("ERR Shotover ValkeySinkCluster does not know of any nodes"), ), // Send to the single channel and return its response. 1 => Ok(Box::pin( @@ -399,7 +399,7 @@ impl RedisSinkCluster { self.rebuild_connections = false; Ok(()) } - Err(err @ TransformError::Upstream(RedisError::NotAuthenticated)) => { + Err(err @ TransformError::Upstream(ValkeyError::NotAuthenticated)) => { // Assume retry is pointless if authentication is required. self.reason_for_no_nodes = Some("NOAUTH Authentication required (cached)"); self.rebuild_connections = false; @@ -562,7 +562,7 @@ impl RedisSinkCluster { RoutingInfo::Auth => self.on_auth(message).await, RoutingInfo::Unsupported => { short_circuit(ValkeyFrame::Error( - Str::from_inner(Bytes::from_static(b"ERR unknown command - Shotover RedisSinkCluster does not not support this command")).unwrap(), + Str::from_inner(Bytes::from_static(b"ERR unknown command - Shotover ValkeySinkCluster does not not support this command")).unwrap(), )) } RoutingInfo::ShortCircuitNil => short_circuit(ValkeyFrame::Null), @@ -622,10 +622,10 @@ impl RedisSinkCluster { match self.build_connections(Some(token)).await { Ok(()) => short_circuit(ValkeyFrame::SimpleString("OK".into())), - Err(TransformError::Upstream(RedisError::BadCredentials)) => { + Err(TransformError::Upstream(ValkeyError::BadCredentials)) => { self.send_error_response("WRONGPASS invalid username-password") } - Err(TransformError::Upstream(RedisError::NotAuthorized)) => { + Err(TransformError::Upstream(ValkeyError::NotAuthorized)) => { self.send_error_response("NOPERM upstream user lacks required permission") } Err(TransformError::Upstream(e)) => self.send_error_response(e.to_string().as_str()), @@ -643,7 +643,7 @@ impl RedisSinkCluster { fn short_circuit_with_error(&self) -> Result { warn!("Could not route request - short circuiting"); short_circuit(ValkeyFrame::Error( - "ERR Shotover RedisSinkCluster does not not support this command used in this way" + "ERR Shotover ValkeySinkCluster does not not support this command used in this way" .into(), )) } @@ -949,9 +949,9 @@ async fn get_topology_from_node( ValkeyFrame::Array(results) => { parse_slots(&results).map_err(|e| TransformError::Protocol(e.to_string())) } - ValkeyFrame::Error(message) => { - Err(TransformError::Upstream(RedisError::from_message(&message))) - } + ValkeyFrame::Error(message) => Err(TransformError::Upstream(ValkeyError::from_message( + &message, + ))), frame => Err(TransformError::Protocol(format!( "unexpected response for cluster slots: {frame:?}" ))), @@ -1014,7 +1014,7 @@ fn short_circuit(frame: ValkeyFrame) -> Result { } #[async_trait] -impl Transform for RedisSinkCluster { +impl Transform for ValkeySinkCluster { fn get_name(&self) -> &'static str { NAME } @@ -1036,7 +1036,7 @@ impl Transform for RedisSinkCluster { // + It is important we do not share the results of the successful build_connections as that would leak authenticated shotover<->valkey connections to other client<->shotover connections. if let Err(err) = self.build_connections(self.token.clone()).await { match err { - TransformError::Upstream(RedisError::NotAuthenticated) => { + TransformError::Upstream(ValkeyError::NotAuthenticated) => { // Build_connections sent an internal `CLUSTER SLOTS` command to valkey and valkey refused to respond because it is enforcing authentication. // When the client sends an AUTH message we will rerun build_connections. } @@ -1154,10 +1154,10 @@ pub struct UsernamePasswordToken { } #[derive(Clone)] -struct RedisAuthenticator {} +struct ValkeyAuthenticator {} #[async_trait] -impl Authenticator for RedisAuthenticator { +impl Authenticator for ValkeyAuthenticator { type Error = TransformError; async fn authenticate( @@ -1187,7 +1187,7 @@ impl Authenticator for RedisAuthenticator { ValkeyFrame::SimpleString(s) => Err(TransformError::Protocol(format!( "expected OK but got: {s:?}" ))), - ValkeyFrame::Error(e) => Err(TransformError::Upstream(RedisError::from_message(&e))), + ValkeyFrame::Error(e) => Err(TransformError::Upstream(ValkeyError::from_message(&e))), f => Err(TransformError::Protocol(format!( "unexpected response type: {f:?}" ))), @@ -1204,7 +1204,7 @@ mod test { #[test] fn test_parse_slots() { - // Wireshark capture from a Redis cluster with 3 masters and 3 replicas. + // Wireshark capture from a Valkey cluster with 3 masters and 3 replicas. let slots_pcap: &[u8] = b"*3\r\n*4\r\n:10923\r\n:16383\r\n*3\r\n$12\r\n192.168.80.6\r\n:6379\r\n$40\r\n3a7c357ed75d2aa01fca1e14ef3735a2b2b8ffac\r\n*3\r\n$12\r\n192.168.80.3\r\n:6379\r\n$40\r\n77c01b0ddd8668fff05e3f6a8aaf5f3ccd454a79\r\n*4\r\n:5461\r\n:10922\r\n*3\r\n$12\r\n192.168.80.5\r\n:6379\r\n$40\r\n969c6215d064e68593d384541ceeb57e9520dbed\r\n*3\r\n$12\r\n192.168.80.2\r\n:6379\r\n$40\r\n3929f69990a75be7b2d49594c57fe620862e6fd6\r\n*4\r\n:0\r\n:5460\r\n*3\r\n$12\r\n192.168.80.7\r\n:6379\r\n$40\r\n15d52a65d1fc7a53e34bf9193415aa39136882b2\r\n*3\r\n$12\r\n192.168.80.4\r\n:6379\r\n$40\r\ncd023916a3528fae7e606a10d8289a665d6c47b0\r\n"; let mut codec = ValkeyDecoder::new(None, Direction::Sink); diff --git a/shotover/src/transforms/redis/sink_single.rs b/shotover/src/transforms/redis/sink_single.rs index db8bfdbcc..640dc690f 100644 --- a/shotover/src/transforms/redis/sink_single.rs +++ b/shotover/src/transforms/redis/sink_single.rs @@ -19,23 +19,23 @@ use tokio::sync::Notify; #[derive(Serialize, Deserialize, Debug)] #[serde(deny_unknown_fields)] -pub struct RedisSinkSingleConfig { +pub struct ValkeySinkSingleConfig { #[serde(rename = "remote_address")] pub address: String, pub tls: Option, pub connect_timeout_ms: u64, } -const NAME: &str = "RedisSinkSingle"; -#[typetag::serde(name = "RedisSinkSingle")] +const NAME: &str = "ValkeySinkSingle"; +#[typetag::serde(name = "ValkeySinkSingle")] #[async_trait(?Send)] -impl TransformConfig for RedisSinkSingleConfig { +impl TransformConfig for ValkeySinkSingleConfig { async fn get_builder( &self, transform_context: TransformContextConfig, ) -> Result> { let tls = self.tls.as_ref().map(TlsConnector::new).transpose()?; - Ok(Box::new(RedisSinkSingleBuilder::new( + Ok(Box::new(ValkeySinkSingleBuilder::new( self.address.clone(), tls, transform_context.chain_name, @@ -52,24 +52,24 @@ impl TransformConfig for RedisSinkSingleConfig { } } -pub struct RedisSinkSingleBuilder { +pub struct ValkeySinkSingleBuilder { address: String, tls: Option, failed_requests: Counter, connect_timeout: Duration, } -impl RedisSinkSingleBuilder { +impl ValkeySinkSingleBuilder { pub fn new( address: String, tls: Option, chain_name: String, connect_timeout_ms: u64, ) -> Self { - let failed_requests = counter!("shotover_failed_requests_count", "chain" => chain_name, "transform" => "RedisSinkSingle"); + let failed_requests = counter!("shotover_failed_requests_count", "chain" => chain_name, "transform" => "ValkeySinkSingle"); let connect_timeout = Duration::from_millis(connect_timeout_ms); - RedisSinkSingleBuilder { + ValkeySinkSingleBuilder { address, tls, failed_requests, @@ -78,9 +78,9 @@ impl RedisSinkSingleBuilder { } } -impl TransformBuilder for RedisSinkSingleBuilder { +impl TransformBuilder for ValkeySinkSingleBuilder { fn build(&self, transform_context: TransformContextBuilder) -> Box { - Box::new(RedisSinkSingle { + Box::new(ValkeySinkSingle { address: self.address.clone(), tls: self.tls.clone(), connection: None, @@ -99,7 +99,7 @@ impl TransformBuilder for RedisSinkSingleBuilder { } } -pub struct RedisSinkSingle { +pub struct ValkeySinkSingle { address: String, tls: Option, connection: Option, @@ -109,7 +109,7 @@ pub struct RedisSinkSingle { } #[async_trait] -impl Transform for RedisSinkSingle { +impl Transform for ValkeySinkSingle { fn get_name(&self) -> &'static str { NAME } @@ -119,7 +119,7 @@ impl Transform for RedisSinkSingle { chain_state: &'shorter mut ChainState<'longer>, ) -> Result { if self.connection.is_none() { - let codec = ValkeyCodecBuilder::new(Direction::Sink, "RedisSinkSingle".to_owned()); + let codec = ValkeyCodecBuilder::new(Direction::Sink, "ValkeySinkSingle".to_owned()); self.connection = Some( SinkConnection::new( &self.address, diff --git a/test-helpers/src/cert.rs b/test-helpers/src/cert.rs index 2d62773ed..3cdd2f739 100644 --- a/test-helpers/src/cert.rs +++ b/test-helpers/src/cert.rs @@ -98,7 +98,7 @@ pub fn generate_cassandra_test_certs() { .unwrap(); } -pub fn generate_redis_test_certs() { +pub fn generate_valkey_test_certs() { generate_test_certs(Path::new("tests/test-configs/redis/tls/certs")); } diff --git a/test-helpers/src/connection/redis_connection.rs b/test-helpers/src/connection/redis_connection.rs index d601c8b69..84cd7d2c6 100644 --- a/test-helpers/src/connection/redis_connection.rs +++ b/test-helpers/src/connection/redis_connection.rs @@ -13,7 +13,7 @@ pub fn new(port: u16) -> redis::Connection { let connection = Client::open((address, port)) .unwrap() .get_connection() - .with_context(|| format!("Failed to create redis connection to port {port}")) + .with_context(|| format!("Failed to create valkey connection to port {port}")) .unwrap(); connection .set_read_timeout(Some(Duration::from_secs(10))) @@ -25,7 +25,7 @@ pub async fn new_async(address: &str, port: u16) -> redis::aio::Connection { let stream = Box::pin( tokio::net::TcpStream::connect((address, port)) .await - .with_context(|| format!("Failed to create async redis connection to port {port}")) + .with_context(|| format!("Failed to create async valkey connection to port {port}")) .unwrap(), ); new_async_inner(Box::pin(stream) as Pin>).await diff --git a/test-helpers/src/docker_compose.rs b/test-helpers/src/docker_compose.rs index adb99308b..858127b77 100644 --- a/test-helpers/src/docker_compose.rs +++ b/test-helpers/src/docker_compose.rs @@ -20,7 +20,7 @@ pub fn new_moto() -> DockerCompose { docker_compose("tests/transforms/docker-compose-moto.yaml") } -pub static IMAGE_WAITERS: [Image; 12] = [ +pub static IMAGE_WAITERS: [Image; 11] = [ Image { name: "motoserver/moto", log_regex_to_wait_for: r"Press CTRL\+C to quit", @@ -31,13 +31,6 @@ pub static IMAGE_WAITERS: [Image; 12] = [ log_regex_to_wait_for: r"Ready to accept connections", timeout: Duration::from_secs(120), }, - Image { - name: "bitnami/redis-cluster:6.2.12-debian-11-r26", - //`Cluster state changed` is created by the node services - //`Cluster correctly created` is created by the init service - log_regex_to_wait_for: r"Cluster state changed|Cluster correctly created", - timeout: Duration::from_secs(120), - }, Image { name: "bitnami/valkey:7.2.5-debian-12-r9", log_regex_to_wait_for: r"Ready to accept connections",