Merge pull request #2020 from jaffee/extra-nodeleave-log

more info if nodeleave confirmation queries fail
This commit is contained in:
Matthew Jaffee 2019-06-21 14:53:53 -05:00 committed by GitHub
commit ab6bed1187
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1702,22 +1702,24 @@ func confirmNodeDown(uri URI, log logger.Logger) bool {
Host: uri.HostPort(),
Path: "version",
}
ctx, cancel := context.WithTimeout(context.Background(), confirmDownTimeout*time.Second)
defer cancel()
req, err := http.NewRequest("GET", u.String(), nil)
if err != nil {
log.Printf("bad request:%s %s", u.String(), err)
return false
}
for i := 0; i < confirmDownRetries; i++ {
ctx, cancel := context.WithTimeout(context.Background(), confirmDownTimeout*time.Second)
defer cancel()
resp, err := http.DefaultClient.Do(req.WithContext(ctx))
var bod []byte
if err == nil {
bod, err = ioutil.ReadAll(resp.Body)
if resp.StatusCode == 200 {
return false
}
}
log.Printf("NodeLeave Timeout with %s %d", uri.HostPort(), i)
log.Printf("NodeLeave confirm with %s %d. err: '%v' bod: '%s'", uri.HostPort(), i, err, bod)
time.Sleep(confirmDownSleep * time.Second)
}
return true