Skip to content
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

Prepared statement queries returning NULL results not being parsed #6240

Closed
luisfmcalado opened this issue May 29, 2020 · 1 comment
Closed
Milestone

Comments

@luisfmcalado
Copy link
Contributor

luisfmcalado commented May 29, 2020

Overview of the Issue

Using the latest release master the OK packet is missing extra data. Any release from v6.0.20-YYYYMMDD is working as expected.

Reproduction Steps

Steps to reproduce this issue, example:

  1. Deploy the following vschema:
{
  "sharded": true,
  "vindexes": {
    "unicode_loose_md5": {
      "type": "unicode_loose_md5"
    }
  },
  "tables": {
    "user": {
      "column_vindexes": [
        {
          "column": "username",
          "name": "unicode_loose_md5"
        }
      ]
    }
  }
}
  1. Deploy the following schema:
CREATE TABLE `user` (
  username varchar(128) NOT NULL,
  age int NOT NULL,
  fake varchar(128) 
);
  1. Insert INSERT INTO user (username, age) VALUES ("u1", 18)
  2. Run SELECT AVG(age) FROM user WHERE username = 'user1' or SELECT fake FROM user WHERE username = 'u1'

The command was run with MyXQL library for Elixir which returns:

(myxql) lib/myxql/protocol/values.ex:446: MyXQL.Protocol.Values.decode_decimal("", 0, [], [])
    (myxql) lib/myxql/protocol.ex:539: MyXQL.Protocol.decode_resultset/4
    (myxql) lib/myxql/client.ex:198: MyXQL.Client.recv_packets/6
    (myxql) lib/myxql/connection.ex:102: MyXQL.Connection.handle_execute/4
    (db_connection) lib/db_connection/holder.ex:316: DBConnection.Holder.holder_apply/4
    (db_connection) lib/db_connection.ex:1255: DBConnection.run_execute/5
    (db_connection) lib/db_connection.ex:1342: DBConnection.run/6
    (db_connection) lib/db_connection.ex:539: DBConnection.parsed_prepare_execute/5

Checking the exchanged packets all are the same expect the OK packet which is missing the extra data when responding to the execute statement.

good

bad

Binary version

Version: a83f21486 (Git branch 'master') built on Tue May 26 11:14:38 UTC 2020 by vitess@bdbc14d2d293 using go1.13.9 linux/amd64

Operating system and Environment details

Using vitess operator with Kubernetes version 1.15
MariaDB 10.3.22
Running with:

vtctld: vitess/lite:mariadb103
vtgate: vitess/lite:mariadb103
vttablet: vitess/lite:mariadb103
vtbackup: vitess/lite:mariadb103

Log Fragments

The logs do not show any issue.

@aquarapid
Copy link
Contributor

Confirmed.

This was broken by da9cfe0 from #6130 . Reverting that from master will solve your issue until this can be fixed up.

aquarapid added a commit to planetscale/vitess that referenced this issue May 31, 2020
…gth offset into

account in writeBinaryRow().  Not an ideal fix, but something cleaner
will involve invasive cleanup.

Signed-off-by: Jacques Grove <aquarapid@gmail.com>
aquarapid added a commit that referenced this issue Jun 1, 2020
account in writeBinaryRow().  Not an ideal fix, but something cleaner
will involve invasive cleanup.

Signed-off-by: Jacques Grove <aquarapid@gmail.com>
sougou added a commit that referenced this issue Jun 8, 2020
Fix issue #6240.  PR #6130 did not take the header length offset into
@aquarapid aquarapid changed the title Queries returning NULL results not being parsed Prepared statement queries returning NULL results not being parsed Jun 11, 2020
@deepthi deepthi added this to the v7.0 milestone Jun 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants