Skip to content

Commit

Permalink
Merge #53713
Browse files Browse the repository at this point in the history
53713: server: busy loop through resolver list during join process r=irfansharif a=irfansharif

Deferred doing this in #52526. Probably a good idea to do have it, it'll
bring down the cluster convergence time (time taken for all nodes to
find out about the initialization) by a bit.

Release justification: low risk, high benefit changes to existing functionality
Release note: None

Co-authored-by: irfan sharif <[email protected]>
  • Loading branch information
craig[bot] and irfansharif committed Sep 4, 2020
2 parents 9cb3c0e + c6bc053 commit 7cd72a7
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions pkg/server/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,39 @@ func (s *initServer) startJoinLoop(ctx context.Context, stopper *stop.Stopper) (
return nil, errJoinRPCUnsupported
}

// Iterate through all the resolvers at least once to reduce time taken to
// cluster convergence. Keep this code block roughly in sync with the one
// below.
for _, res := range s.config.resolvers {
select {
case <-ctx.Done():
return nil, context.Canceled
case <-stopper.ShouldQuiesce():
return nil, stop.ErrUnavailable
default:
}

addr := res.Addr()
state, err := s.attemptJoinTo(ctx, res.Addr())
if err == nil {
return state, nil
}

if errors.Is(err, errJoinRPCUnsupported) || errors.Is(err, ErrIncompatibleBinaryVersion) {
// Propagate upwards; these are error conditions the caller knows to
// expect.
return nil, err
}

if IsWaitingForInit(err) {
log.Warningf(ctx, "%s is itself waiting for init, will retry", addr)
} else {
log.Warningf(ctx, "outgoing join rpc to %s unsuccessful: %v", addr, err.Error())
}

// Try the next node if unsuccessful.
}

const joinRPCBackoff = time.Second
var tickChan <-chan time.Time
{
Expand Down

0 comments on commit 7cd72a7

Please sign in to comment.