Nicer logging during joining
@@ -106,10 +106,14 @@ func (j *Joiner) Do(joinAddrs []string, id, addr string, voter bool) (string, er
return joinee, nil
}
}
- j.logger.Printf("failed to join cluster at %s: %s, sleeping %s before retry", joinAddrs, err.Error(), j.attemptInterval)
+ if i+1 < j.numAttempts {
+ // This logic message only make sense if performing more than 1 join-attempt.
+ j.logger.Printf("failed to join cluster at %s: %s, sleeping %s before retry %d",
+ joinAddrs, err.Error(), j.attemptInterval)
time.Sleep(j.attemptInterval)
}
- j.logger.Printf("failed to join cluster at %s, after %d attempts", joinAddrs, j.numAttempts)
+ }
+ j.logger.Printf("failed to join cluster at %s, after %d attempt(s)", joinAddrs, j.numAttempts)
return "", ErrJoinFailed
}
