-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Gracefully shutdown VTGate instances #14219
Gracefully shutdown VTGate instances #14219
Conversation
Signed-off-by: David Piegza <davidpiegza@github.com>
Signed-off-by: David Piegza <davidpiegza@github.com>
|
||
func GetTestServerConn(listener *Listener) *Conn { | ||
return newServerConn(testConn{}, listener) | ||
} |
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.
Can this function (and GetTestConn
above it) be moved to conn_flaky_test.go
instead? So it's in a proper _test.go
file?
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.
I tried to move it but it's not able find it then. Could it be that functions in _test.go
are not exported?
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.
Yes functions in test files can only be used locally. They aren't exported.
From the Internet -
Files matching *_test.go are only compiled when testing the package they are part of. If you are testing package A that uses package B, you won't have access to the _test.go code from package B.
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.
Rest LGTM!
go/mysql/conn.go
Outdated
// GetTestConn returns a conn for testing purpose only. | ||
func GetTestConn() *Conn { | ||
return newConn(testConn{}) | ||
} | ||
|
||
func GetTestServerConn(listener *Listener) *Conn { |
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.
I know the function already says Test
but maybe it is a good idea to add a comment something like -
// GetTestServerConn is only meant to be used for testing. It creates a server connection using a testConn and the provided listener.
And I would move this function to the conn_fake.go
file. That files defines the testConn
struct too and it contains all the test code we keep in the package.
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.
@GuptaManan100 Thanks! I moved this and the other GetTestConn()
function to conn_fake.go
.
Signed-off-by: David Piegza <davidpiegza@github.com>
…in-vtgate Signed-off-by: David Piegza <davidpiegza@github.com>
Would it be possible to backport this to latest v18 as well (after release)? |
We usually don't backport enhancements/new features to previous branches. Are you able to do a custom build with this new feature? |
Signed-off-by: Brendan Dougherty <brendan.dougherty@shopify.com>
Description
Currently, during a VTGate shutdown it's possible for established connections to execute new queries, those queries will fail with
vttablet: Connection Closed errors
(see also this comment).This PR adds a check in MySQL server plugin if the connection is shutting down and returns a
ERServerShutdown
error.Related Issue(s)
Checklist
Deployment Notes