Details
Description
If I execute a CREATE TABLE ... AS SELECT ... on a Galera Cluster node, and the result set of the query is empty, then the query will deadlock.
Let's say that we have the following table on a Galera Cluster node:
CREATE TABLE test_tab (
|
id integer primary key,
|
data varchar(25)
|
);
|
|
INSERT INTO test_tab VALUES (4, 'name 33'),
|
(7, 'name 33'),
|
(13, 'name 33'),
|
(16, 'name 33'),
|
(19, 'name 33');
|
The following query works just fine:
MariaDB [db1]> SELECT * FROM test_tab WHERE id=4;
|
+----+---------+
|
| id | data |
|
+----+---------+
|
| 4 | name 33 |
|
+----+---------+
|
1 row in set (0.00 sec)
|
|
MariaDB [db1]> CREATE TABLE test_clone1 AS SELECT * FROM test_tab WHERE id=4;
|
Query OK, 1 row affected (0.01 sec)
|
Records: 1 Duplicates: 0 Warnings: 0
|
But this query deadlocks:
MariaDB [db1]> SELECT * FROM test_tab WHERE id=2;
|
Empty set (0.00 sec)
|
|
MariaDB [db1]> CREATE TABLE test_clone2 AS SELECT * FROM test_tab WHERE id=2;
|
ERROR 1213 (40001): Deadlock found when trying to get lock; try restarting transaction
|
Galera version:
MariaDB [db1]> show global status like 'wsrep_provider_version';
|
+------------------------+----------------+
|
| Variable_name | Value |
|
+------------------------+----------------+
|
| wsrep_provider_version | 25.3.15(r3578) |
|
+------------------------+----------------+
|
1 row in set (0.00 sec)
|
Attachments
Issue Links
- links to