Skip to content

Commit a0e8554

Browse files
committed
roachtest: print remaining replicas in change-replicas
This test has been flaking recently. There appears to be two failure regimes. In one, replicas are being slowly removed but the test hits its retry limit. In another, replicas are being added to the node while others are being removed. This additional logging will hopefully help more quickly spot when we are dealing with the second case. Informs #149548 Release note: None
1 parent ac3b2b7 commit a0e8554

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

pkg/cmd/roachtest/tests/mixed_version_change_replicas.go

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,36 @@ func runChangeReplicasMixedVersion(ctx context.Context, t test.Test, c cluster.C
8181
return nil
8282
}
8383

84+
printRemainingTestRangesOnNode := func(
85+
ctx context.Context,
86+
l *logger.Logger,
87+
r *rand.Rand,
88+
h *mixedversion.Helper,
89+
nodeID int,
90+
rangeCount int,
91+
) error {
92+
ranges := make([]int, 0, rangeCount)
93+
rows, err := h.Query(r, `SELECT range_id FROM `+
94+
`[SHOW RANGES FROM TABLE test] WHERE $1::int = ANY(replicas)`, nodeID)
95+
if err != nil {
96+
return err
97+
}
98+
defer func() { _ = rows.Close() }()
99+
100+
var rangeID int
101+
for rows.Next() {
102+
if err := rows.Scan(&rangeID); err != nil {
103+
return err
104+
}
105+
ranges = append(ranges, rangeID)
106+
}
107+
if err := rows.Err(); err != nil {
108+
return err
109+
}
110+
l.Printf("ranges: %v", ranges)
111+
return nil
112+
}
113+
84114
// evacuateNodeUsingZoneConfig moves replicas off of a node using a zone
85115
// config.
86116
evacuateNodeUsingZoneConfig := func(
@@ -121,6 +151,11 @@ func runChangeReplicasMixedVersion(ctx context.Context, t test.Test, c cluster.C
121151
if rangeCount == 0 {
122152
break
123153
}
154+
if rangeCount < 10 {
155+
if err := printRemainingTestRangesOnNode(ctx, l, r, h, node, rangeCount); err != nil {
156+
return err
157+
}
158+
}
124159
time.Sleep(3 * time.Second)
125160
}
126161
if rangeCount > 0 {

0 commit comments

Comments
 (0)