From 7ec75e490b5d0b8ceedb5f07eae364794b2ae211 Mon Sep 17 00:00:00 2001 From: Erik Grinaker Date: Mon, 6 Feb 2023 09:54:08 +0000 Subject: [PATCH] roachtest: use exponential backoff for `change-replicas/mixed-version` retries Epic: none Release note: None --- pkg/cmd/roachtest/tests/mixed_version_change_replicas.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/pkg/cmd/roachtest/tests/mixed_version_change_replicas.go b/pkg/cmd/roachtest/tests/mixed_version_change_replicas.go index 2dd730c32bf2..5f0d187cc568 100644 --- a/pkg/cmd/roachtest/tests/mixed_version_change_replicas.go +++ b/pkg/cmd/roachtest/tests/mixed_version_change_replicas.go @@ -23,6 +23,7 @@ import ( "github.com/cockroachdb/cockroach/pkg/cmd/roachtest/test" "github.com/cockroachdb/cockroach/pkg/roachpb" "github.com/cockroachdb/cockroach/pkg/util/randutil" + "github.com/cockroachdb/cockroach/pkg/util/retry" "github.com/stretchr/testify/require" ) @@ -119,8 +120,14 @@ func runChangeReplicasMixedVersion(ctx context.Context, t test.Test, c cluster.C conn := u.c.Conn(ctx, t.L(), gateway) defer conn.Close() + retryOpts := retry.Options{ + InitialBackoff: 100 * time.Millisecond, + MaxBackoff: 5 * time.Second, + Multiplier: 2, + MaxRetries: 8, + } var rangeErrors map[int]string - for attempt := 1; attempt <= 5; attempt++ { + for r := retry.StartWithCtx(ctx, retryOpts); r.Next(); { if errCount := len(rangeErrors); errCount > 0 { t.L().Printf("%d ranges failed, retrying", errCount) }