Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix retry message when gathering mysqld status #559

Merged
merged 6 commits into from
Aug 29, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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