Hi all,
I've been struggling to explain a query using a simple vschema.json file (in an unsharded database; the one provided as an example [./101_initial_cluster.sh]) but unfortunately, I always get an unknown field error like this: ERROR: initVtgateExecutor: unknown field "commerce" in vschema.Keyspace
Steps to reproduce it:
{
"routing_rules": {},
"keyspaces": {
"commerce": {
"tables": {
"corder": {
"name": "corder"
},
"customer": {
"name": "customer"
},
"dual": {
"type": "reference",
"name": "dual"
},
"product": {
"name": "product"
}
}
}
}
}
2. After that I created a schema.sql file like this:
CREATE TABLE corder (
order_id bigint(20) NOT NULL AUTO_INCREMENT,
customer_id bigint(20) DEFAULT NULL,
sku varbinary(128) DEFAULT NULL,
price bigint(20) DEFAULT NULL,
PRIMARY KEY (order_id)
);
CREATE TABLE customer (
customer_id bigint(20) NOT NULL AUTO_INCREMENT,
email varbinary(128) DEFAULT NULL,
PRIMARY KEY (customer_id)
);
CREATE TABLE product (
sku varbinary(128) NOT NULL,
description varbinary(128) DEFAULT NULL,
price bigint(20) DEFAULT NULL,
PRIMARY KEY (sku)
);
3. And finally I just execute the following:
$ ./vtexplain -schema-file schema.sql -vschema-file vschema.json -sql "select * from customer"
ERROR: initVtgateExecutor: unknown field "commerce" in vschema.Keyspace
1. The commerce keyspace exists and it seems okay.
In addition, I also tried to to get the VSchema using vtctl like this: ./vtctl $TOPOLOGY GetVSchema commerce and the VSchema result is different (a little more simple), i.e:
{
"tables": {
"corder": {
},
"customer": {
},
"product": {
}
}
}
But, in any case I keep getting the same unknown field error:
ERROR: initVtgateExecutor: unknown field "order" in vschema.Keyspace
(the field name keeps changing on each execution)
It's worth saying that I tried with a sharded database using the horizontal sharding example, I mean with a more complex vschema, but the result is the same.
Did anyone else run into this error before? Why I'm obtaining different results getting vschema from http://{server}:15001/debug/vschema or getting it from vtctl?
Appreciate any help or guidance to understand what the issue is.
Thanks in advance.