Skip to content

Commit

Permalink
Merge pull request #106305 from cockroachdb/blathers/backport-release…
Browse files Browse the repository at this point in the history
…-22.2-105948
  • Loading branch information
kvoli committed Jul 10, 2023
2 parents f0bda42 + 64c77a3 commit dac1313
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions pkg/cmd/roachtest/tests/mixed_version_change_replicas.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,20 @@ func runChangeReplicasMixedVersion(ctx context.Context, t test.Test, c cluster.C
// TABLE RELOCATE via a random gateway node.
changeReplicasRelocateFromNodeStep := func(table string, nodeID int) versionStep {
return func(ctx context.Context, t test.Test, u *versionUpgradeTest) {
enqueueRangeInReplicateQueue := func(rangeID int) {
for n := 1; n <= nodeCount; n++ {
conn := u.c.Conn(ctx, t.L(), n)
defer conn.Close()
// Enqueue on every node, only the leaseholder node will process the
// range.
_, err = conn.ExecContext(ctx, fmt.Sprintf(
`SELECT crdb_internal.kv_enqueue_replica(%d, 'replicate', true)`,
rangeID))
if err != nil {
t.L().Printf("kv_enqueue_replica failed: %s", err)
}
}
}

// Disable the replicate queue, but re-enable it when we're done.
setReplicateQueueEnabled := func(enabled bool) {
Expand Down Expand Up @@ -157,6 +171,13 @@ func runChangeReplicasMixedVersion(ctx context.Context, t test.Test, c cluster.C
// changes by the replicate queue, so we re-enable it and let it run
// for a bit before the next retry.
setReplicateQueueEnabled(true)
// Additionally, any ranges which had errors are manually enqueued
// into the replicate queue. This will speed up resolving conflicts
// and intermediate states such as left over learners or joint
// configurations.
for rangeID := range rangeErrors {
enqueueRangeInReplicateQueue(rangeID)
}
}

if len(rangeErrors) > 0 {
Expand Down

0 comments on commit dac1313

Please sign in to comment.