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

Bug Report: 17.0.0-rc.1 query arguments missing for product_user_product_id #13250

Closed
L3o-pold opened this issue Jun 6, 2023 · 1 comment · Fixed by #13265
Closed

Bug Report: 17.0.0-rc.1 query arguments missing for product_user_product_id #13250

L3o-pold opened this issue Jun 6, 2023 · 1 comment · Fixed by #13265

Comments

@L3o-pold
Copy link
Collaborator

L3o-pold commented Jun 6, 2023

Overview of the Issue

Upgrading from Vitess 16.0.2 to 17.0.0-rc.1 we saw some query starting to fail with the error SQLSTATE[HY000]: General error: 1105 query arguments missing for product_user_product_id . Multiple requests are failing and they all have a JOIN it it. Here is a sample (reworked to avoid data leak)

Running an explain from MySQL:

{
   "OperatorType":"Route",
   "Variant":"EqualUnique",
   "Keyspace":{
      "Name":"commerce",
      "Sharded":true
   },
   "FieldQuery":"select product_user.id from product_user, product where 1 != 1",
   "Query":"select product_user.id from product_user, product where product_user.user_id = 'e2c4d5fb-9d00-4887-464e-e58f207bd7c9' and product_user.product_id = product.id",
   "Table":"product_user, product",
   "Values":[
      ":product_user_product_id"
   ],
   "Vindex":"unicode_loose_md5"
}

Running an explain from vtadmin fails with

"response": {
"error": {
 "message": "error running vtexplain: Code: INVALID_ARGUMENT for product_user_product_id...",
  "code": "unknown"
  },
  "ok": false
 },

With Vitess 16:

{
	"OperatorType": "VindexLookup",
	"Variant": "Equal",
	"Keyspace": {
		"Name": "commerce",
		"Sharded": true
	},
	"Values": [
		"VARCHAR(\"e2c4d5fb-9d00-4887-464e-e58f207bd7c9\")"
	],
	"Vindex": "product_user_keyspace_user_id",
	"Inputs": [
		{
			"OperatorType": "Route",
			"Variant": "IN",
			"Keyspace": {
				"Name": "commerce",
				"Sharded": true
			},
			"FieldQuery": "select user_id, keyspace_id from product_user_keyspace_user_id where 1 != 1",
			"Query": "select user_id, keyspace_id from product_user_keyspace_user_id where user_id in ::__vals",
			"Table": "product_user_keyspace_user_id",
			"Values": [
				":user_id"
			],
			"Vindex": "unicode_loose_md5"
		},
		{
			"OperatorType": "Route",
			"Variant": "ByDestination",
			"Keyspace": {
				"Name": "commerce",
				"Sharded": true
			},
			"FieldQuery": "select product_user.id from product_user, product where 1 != 1",
			"Query": "select product_user.id from product_user, product where product_user.user_id = 'e2c4d5fb-9d00-4887-464e-e58f207bd7c9' and product_user.product_id = product.id",
			"Table": "product_user, product"
		}
	]
}

Reproduction Steps

  1. Deploy the following vschema:
{
    "sharded": true,
    "vindexes": {
        "product_user_keyspace_user_id": {
            "type": "consistent_lookup",
            "params": {
                "from": "user_id,id",
                "table": "commerce.product_user_keyspace_user_id",
                "to": "keyspace_id"
            },
            "owner": "product_user"
        },
        "unicode_loose_md5": {
            "type": "unicode_loose_md5"
        }
    },
    "tables": {
        "product_user": {
            "column_vindexes": [
                {
                    "column": "product_id",
                    "name": "unicode_loose_md5"
                },
                {
                    "name": "product_user_keyspace_user_id",
                    "columns": [
                        "user_id",
                        "id"
                    ]
                }
            ]
        },
        "product_user_keyspace_user_id": {
            "column_vindexes": [
                {
                    "column": "user_id",
                    "name": "unicode_loose_md5"
                }
            ]
        },
        "product": {
            "column_vindexes": [
                {
                    "column": "id",
                    "name": "unicode_loose_md5"
                }
            ]
        }
    }
}
  1. Run
select `product_user`.`id`
from `product_user` 
inner join `product` on `product_user`.`product_id` = `product`.`id` 
where `product_user`.`user_id` = "e2c4d5fb-9d00-4887-464e-e58f207bd7c9";
  1. View error

Binary Version

Version: 17.0.0-rc1 (Git revision d0caade2b46addc0e1050c10867e8b187d2a1d03 branch 'heads/v17.0.0-rc1') built on Tue Jun  6 14:21:23 UTC 2023 by vitess@buildkitsandbox using go1.20.4 linux/amd64

Operating System and Environment details

Docker

Log Fragments

Reverting vtgate (only) to 16.0.2 fixes the issue. No log appears with useful informations.
@L3o-pold L3o-pold added Type: Bug Needs Triage This issue needs to be correctly labelled and triaged labels Jun 6, 2023
@mattlord
Copy link
Contributor

mattlord commented Jun 6, 2023

/cc @vitessio/query-serving

@deepthi deepthi removed the Needs Triage This issue needs to be correctly labelled and triaged label Jun 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants