You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
An INSERT of a hex 0x or X' notated value into a VARBINARY column is not normalized by the vtgate query planner.
This means cached query plans for these types of INSERT queries are unique and won't be usable by similar subsequent INSERT statements.
Reproduction Steps
Steps to reproduce this issue, example:
Create a Vitess cluster with a 2 or more shard keyspace in it. For ease of repro I used the vitess/examples/local schema/vschema files. I created a keyspace1, which is unsharded and used for sequences. And a keyspace2, which has 2 shards and contains the schema for the table we will be running inserts on.
mysql -h 127.0.0.1 -P 15306 -u vitess -p < repro.sql
browse to the vtgate web UI and look at the query_plans. On my setup this is located at: http://localhost:15001/debug/query_plans
Notice the query plan for our repro.sql INSERT shows normalized, bind var, values for all but the hex values;
I tried the same thing but with X' notated hex values and it produced the same results, the hex values remain un-normalized in the query plan.
I also edited the vschema_customer_sharded.json to define the column type for the sku column to be VARBINARY, and BINARY in another test.
Example vschema with column type defined;
Overview of the Issue
An INSERT of a hex
0x
orX'
notated value into a VARBINARY column is not normalized by the vtgate query planner.This means cached query plans for these types of INSERT queries are unique and won't be usable by similar subsequent INSERT statements.
Reproduction Steps
Steps to reproduce this issue, example:
Create a Vitess cluster with a 2 or more shard keyspace in it. For ease of repro I used the vitess/examples/local schema/vschema files. I created a keyspace1, which is unsharded and used for sequences. And a keyspace2, which has 2 shards and contains the schema for the table we will be running inserts on.
Apply schemas and vschemas to the cluster.
vtctlclient -server=localhost:15999 ApplySchema -sql-file ~/vitess/examples/local/create_commerce_seq.sql keyspace1; vtctlclient -server=localhost:15999 ApplySchema -sql-file ~/vitess/examples/local/create_commerce_schema.sql keyspace2; vtctlclient -server=localhost:15999 ApplyvSchema -vschema_file ~/vitess/examples/local/vschema_commerce_seq.json keyspace1; vtctlclient -server=localhost:15999 ApplyvSchema -vschema_file ~/vitess/examples/local/vschema_customer_sharded.json keyspace2
Once the schemas and vschemas are applied run the following test insert.
mysql -h 127.0.0.1 -P 15306 -u vitess -p < repro.sql
browse to the vtgate web UI and look at the query_plans. On my setup this is located at: http://localhost:15001/debug/query_plans
Notice the query plan for our repro.sql INSERT shows normalized, bind var, values for all but the hex values;
I tried the same thing but with
X'
notated hex values and it produced the same results, the hex values remain un-normalized in the query plan.I also edited the vschema_customer_sharded.json to define the column type for the sku column to be VARBINARY, and BINARY in another test.
Example vschema with column type defined;
Binary version
This was tested and reproduced on Vitess v10.0.2, v11.0.0, and v12.0.0
go version go1.17.1 linux/amd64
Operating system and Environment details
OS, Architecture, and any other information you can provide
about the environment.
cat /etc/os-release
): Pop!_OS 20.10uname -sr
): Linux 5.11.0-7620-genericuname -m
): x86_64The text was updated successfully, but these errors were encountered: