Skip to content

Commit

Permalink
Fix retry message when gathering mysqld status (#559)
Browse files Browse the repository at this point in the history
Signed-off-by: Masayuki Ishii <[email protected]>
Co-authored-by: Yamamoto, Hirotaka <[email protected]>
  • Loading branch information
masa213f and ymmt2005 authored Aug 29, 2023
1 parent 6b953a6 commit 7ac0e96
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions clustering/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (
)

var (
statusCheckRetryMax = 3
statusCheckRetryMax = 2
statusCheckRetryInterval = 3 * time.Second
)

Expand Down Expand Up @@ -197,18 +197,22 @@ func (p *managerProcess) GatherStatus(ctx context.Context) (*StatusSet, error) {
go func(index int) {
defer wg.Done()

for j := 0; j < statusCheckRetryMax; j++ {
for j := 0; j <= statusCheckRetryMax; j++ {
ist, err := ss.DBOps[index].GetStatus(ctx)
if err == dbop.ErrNop {
return
}
if err != nil {
logFromContext(ctx).Error(err, "failed to get mysqld status")
time.Sleep(statusCheckRetryInterval)
continue
if err == nil {
ss.MySQLStatus[index] = ist
return
}
// process errors
if j == statusCheckRetryMax {
logFromContext(ctx).Error(err, "failed to get mysqld status, mysqld is not ready")
return
}
ss.MySQLStatus[index] = ist
return
logFromContext(ctx).Error(err, "failed to get mysqld status, will retry")
time.Sleep(statusCheckRetryInterval)
}
}(i)
}
Expand Down

0 comments on commit 7ac0e96

Please sign in to comment.