-
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
Enforce rollback for each connection when shutdown occurs #5659
Conversation
Signed-off-by: Saif Alharthi <[email protected]>
Signed-off-by: Saif Alharthi <[email protected]>
Signed-off-by: Saif Alharthi <[email protected]>
Signed-off-by: Saif Alharthi <[email protected]>
Signed-off-by: Saif Alharthi <[email protected]>
Signed-off-by: Saif Alharthi <[email protected]>
Signed-off-by: Saif Alharthi <[email protected]>
Signed-off-by: Saif Alharthi <[email protected]>
@@ -436,9 +452,17 @@ func shutdownMysqlProtocolAndDrain() { | |||
} | |||
} | |||
|
|||
func rollbackAtShutdown() { |
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.
Need to hold mutex here, because you're accessing connections
. However, you'll run into a deadlock because ConnectionClosed
also obtains the mutex.
I recommend implementing a CloseAllConnections
instead of ConnectionClosed
, that obtains the mutex and closes all conections in a loop.
And then, you can change servenv.OnClose(rollbackAtShutdown)
-> servenv.OnClose(vtgateHandler.CloseAllConnections)
The previous approach we tried led to some race conditions. This new approach of just hard-closing the connection and then wait for the cleanup to happen from that effect feels more stable. Signed-off-by: Sugu Sougoumarane <[email protected]>
Signed-off-by: Sugu Sougoumarane <[email protected]>
This fixes #5553