-
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
2027 (HY000): iteration count is not equal to 1
using Rust sqlx
#6643
Comments
@mcronce you don't happen to have a tcpdump of the interactions do you? Specifically Vitess has rolled its own MySQL Implementation as well and it will return different packets from the stock mysql client |
I don't but I can take a pcap
…On Sat, Sep 5, 2020, 8:32 PM Daniel Kozlowski ***@***.***> wrote:
@mcronce <https://github.com/mcronce> you don't happen to have a tcpdump
of the interactions do you? Specifically Vitess has rolled its own MySQL
Implementation as well and it will return different packets from the stock
mysql client
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#6643 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAGMFEST2WAX6CGUPK7KHU3SELKDDANCNFSM4QOJTRHQ>
.
|
If you could take two please. One through Vitess and one through stock
MySQL. That would be great.
…On Sat, Sep 5, 2020, 5:35 PM Mike Cronce ***@***.***> wrote:
I don't but I can take a pcap
On Sat, Sep 5, 2020, 8:32 PM Daniel Kozlowski ***@***.***>
wrote:
> @mcronce <https://github.com/mcronce> you don't happen to have a tcpdump
> of the interactions do you? Specifically Vitess has rolled its own MySQL
> Implementation as well and it will return different packets from the
stock
> mysql client
>
> —
> You are receiving this because you were mentioned.
> Reply to this email directly, view it on GitHub
> <#6643 (comment)>,
> or unsubscribe
> <
https://github.com/notifications/unsubscribe-auth/AAGMFEST2WAX6CGUPK7KHU3SELKDDANCNFSM4QOJTRHQ
>
> .
>
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#6643 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AADXRKYZKPNX2RLUMQWFQPLSELKN3ANCNFSM4QOJTRHQ>
.
|
https://drive.google.com/file/d/1kJG2PMPSwRRP6DYZr15-sIaeepBq4Qvv/view?usp=sharing has the Vitess pcap For anybody interested, you can append |
I checked the tcp dump, the iteration count in both COM_STMT_EXECUTE Request is Why this works on mysql is because mysql assumes that iterator count is always 1 and ignores to read the 4 bytes of iteration count data from the data packet - code reference link We can also do the same thing @systay @sougou @aquarapid ? |
If this is a case of the client lib behaving badly I'll make a PR to the client lib :) That said, maybe it does make sense to mimic MySQL behavior? It seems weird to specify in the protocol that the value must be 1, but ignore incorrect values - I'm wondering if there are other clients out there that people have implemented greenfield, which might have a similar issue |
Client sending the right data is the best way to move forward. |
Fixed via launchbadge/sqlx#739 |
Closing as this is fixed in sqlx |
Overview of the Issue
When using Rust's
sqlx
library backed by Vitess, DML statements fail with the following error:This functions when running against a plain old MySQL container.
Interestingly, DDL and
SET
statements seem to be fine. The following all work:But the following fail:
The pattern seems to be that DML statements fail, but with a total sample size of 7, grain of salt and all that.
Could be a protocol version mismatch or strictly something they're sending malformed? It looks like
sqlx
did spin their own client implementation from the wire protocol up. When I run all of these queries with the regular CLImysql
client everything works fine.Reproduction Steps
Background:
sqlx
includes a feature where it will connect to a database with your schema installed at compile time, and type check all your query parameters/returns. This is super cool because it gets you all the "safety" of an ORM, but without obfuscating the SQL (joins, for example, are still easy), and without the run-time cost. However, there's another Vitess issue (not yet reported) that causes this compile-time check to fail - so these steps include standing up a plain MySQL to compile against.docker run --rm -d --name=mysql -e MYSQL_ROOT_PASSWORD=password -e MYSQL_DATABASE=test1 -p3306:3306 mysql
git clone https://github.com/launchbadge/sqlx.git
cd sqlx/examples/mysql/todos
20200718111257_todos.sql
(sqlx
does have a migration tool in beta, but it's written insqlx
and fails for this and one other reason) against Vitess databasecat migrations/20200718111257_todos.sql | mysql -h127.0.0.1 -uroot -ppassword test1
DATABASE_URL=mysql://root:password@127.0.0.1:3306/test1 cargo build
DATABASE_URL=url_for_your_Vitess_database cargo run -- add 'todo description 1'
DATABASE_URL=mysql://root:password@127.0.0.1:3306/test1 cargo run -- add 'todo description 1'
If you want
sqlx
to print every query as it runs them, the following patch will enable that:Binary version
Operating system and Environment details
In the vtgate container:
On the host, where I'm running the client:
Log Fragments
The only log message from vtgate when I run the binary is:
The text was updated successfully, but these errors were encountered: