-
Notifications
You must be signed in to change notification settings - Fork 279
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
[bug] proxy: session cannot be transferred after load data local infile #18787
Conversation
PR-Agent was enabled for this repository. To continue using it, please link your git user with your CodiumAI identity here. PR Reviewer Guide 🔍
|
PR-Agent was enabled for this repository. To continue using it, please link your git user with your CodiumAI identity here. PR Code Suggestions ✨
|
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
…le (matrixorigin#18787) In the case of "load data local infile" statement, client sends the first packet, then server sends response, which is "0xFB + filename", after that, client sends content of filename and an empty packet, at last, server sends OK packet. The sequence ID of this OK packet is not 1, and will cause the session cannot be transferred after this stmt finished. So, the solution is: when server sends 0xFB and the sequence ID of next packet is 3 bigger than last one, the next packet MUST be an OK packet, and the transfer is allowed.
User description
What type of PR is this?
Which issue(s) this PR fixes:
issue https://github.com/matrixorigin/mo-cloud/issues/4088
What this PR does / why we need it:
In the case of "load data local infile" statement, client sends the
first packet, then server sends response, which is "0xFB + filename",
after that, client sends content of filename and an empty packet, at
last, server sends OK packet. The sequence ID of this OK packet is not
1, and will cause the session cannot be transferred after this stmt finished.
So, the solution is: when server sends 0xFB and the sequence ID of
next packet is 3 bigger than last one, the next packet MUST be an
OK packet, and the transfer is allowed.
PR Type
Bug fix, Tests
Description
isLoadDataLocalInfileRespPacket
to identify specific server response packets.Changes walkthrough 📝
tunnel.go
Fix session transfer issue for "load data local infile" statement
pkg/proxy/tunnel.go
statement.
mustOK
flag to manage session transfer conditions.checkTxnStatus
andhandleOKPacket
functions to acceptmustOK
parameter.
tunnel_test.go
Add tests for transaction status with mustOK flag
pkg/proxy/tunnel_test.go
checkTxnStatus
withmustOK
parameter.util_test.go
Add tests for load data local infile response detection
pkg/proxy/util_test.go
isLoadDataLocalInfileRespPacket
function.util.go
Introduce function to detect load data local infile response
pkg/proxy/util.go
isLoadDataLocalInfileRespPacket
function to identify specificresponse packets.