Ejemplo n.º 1
0
func setCorrectnessRetryOptions(stores *storage.Stores) {
	if err := stores.VisitStores(func(s *storage.Store) error {
		s.SetRangeRetryOptions(correctnessTestRetryOptions)
		return nil
	}); err != nil {
		panic(err)
	}
}
Ejemplo n.º 2
0
// setCorrectnessRetryOptions sets client for aggressive retries with a
// limit on number of attempts so we don't get stuck behind indefinite
// backoff/retry loops. If MaxAttempts is reached, transaction will
// return retry error.
func setCorrectnessRetryOptions(stores *storage.Stores) {
	client.DefaultTxnRetryOptions = retry.Options{
		InitialBackoff: 1 * time.Millisecond,
		MaxBackoff:     50 * time.Millisecond,
		Multiplier:     10,
		MaxRetries:     2,
	}

	if err := stores.VisitStores(func(s *storage.Store) error {
		s.SetRangeRetryOptions(client.DefaultTxnRetryOptions)
		return nil
	}); err != nil {
		panic(err)
	}
}