-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Incorrect packet parsing for multiStatement=true
#602
Comments
You're right. |
Warning in multi statement is one of "certain situations." |
@rubensayshi You seem to have some Go program for debugging, please share it with us. The short SQL snippets are not exactly an example code. And what makes |
|
@julienschmidt unfortunately I'm atm so swamped that I had to do the debugging in my own project instead of making a clean reproducible test case, sorry I know it sucks when someone opens a ticket without putting in full effort to provide a completely reproducable test case. @methane is right though, my testcase (cuz that's where I ran into the issue) passes when I create the connection with |
I found #376 which adds the "This mode should not be used in production as it may lead to data corruption in certain situations." sentence to README. But actually speaking, strict=true didn't cause data corruption in the example of #376. @rubensayshi Could you try #605 with |
yes #605 fixes the issue |
@rubensayshi Could you write failing test case for this? |
should be fixed by #676 |
Issue description
It seems like result messages are being parsed incorrectly for multistatements in combination with auto increment (insertid).
I tried debugging it (see below) but my knowledge of the MySQL packages and this lib is insufficient to properly conclude what is going on.
The 'symptom' that I ran into that lead me to digging deeper was getting back an empty list of
MySQLWarnings{}
(I tried fixing it with this PR: #555)Example code
schema.sql
fixtures.sql
execute these 2 with
?strict=true&multiStatements=true
I've been trying to look at the handling of the msgs from mysql, when loading the fixtures:
see the
handleOkPacket
andhandleOkPacket::checkwarnings...
(checkwarning...
is when it determines if it should domc.getWarnings()
).the
id=
is some incrementing id I added each timehandleOkPacket
is called.it seems the byte array
data
is different at the end of theid=5
call...I'm not really sure what this code is supposed to do, how it works, just debugging, I hope you understand this stuff a little better xD
obviously this ain't the correct fix, but doing
data := make([]byte, len(_data)); copy(data, _data)
at the start of handleOkPacket fixes the issue (just to 'prove' it has something to do with the underlying byte array of the slice)Configuration
Driver version (or git SHA):
a0583e0143b1624142adab07e0e97fe106d99561
Go version:
go version go1.8 linux/amd64
Server version:
mysqld Ver 5.7.18-0ubuntu0.16.04.1
Server OS:
Ubuntu 16.04.2 LTS
The text was updated successfully, but these errors were encountered: