Skip to content

Commit

Permalink
storage: retry failed liveness heartbeats in tests
Browse files Browse the repository at this point in the history
Teach multiTestContext.heartbeatLiveness to retry heartbeats that fail
due to ErrEpochIncremented. This error is expected when the heartbeat
races with an epoch increment from another store.

Fix cockroachdb#27835.

Release note: None
  • Loading branch information
benesch committed Jul 25, 2018
1 parent f8f4595 commit 001ce1f
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion pkg/storage/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1207,7 +1207,13 @@ func (m *multiTestContext) heartbeatLiveness(ctx context.Context, store int) err
if err != nil {
return err
}
return nl.Heartbeat(ctx, l)

for r := retry.StartWithCtx(ctx, retry.Options{MaxRetries: 5}); r.Next(); {
if err = nl.Heartbeat(ctx, l); err != storage.ErrEpochIncremented {
break
}
}
return err
}

// advanceClock advances the mtc's manual clock such that all
Expand Down

0 comments on commit 001ce1f

Please sign in to comment.