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

Fix hang in gocql init #1795

Merged
merged 2 commits into from
Nov 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions shotover-proxy/tests/cassandra_int_tests/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,51 @@ async fn cluster_multi_rack_2_per_rack(#[case] driver: CassandraDriver) {
cluster::multi_rack::test_topology_task(None, expected_nodes, 16).await;
}

#[tokio::test(flavor = "multi_thread")]
async fn cluster_multi_rack_2_per_rack_go_smoke_test() {
let _compose = docker_compose(
"tests/test-configs/cassandra/cluster-multi-rack-2-per-rack/docker-compose.yaml",
);

let shotover_rack1 = shotover_process(
"tests/test-configs/cassandra/cluster-multi-rack-2-per-rack/topology_rack1.yaml",
)
.with_config("tests/test-configs/shotover-config/config1.yaml")
.with_log_name("Rack1")
.start()
.await;
let shotover_rack2 = shotover_process(
"tests/test-configs/cassandra/cluster-multi-rack-2-per-rack/topology_rack2.yaml",
)
.with_log_name("Rack2")
.with_config("tests/test-configs/shotover-config/config2.yaml")
.start()
.await;
let shotover_rack3 = shotover_process(
"tests/test-configs/cassandra/cluster-multi-rack-2-per-rack/topology_rack3.yaml",
)
.with_config("tests/test-configs/shotover-config/config3.yaml")
.with_log_name("Rack3")
.start()
.await;

test_helpers::connection::cassandra::go::run_go_smoke_test().await;

// gocql driver will route execute requests to its control connection during initialization which results in out of rack requests.
// This warning is correctly triggered in that case.
// The warning occurs only in rack1, gocql driver always picks rack 1 for its control connection
shotover_rack1
.shutdown_and_then_consume_events(&[EventMatcher::new()
.with_level(Level::Warn)
.with_target("shotover::transforms::cassandra::sink_cluster::node_pool")
.with_message("No suitable nodes to route to found within rack. This error only occurs in debug builds as it should never occur in an ideal integration test situation.")
.with_count(Count::Any)
])
.await;
shotover_rack2.shutdown_and_then_consume_events(&[]).await;
shotover_rack3.shutdown_and_then_consume_events(&[]).await;
}

#[rstest]
#[case::scylla(Scylla)]
//#[case::cdrs(Cdrs)] // TODO
Expand Down
2 changes: 1 addition & 1 deletion shotover/src/transforms/cassandra/sink_cluster/rewrite.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ impl MessageRewriter {
RewriteTableTy::Prepare { clone_index } => {
let mut first = true;
for node in pool.nodes().iter() {
if node.is_up && node.rack == self.local_shotover_node.rack {
ronycsdu marked this conversation as resolved.
Show resolved Hide resolved
if node.is_up {
if first {
let message_id = messages[*clone_index].id();
self.prepare_requests_to_destination_nodes
Expand Down
Loading