-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
server, tidb-server: improve unix socket handling #8836
Conversation
Cleanup socket file on exit Handle error of socket file exists Support both socket and tcp via redirection Support case neither socket or tcp specified
/run-all-tests |
/run-all-tests |
PTAL @tiancaiamao |
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.
Looks like a good idea.
} | ||
} | ||
|
||
func (s *Server) handleForwardedConnection(uconn net.Conn, addr string) { |
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.
Rather than logging warnings, I would return an error and have the caller deal with it (the caller can log or retry).
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.
In this case, handleForwardedConnection
is an async call (called as a go routine), so I think it is important to handle its own?
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.
Right, the caller would expand to an anonymous function that calls this function and does something with the error.
I am not sure if I tested it wrong yesterday, but I can't seem to get the server to listen on tcp + socket. I tried:
The mysql client just hangs until I control + c, then get the error:
I appreciate any feedback if you know what's wrong :( |
The listener seems still not closed in |
Codecov Report
@@ Coverage Diff @@
## master #8836 +/- ##
=========================================
Coverage ? 67.53%
=========================================
Files ? 363
Lines ? 75142
Branches ? 0
=========================================
Hits ? 50746
Misses ? 19918
Partials ? 4478
Continue to review full report at Codecov.
|
LGTM |
/run-all-tests |
/run-all-tests |
/run-unit-test |
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
What problem does this PR solve?
Fixes #8459
What is changed and how it works?
Check List
Tests
I'm not actually sure how to write tests to validate it, but happy to do so with pointers.
Code changes
Side effects
Related changes
This change is