Skip to content

Commit

Permalink
roachtest: fix node partition picker in c2c tests
Browse files Browse the repository at this point in the history
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
  • Loading branch information
msbutler committed Nov 8, 2024
1 parent efba0f5 commit 5b9c1d8
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions pkg/cmd/roachtest/tests/cluster_to_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down

0 comments on commit 5b9c1d8

Please sign in to comment.