We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Scenario:
Unsharded keyspace schema:
CREATE TABLE id_seq ( id INT, next_id BIGINT, cache BIGINT, PRIMARY KEY(id)) comment 'vitess_sequence'; INSERT INTO id_seq (id, next_id, cache) values (0, 1, 1000);
Unsharded keyspace vschema:
{ "tables": { "id_seq": { "type": "sequence" } } }
Sharded keyspace schema:
CREATE TABLE tablename ( id BIGINT NOT NULL, c1 DOUBLE NOT NULL, c2 BIGINT, PRIMARY KEY (id), UNIQUE KEY (c1, c2) ); CREATE TABLE lookup_vindex ( c1 DOUBLE NOT NULL, c2 BIGINT, keyspace_id BLOB, UNIQUE KEY (`c1`, `c2`) );
Sharded keyspace vschema:
{ "sharded": true, "vindexes": { "lookup_vindex": { "type": "consistent_lookup", "params": { "from": "c1,c2", "table": "lookup_vindex", "to": "keyspace_id" }, "owner": "tablename" }, "hash": { "type": "hash" } }, "tables": { "dotted.tablename": { "columnVindexes": [ { "column": "id", "name": "hash" }, { "name": "lookup_vindex", "columns": [ "c1", "c2" ] } ], "autoIncrement": { "column": "id", "sequence": "id_seq" } }, "lookup_vindex": { "columnVindexes": [ { "column": "c1", "name": "hash" } ] } } }
Now, the bug appears when you try and insert a unique column pair twice:
First time (works fine):
mysql> insert into tablename (c1,c2) values (10,10); Query OK, 1 row affected (0.07 sec) mysql> select * from tablename; +----+----+------+ | id | c1 | c2 | +----+----+------+ | 5 | 10 | 10 | +----+----+------+ 1 row in set (0.00 sec) mysql> select * from lookup_vindex; +----+------+--------------------------+ | c1 | c2 | keyspace_id | +----+------+--------------------------+ | 10 | 10 | 0x70BB023C810CA87A | +----+------+--------------------------+ 1 row in set (0.00 sec)
Insert duplicate:
mysql> insert into tablename (c1,c2) values (10,10); ERROR 1105 (HY000): vtgate: http://localhost:15001/: execInsertSharded: getInsertShardedRoute: duplicate entry [INT64(10) INT64(10)]
The error is expected; but the type of error is incorrect. 1105 is an UNKNOWN_ERROR; and you would expect a 1062 Duplicate Entry error.
For comparison, when using a vindex of type lookup instead of consistent lookup, the type of error is correct, something like:
ERROR 1062 (23000): vtgate: http://localhost:15001/: execInsertSharded: getInsertShardedRoute: lookup.Create: Code: ALREADY_EXISTS
The text was updated successfully, but these errors were encountered:
Successfully merging a pull request may close this issue.
Scenario:
Unsharded keyspace schema:
Unsharded keyspace vschema:
Sharded keyspace schema:
Sharded keyspace vschema:
Now, the bug appears when you try and insert a unique column pair twice:
First time (works fine):
Insert duplicate:
The error is expected; but the type of error is incorrect. 1105 is an UNKNOWN_ERROR; and you would expect a 1062 Duplicate Entry error.
For comparison, when using a vindex of type lookup instead of consistent lookup, the type of error is correct, something like:
The text was updated successfully, but these errors were encountered: