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

Lock wait timeout on DELETE from table using lookup index #6698

Closed
aquarapid opened this issue Sep 10, 2020 · 0 comments · Fixed by #6700
Closed

Lock wait timeout on DELETE from table using lookup index #6698

aquarapid opened this issue Sep 10, 2020 · 0 comments · Fixed by #6700
Milestone

Comments

@aquarapid
Copy link
Contributor

Scenario:

  • Up-to-date master vitess branch (ed51f56)
  • examples/local setup done via:
$ cd examples/local/
$ for i in `ls -1 [1-3]*.sh` ; do echo $i ; ./$i ; sleep 5 ; done
.
.
  • Apply schema and vschema as indicated to the sharded (customer) keyspace:
$ cat schema.sql 
CREATE TABLE t1 (
    c1 BIGINT NOT NULL,
    c2 INT NOT NULL,
    PRIMARY KEY (c1),
    CONSTRAINT UNIQUE (c2)
);


CREATE TABLE `lookup_t1` (
    c2 INT NOT NULL,
    keyspace_id BINARY(8),
    PRIMARY KEY (c2)
);

$ cat vschema.json 
{
  "sharded": true,
  "vindexes": {
    "hash": { "type": "hash" },
    "xxhash": { "type": "xxhash" },
    "lookup_t1_c2": {
      "type": "consistent_lookup_unique",
      "params": {
        "table": "lookup_t1",
        "from": "c2",
        "to": "keyspace_id",
        "ignore_nulls": "true"
      },
      "owner": "t1"
    }
  },
  "tables": {
    "t1": {
      "columnVindexes": [
        {
          "column": "c1",
          "name": "hash"
        },
        {
          "column": "c2",
          "name": "lookup_t1_c2"
        }
      ],
      "columns": [
        {
          "name": "c1",
          "type": "INT64"
        },
        {
          "name": "c2",
          "type": "INT32"
        }
      ],
      "columnListAuthoritative": true
    },
    "lookup_t1": {
      "columnVindexes": [
        {
          "column": "c2",
          "name": "hash"
        }
      ]
    }
  }
}

$ vtctlclient -server localhost:15999  ApplyVSchema -vschema="$(cat ./vschema.json)" customer
New VSchema object:
.
.
.
$ vtctlclient -server localhost:15999 ApplySchema -sql "$(cat schema.sql)" customer
  • Connect to vtgate, verify environment, insert a row and DELETE the row, observing the issue:
$ mysql -u root -P 15306 -h 127.0.0.1 -u root customer -A
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.9-Vitess MySQL Community Server - GPL

Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> show tables;
+-----------------------+
| Tables_in_vt_customer |
+-----------------------+
| corder                |
| customer              |
| lookup_t1             |
| t1                    |
+-----------------------+
4 rows in set (0.01 sec)

mysql> insert into t1 values (1, 2);
Query OK, 1 row affected (0.01 sec)

mysql> select * from t1;
+----+----+
| c1 | c2 |
+----+----+
|  1 |  2 |
+----+----+
1 row in set (0.01 sec)

mysql> select * from lookup_t1;
+----+--------------------------+
| c2 | keyspace_id              |
+----+--------------------------+
|  2 | 0x166B40B44ABA4BD6       |
+----+--------------------------+
1 row in set (0.00 sec)

mysql> DELETE FROM t1 WHERE c2=2;
<hang for 30 secs>
ERROR 1205 (HY000): vtgate: http://localhost:15001/: execDeleteEqual: lookup.Delete: Code: DEADLINE_EXCEEDED
vttablet: Lock wait timeout exceeded; try restarting transaction (errno 1205) (sqlstate HY000) (CallerID: userData1): Sql: "delete from lookup_t1 where c2 = :c2 and keyspace_id = :keyspace_id", BindVars: {#maxLimit: "type:INT64 value:\"10001\" "c2: "type:INT32 value:\"2\" "keyspace_id: "type:VARBINARY value:\"\\026k@\\264J\\272K\\326\" "}

target: customer.-80.master, used tablet: zone1-300 (localhost)
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

Successfully merging a pull request may close this issue.

2 participants