Skip to content

Commit

Permalink
optimize com_quit by write nothing to client to avoid client RST
Browse files Browse the repository at this point in the history
  • Loading branch information
niubell committed Jun 6, 2019
1 parent 157b42a commit f88651e
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions proxy/server/executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -255,11 +255,10 @@ func (se *SessionExecutor) GetDatabase() string {
func (se *SessionExecutor) ExecuteCommand(cmd byte, data []byte) Response {
switch cmd {
case mysql.ComQuit:
err := se.handleRollback()
if err != nil {
return CreateErrorResponse(se.status, err)
}
return CreateOKResponse(se.status)
se.handleRollback()
// https://dev.mysql.com/doc/internals/en/com-quit.html
// either a connection close or a OK_Packet, OK_Packet will cause client RST sometimes, but doesn't affect sql execute
return CreateNoopResponse()
case mysql.ComQuery: // data type: string[EOF]
sql := string(data)
// handle phase
Expand Down

0 comments on commit f88651e

Please sign in to comment.