From 5b9c1d82e8b7e4ad20029184352b266ea5c84ea3 Mon Sep 17 00:00:00 2001 From: Michael Butler Date: Fri, 8 Nov 2024 08:59:40 -0500 Subject: [PATCH] roachtest: fix node partition picker in c2c tests Previously, the the partition picker would always choose src nodes to partition because it would grab the node number relative to the destination cluster, not relative to roachprod. This patch fixes this bug. Epic: none Release note: none --- pkg/cmd/roachtest/tests/cluster_to_cluster.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pkg/cmd/roachtest/tests/cluster_to_cluster.go b/pkg/cmd/roachtest/tests/cluster_to_cluster.go index 9473c51e97cd..c5856c318379 100644 --- a/pkg/cmd/roachtest/tests/cluster_to_cluster.go +++ b/pkg/cmd/roachtest/tests/cluster_to_cluster.go @@ -1735,8 +1735,9 @@ func partitionPair(ctx context.Context, c cluster.Cluster, t test.Test, srcNodes srcNode := srcNodes.RandNode()[0] srcTenantSQL := sqlutils.MakeSQLRunner(c.Conn(ctx, t.L(), srcNode)) - var dstNode int - srcTenantSQL.QueryRow(t, `select split_part(consumer, '[', 1) from crdb_internal.cluster_replication_node_streams order by random() limit 1`).Scan(&dstNode) + var dstNodeNormalized int + srcTenantSQL.QueryRow(t, `select split_part(consumer, '[', 1) from crdb_internal.cluster_replication_node_streams order by random() limit 1`).Scan(&dstNodeNormalized) + dstNode := dstNodeNormalized + len(srcNodes) t.L().Printf("Disconnecting Src %d, Dest %d for %.2f minutes", srcNode, dstNode, disconnectDuration.Minutes())