Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated RedisFrame to ValkeyFrame and all relevant files #1822

Merged
merged 10 commits into from
Nov 21, 2024
2 changes: 1 addition & 1 deletion custom-transforms-example/config/topology.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
sources:
- Redis:
- Valkey:
name: "redis"
justinweng-instaclustr marked this conversation as resolved.
Show resolved Hide resolved
listen_addr: "127.0.0.1:6379"
chain:
Expand Down
10 changes: 5 additions & 5 deletions custom-transforms-example/src/redis_get_rewrite.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use anyhow::Result;
use async_trait::async_trait;
use serde::{Deserialize, Serialize};
use shotover::frame::{Frame, MessageType, RedisFrame};
use shotover::frame::{Frame, MessageType, ValkeyFrame};
use shotover::message::{MessageIdSet, Messages};
use shotover::transforms::{
ChainState, Transform, TransformBuilder, TransformConfig, TransformContextConfig,
Expand All @@ -28,7 +28,7 @@ impl TransformConfig for RedisGetRewriteConfig {
}

fn up_chain_protocol(&self) -> UpChainProtocol {
UpChainProtocol::MustBeOneOf(vec![MessageType::Redis])
UpChainProtocol::MustBeOneOf(vec![MessageType::Valkey])
}

fn down_chain_protocol(&self) -> DownChainProtocol {
Expand Down Expand Up @@ -95,8 +95,8 @@ impl Transform for RedisGetRewrite {
}

fn is_get(frame: &Frame) -> bool {
if let Frame::Redis(RedisFrame::Array(array)) = frame {
if let Some(RedisFrame::BulkString(first)) = array.first() {
if let Frame::Valkey(ValkeyFrame::Array(array)) = frame {
if let Some(ValkeyFrame::BulkString(first)) = array.first() {
first.eq_ignore_ascii_case(b"GET")
} else {
false
Expand All @@ -108,5 +108,5 @@ fn is_get(frame: &Frame) -> bool {

fn rewrite_get(frame: &mut Frame, result: &str) {
tracing::info!("Replaced {frame:?} with BulkString(\"{result}\")");
*frame = Frame::Redis(RedisFrame::BulkString(result.to_owned().into()));
*frame = Frame::Valkey(ValkeyFrame::BulkString(result.to_owned().into()));
}
20 changes: 11 additions & 9 deletions shotover-proxy/benches/windsock/redis/bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,15 +130,17 @@ impl RedisBench {
}
}

common::generate_topology(SourceConfig::Redis(shotover::sources::redis::RedisConfig {
name: "redis".to_owned(),
listen_addr: host_address,
connection_limit: None,
hard_connection_limit: None,
tls: tls_acceptor,
timeout: None,
chain: TransformChainConfig(transforms),
}))
common::generate_topology(SourceConfig::Valkey(
shotover::sources::redis::ValkeyConfig {
name: "redis".to_owned(),
listen_addr: host_address,
connection_limit: None,
hard_connection_limit: None,
tls: tls_acceptor,
timeout: None,
chain: TransformChainConfig(transforms),
},
))
}

async fn run_aws_shotover(
Expand Down
4 changes: 2 additions & 2 deletions shotover-proxy/config/topology.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
---
# The list of sources.
sources:
# The source, change from Redis to the source type of the database protocol you are receiving messages in.
# 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
- Redis:
- Valkey:
name: "redis"
listen_addr: "127.0.0.1:6379"
chain:
Expand Down
6 changes: 3 additions & 3 deletions shotover-proxy/tests/redis_int_tests/basic_driver_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use rand::{thread_rng, Rng};
use redis::aio::Connection;
use redis::cluster::ClusterConnection;
use redis::{AsyncCommands, Commands, ErrorKind, RedisError, Value};
use shotover::frame::RedisFrame;
use shotover::frame::ValkeyFrame;
use shotover::tcp;
use std::collections::{HashMap, HashSet};
use std::thread::sleep;
Expand Down Expand Up @@ -1304,7 +1304,7 @@ pub async fn test_trigger_transform_failure_raw() {

assert_eq!(
read_redis_message(&mut connection).await,
RedisFrame::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: RedisSinkSingle 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.
Expand All @@ -1317,7 +1317,7 @@ pub async fn test_trigger_transform_failure_raw() {
assert_eq!(amount, 0);
}

async fn read_redis_message(connection: &mut TcpStream) -> RedisFrame {
async fn read_redis_message(connection: &mut TcpStream) -> ValkeyFrame {
let mut buffer = BytesMut::new();
loop {
if let Ok(Some((result, len))) =
Expand Down
2 changes: 1 addition & 1 deletion shotover-proxy/tests/redis_int_tests/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ fn invalid_frame_event() -> EventMatcher {
.with_level(Level::Warn)
.with_target("shotover::server")
.with_message(
r#"failed to decode message: Error decoding redis frame
r#"failed to decode message: Error decoding valkey frame

Caused by:
Decode Error: frame_type: Invalid frame type."#,
Expand Down
10 changes: 5 additions & 5 deletions shotover-proxy/tests/runner/observability_int_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,19 +129,19 @@ shotover_chain_latency_seconds{chain="redis",client_details="127.0.0.1",quantile
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="redis"}
shotover_query_count{name="redis-chain",query="GET",type="redis"}
shotover_query_count{name="redis-chain",query="SET",type="redis"}
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"}
"#;
assert_metrics_has_keys(expected, expected_new).await;

assert_metrics_key_value(
r#"shotover_query_count{name="redis-chain",query="GET",type="redis"}"#,
r#"shotover_query_count{name="redis-chain",query="GET",type="valkey"}"#,
"1",
)
.await;
assert_metrics_key_value(
r#"shotover_query_count{name="redis-chain",query="SET",type="redis"}"#,
r#"shotover_query_count{name="redis-chain",query="SET",type="valkey"}"#,
"2",
)
.await;
Expand Down
2 changes: 1 addition & 1 deletion shotover-proxy/tests/runner/runner_int_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 [Redis] but was Cassandra
Transform RedisSinkSingle requires upchain protocol to be one of [Valkey] but was Cassandra
"#,
)])
.await;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
sources:
- Redis:
- Valkey:
name: "redis"
listen_addr: "127.0.0.1:6379"
chain:
Expand Down
4 changes: 2 additions & 2 deletions shotover-proxy/tests/test-configs/invalid_subchains.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
---
sources:
- Redis:
- Valkey:
name: "redis1"
listen_addr: "127.0.0.1:6379"
chain:
- NullSink
- NullSink
- DebugPrinter
- Redis:
- Valkey:
name: "redis2"
listen_addr: "127.0.0.1:6379"
chain:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
sources:
- Redis:
- Valkey:
name: "redis"
listen_addr: "127.0.0.1:6379"
chain:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
sources:
- Redis:
- Valkey:
name: "redis"
listen_addr: "127.0.0.1:6379"
chain:
Expand Down
2 changes: 1 addition & 1 deletion shotover-proxy/tests/test-configs/null-redis/topology.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
sources:
- Redis:
- Valkey:
name: "redis"
listen_addr: "127.0.0.1:6379"
chain:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
---
sources:
- Redis:
- Valkey:
name: "redis1"
listen_addr: "127.0.0.1:6379"
connection_limit: 3000000
chain:
- QueryTypeFilter:
DenyList: [Write]
- DebugReturner:
Redis: "42"
- Redis:
Valkey: "42"
- Valkey:
name: "redis2"
listen_addr: "127.0.0.1:6380"
connection_limit: 3000000
chain:
- QueryTypeFilter:
AllowList: [Read]
- DebugReturner:
Redis: "42"
Valkey: "42"
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
sources:
- Redis:
- Valkey:
name: "redis"
listen_addr: "127.0.0.1:6379"
chain:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This example will replicate all commands to the DR datacenter on a best effort basis
---
sources:
- Redis:
- Valkey:
name: "redis"
listen_addr: "127.0.0.1:6379"
connection_limit: 3000000
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
sources:
- Redis:
- Valkey:
name: "redis"
listen_addr: "127.0.0.1:6379"
chain:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
sources:
- Redis:
- Valkey:
name: "redis"
listen_addr: "127.0.0.1:6379"
chain:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
sources:
- Redis:
- Valkey:
name: "redis"
listen_addr: "127.0.0.1:6379"
chain:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
sources:
- Redis:
- Valkey:
name: "redis"
listen_addr: "127.0.0.1:6380"
chain:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
sources:
- Redis:
- Valkey:
name: "redis"
listen_addr: "127.0.0.1:6379"
tls:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
sources:
- Redis:
- Valkey:
name: "redis"
listen_addr: "127.0.0.1:6379"
chain:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
sources:
- Redis:
- Valkey:
name: "redis"
listen_addr: "127.0.0.1:6379"
tls:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
sources:
- Redis:
- Valkey:
name: "redis"
listen_addr: "127.0.0.1:6379"
chain:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
sources:
- Redis:
- Valkey:
name: "redis"
listen_addr: "127.0.0.1:6379"
chain:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
sources:
- Redis:
- Valkey:
name: "redis"
listen_addr: "127.0.0.1:6379"
tls:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
sources:
- Redis:
- Valkey:
name: "redis"
listen_addr: "127.0.0.1:6379"
tls:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
sources:
- Redis:
- Valkey:
name: "redis"
listen_addr: "127.0.0.1:6379"
tls:
Expand Down
2 changes: 1 addition & 1 deletion shotover-proxy/tests/test-configs/redis/tls/topology.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
sources:
- Redis:
- Valkey:
name: "redis"
listen_addr: "127.0.0.1:6379"
tls:
Expand Down
6 changes: 3 additions & 3 deletions shotover-proxy/tests/test-configs/tee/fail.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
sources:
- Redis:
- Valkey:
name: "redis"
listen_addr: "127.0.0.1:6379"
connection_limit: 3000000
Expand All @@ -12,6 +12,6 @@ sources:
- QueryTypeFilter:
DenyList: [Read]
- DebugReturner:
Redis: "42"
Valkey: "42"
- DebugReturner:
Redis: "42"
Valkey: "42"
6 changes: 3 additions & 3 deletions shotover-proxy/tests/test-configs/tee/fail_with_mismatch.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
sources:
- Redis:
- Valkey:
name: "redis"
listen_addr: "127.0.0.1:6379"
connection_limit: 3000000
Expand All @@ -12,6 +12,6 @@ sources:
- QueryTypeFilter:
DenyList: [Read]
- DebugReturner:
Redis: "41"
Valkey: "41"
- DebugReturner:
Redis: "42"
Valkey: "42"
6 changes: 3 additions & 3 deletions shotover-proxy/tests/test-configs/tee/ignore.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
sources:
- Redis:
- Valkey:
name: "redis"
listen_addr: "127.0.0.1:6379"
connection_limit: 3000000
Expand All @@ -12,6 +12,6 @@ sources:
- QueryTypeFilter:
DenyList: [Read]
- DebugReturner:
Redis: "42"
Valkey: "42"
- DebugReturner:
Redis: "42"
Valkey: "42"
Loading
Loading