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

Conversation

masa213f
Copy link
Contributor

@masa213f masa213f commented Aug 28, 2023

This PR fixes the retry message when gathering mysqld status.

The current error message is confusing whether it's in retrying or MySQL is finally treated as Not-Ready.

Signed-off-by: Masayuki Ishii masa213f@gmail.com

Signed-off-by: Masayuki Ishii <masa213f@gmail.com>
@masa213f masa213f self-assigned this Aug 28, 2023
Comment on lines 206 to 213
logFromContext(ctx).Error(err, "failed to get mysqld status")
time.Sleep(statusCheckRetryInterval)
continue
if j == statusCheckRetryMax {
logFromContext(ctx).Error(err, "failed to get mysqld status, mysqld is not ready")
return
} else {
logFromContext(ctx).Error(err, "failed to get mysqld status, will retry")
time.Sleep(statusCheckRetryInterval)
continue
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we have the following lines after for loop,

				ss.MySQLStatus[index] = ist
				return

I think it's more readable to change the code like:

				if err == dbop.ErrNop {
					return
				}
				if err == nil {
					ss.MySQLStatus[index] = ist
					return
				}
				// process errors

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you. I was wondering how to write.
I will use the style you suggested.

Signed-off-by: Masayuki Ishii <masa213f@gmail.com>
clustering/status.go Outdated Show resolved Hide resolved
Co-authored-by: Yamamoto, Hirotaka <ymmt2005@gmail.com>
ymmt2005
ymmt2005 previously approved these changes Aug 28, 2023
Copy link
Member

@ymmt2005 ymmt2005 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Signed-off-by: Masayuki Ishii <masa213f@gmail.com>
Signed-off-by: Masayuki Ishii <masa213f@gmail.com>
@masa213f masa213f merged commit 7ac0e96 into main Aug 29, 2023
14 checks passed
@masa213f masa213f deleted the fix-retry-message branch August 29, 2023 07:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants