Skip to content

Commit

Permalink
CassandraSinkCluster: Fix system.local rpc_address
Browse files Browse the repository at this point in the history
  • Loading branch information
rukai committed Oct 4, 2022
1 parent 6a9c307 commit 536bf9a
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 11 deletions.
5 changes: 3 additions & 2 deletions shotover-proxy/src/transforms/cassandra/sink_cluster/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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)
Expand Down
12 changes: 7 additions & 5 deletions shotover-proxy/tests/cassandra_int_tests/cluster_multi_rack.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -96,21 +97,22 @@ 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()),
ResultValue::Varchar("3.4.5".into()),
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()),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 536bf9a

Please sign in to comment.