From 6aa2985e3d569684b7c1cc1c4d03eecd3e58561b Mon Sep 17 00:00:00 2001 From: irfan sharif Date: Mon, 31 Aug 2020 17:58:51 -0400 Subject: [PATCH] server: busy loop through resolver list during join process 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 --- pkg/server/init.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/pkg/server/init.go b/pkg/server/init.go index 887727097cea..606b83ebc64e 100644 --- a/pkg/server/init.go +++ b/pkg/server/init.go @@ -390,6 +390,24 @@ func (s *initServer) startJoinLoop(ctx context.Context, stopper *stop.Stopper) e return ErrJoinRPCUnsupported } + // Busy-loop through all the resolvers at least once. Keep this code block + // roughly in sync with the one below. + for _, res := range s.config.resolvers { + addr := res.Addr() + err := s.attemptJoin(ctx, addr) + if err == nil { + return nil + } + + if errors.Is(err, ErrJoinRPCUnsupported) || errors.Is(err, ErrIncompatibleBinaryVersion) { + // Propagate upwards; these are error conditions the caller knows to + // expect. + return err + } + + // Ignore all other errors, they'll be better dealt with below. + } + const joinRPCBackoff = time.Second var tickChan <-chan time.Time {