Skip to content

Commit eb38bfc

Browse files
committed
kvserver: remove within10s
1 parent 9bcc3fd commit eb38bfc

File tree

1 file changed

+6
-16
lines changed

1 file changed

+6
-16
lines changed

pkg/kv/kvserver/replica_command.go

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2393,21 +2393,6 @@ func prepareChangeReplicasTrigger(
23932393
return crt, nil
23942394
}
23952395

2396-
func within10s(ctx context.Context, fn func() error) error {
2397-
retOpts := retry.Options{InitialBackoff: time.Second, MaxBackoff: time.Second, MaxRetries: 10}
2398-
var err error
2399-
for re := retry.StartWithCtx(ctx, retOpts); re.Next(); {
2400-
err = fn()
2401-
if err == nil {
2402-
return nil
2403-
}
2404-
}
2405-
if err != nil {
2406-
return err
2407-
}
2408-
return ctx.Err()
2409-
}
2410-
24112396
type changeReplicasTxnArgs struct {
24122397
db *kv.DB
24132398

@@ -2544,7 +2529,12 @@ func execChangeReplicasTxn(
25442529

25452530
// NB: we haven't written any intents yet, so even in the unlikely case in which
25462531
// this is held up, we won't block anyone else.
2547-
if err := within10s(ctx, func() error {
2532+
if err := (retry.Options{
2533+
InitialBackoff: 100 * time.Millisecond,
2534+
Multiplier: 2,
2535+
MaxBackoff: time.Second,
2536+
MaxDuration: 10 * time.Second,
2537+
}).Do(ctx, func(ctx context.Context) error {
25482538
if args.testAllowDangerousReplicationChanges {
25492539
return nil
25502540
}

0 commit comments

Comments
 (0)