From 536bf9a69262191c060cb954d8e77ceba8bccb6c Mon Sep 17 00:00:00 2001 From: Lucas Kent Date: Tue, 4 Oct 2022 12:33:01 +1100 Subject: [PATCH] CassandraSinkCluster: Fix system.local rpc_address --- .../src/transforms/cassandra/sink_cluster/mod.rs | 5 +++-- .../tests/cassandra_int_tests/cluster_multi_rack.rs | 12 +++++++----- .../cassandra_int_tests/cluster_single_rack_v3.rs | 6 ++++-- .../cassandra_int_tests/cluster_single_rack_v4.rs | 6 ++++-- 4 files changed, 18 insertions(+), 11 deletions(-) diff --git a/shotover-proxy/src/transforms/cassandra/sink_cluster/mod.rs b/shotover-proxy/src/transforms/cassandra/sink_cluster/mod.rs index 49e9c806e..5cd561f31 100644 --- a/shotover-proxy/src/transforms/cassandra/sink_cluster/mod.rs +++ b/shotover-proxy/src/transforms/cassandra/sink_cluster/mod.rs @@ -579,7 +579,6 @@ impl CassandraSinkCluster { MessageValue::Uuid(shotover_peer.host_id) } else if colspec.name == preferred_ip_alias || colspec.name == preferred_port_alias - || colspec.name == rpc_address_alias { MessageValue::Null } else if colspec.name == native_address_alias { @@ -589,7 +588,9 @@ impl CassandraSinkCluster { shotover_peer.address.port() as i64, IntSize::I32, ) - } else if colspec.name == peer_alias { + } else if colspec.name == peer_alias + || colspec.name == rpc_address_alias + { MessageValue::Inet(shotover_peer.address.ip()) } else if colspec.name == peer_port_alias { MessageValue::Integer(7000, IntSize::I32) diff --git a/shotover-proxy/tests/cassandra_int_tests/cluster_multi_rack.rs b/shotover-proxy/tests/cassandra_int_tests/cluster_multi_rack.rs index a57ebedda..bae839d45 100644 --- a/shotover-proxy/tests/cassandra_int_tests/cluster_multi_rack.rs +++ b/shotover-proxy/tests/cassandra_int_tests/cluster_multi_rack.rs @@ -13,7 +13,8 @@ async fn test_rewrite_system_peers(connection: &CassandraConnection) { // rack is non-determistic because we dont know which node this will be ResultValue::Any, ResultValue::Varchar("4.0.6".into()), - ResultValue::Null, + // rpc_address is non-determistic because we dont know which node this will be + ResultValue::Any, // schema_version is non deterministic so we cant assert on it. ResultValue::Any, // Unfortunately token generation appears to be non-deterministic but we can at least assert that @@ -96,7 +97,7 @@ async fn test_rewrite_system_local(connection: &CassandraConnection) { let star_results = [ ResultValue::Varchar("local".into()), ResultValue::Varchar("COMPLETED".into()), - // broadcast address is non-deterministic because we dont know which node this will be + // broadcast address is non-deterministic because we dont know which shotover node this will be ResultValue::Any, ResultValue::Int(7000), ResultValue::Varchar("TestCluster".into()), @@ -104,13 +105,14 @@ async fn test_rewrite_system_local(connection: &CassandraConnection) { ResultValue::Varchar("dc1".into()), // gossip_generation is non deterministic cant assert on it ResultValue::Any, - // host_id is non-deterministic because we dont know which node this will be + // host_id is non-deterministic because we dont know which shotover node this will be + ResultValue::Any, + // listen_address is non-deterministic because we dont know which shotover node this will be ResultValue::Any, - ResultValue::Inet("127.0.0.1".parse().unwrap()), ResultValue::Int(7000), ResultValue::Varchar("5".into()), ResultValue::Varchar("org.apache.cassandra.dht.Murmur3Partitioner".into()), - // rack is non-deterministic because we dont know which node this will be + // rack is non-deterministic because we dont know which shotover node this will be ResultValue::Any, ResultValue::Varchar("4.0.6".into()), ResultValue::Inet("0.0.0.0".parse().unwrap()), diff --git a/shotover-proxy/tests/cassandra_int_tests/cluster_single_rack_v3.rs b/shotover-proxy/tests/cassandra_int_tests/cluster_single_rack_v3.rs index b180a0eb5..ea3090b1e 100644 --- a/shotover-proxy/tests/cassandra_int_tests/cluster_single_rack_v3.rs +++ b/shotover-proxy/tests/cassandra_int_tests/cluster_single_rack_v3.rs @@ -10,7 +10,8 @@ async fn test_rewrite_system_peers_dummy_peers(connection: &CassandraConnection) ResultValue::Null, ResultValue::Varchar("rack1".into()), ResultValue::Varchar("3.11.13".into()), - ResultValue::Null, + // rpc_address is non-determistic because we dont know which node this will be + ResultValue::Any, // schema_version is non deterministic so we cant assert on it. ResultValue::Any, // Unfortunately token generation appears to be non-deterministic but we can at least assert that @@ -24,7 +25,8 @@ async fn test_rewrite_system_peers_dummy_peers(connection: &CassandraConnection) ResultValue::Null, ResultValue::Varchar("rack1".into()), ResultValue::Varchar("3.11.13".into()), - ResultValue::Null, + // rpc_address is non-determistic because we dont know which node this will be + ResultValue::Any, // schema_version is non deterministic so we cant assert on it. ResultValue::Any, // Unfortunately token generation appears to be non-deterministic but we can at least assert that diff --git a/shotover-proxy/tests/cassandra_int_tests/cluster_single_rack_v4.rs b/shotover-proxy/tests/cassandra_int_tests/cluster_single_rack_v4.rs index d9c5f017b..29033e203 100644 --- a/shotover-proxy/tests/cassandra_int_tests/cluster_single_rack_v4.rs +++ b/shotover-proxy/tests/cassandra_int_tests/cluster_single_rack_v4.rs @@ -58,7 +58,8 @@ async fn test_rewrite_system_peers_dummy_peers(connection: &CassandraConnection) ResultValue::Null, ResultValue::Varchar("rack1".into()), ResultValue::Varchar("4.0.6".into()), - ResultValue::Null, + // rpc_address is non-determistic because we dont know which node this will be + ResultValue::Any, // schema_version is non deterministic so we cant assert on it. ResultValue::Any, // Unfortunately token generation appears to be non-deterministic but we can at least assert that @@ -72,7 +73,8 @@ async fn test_rewrite_system_peers_dummy_peers(connection: &CassandraConnection) ResultValue::Null, ResultValue::Varchar("rack1".into()), ResultValue::Varchar("4.0.6".into()), - ResultValue::Null, + // rpc_address is non-determistic because we dont know which node this will be + ResultValue::Any, // schema_version is non deterministic so we cant assert on it. ResultValue::Any, // Unfortunately token generation appears to be non-deterministic but we can at least assert that