-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
remove unnecessary logs #1599
remove unnecessary logs #1599
Conversation
WalkthroughThe changes primarily involve refining the way Changes
Possibly related issues
Poem
Warning Review ran into problemsProblems (1)
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
@@ -408,7 +403,7 @@ func (mc *mysqlConn) query(query string, args []driver.Value) (*textRows, error) | |||
var resLen int | |||
resLen, err = handleOk.readResultSetHeaderPacket() | |||
if err != nil { | |||
return nil, mc.markBadConn(err) | |||
return nil, err |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is place we shouldn't use mc.markBadConn()
because we sent packet already.
Since readResultSetHeaderPacket()
(and underlaying readPacket()
) won't return errBadConnNoWrite
, we don't have unsafe retry bug.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (3)
- connection.go (8 hunks)
- errors.go (1 hunks)
- statement.go (2 hunks)
Files skipped from review due to trivial changes (1)
- errors.go
Additional comments not posted (2)
connection.go (2)
114-120
: Refactoring ofmarkBadConn
to only returndriver.ErrBadConn
whenerr
iserrBadConnNoWrite
improves the specificity of error handling. This change should help in making the retry logic more predictable.
702-703
: Explicitly implementingdriver.SessionResetter
anddriver.Validator
interfaces enhances the clarity and maintainability of the code. This is a good practice, especially for public APIs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Description
Logging ErrInvalidConn when the connection already closed doesn't provide any help to users.
Additonally, database/sql now uses Validator() to check connection liveness before calling query methods.
So stop using
mc.log(ErrInvalidConn)
idiom.This PR includes some cleanup and documentation relating to
mc.markBadConn()
.Checklist
Summary by CodeRabbit
Refactor
Documentation
This update aims to streamline error management for a more efficient and cleaner user experience.