Debian Codegraph @

mysql-test/suite/galera/t/galera_toi_lock_exclusive.test

raw
1 --source include/galera_cluster.inc
2 --source include/have_innodb.inc
3
4 #
5 # Ensure that ALTER LOCK=EXCLUSIVE works under TOI. It is difficult to check that concurrent operations
6 # are truly not possible, but at least we expect no hangs or deadlocks
7 #
8
9 CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB;
10 INSERT INTO t1 VALUES (1);
11
12 # Start a transaction that is concurrent to the DDL. This is not strictly necessary for this test
13 # but does put more locks into play.
14 --connection node_2
15 SET AUTOCOMMIT=OFF;
16 START TRANSACTION;
17 INSERT INTO t1 VALUES (2);
18
19 --let $galera_connection_name = node_2a
20 --let $galera_server_number = 2
21 --source include/galera_connect.inc
22 --connection node_2a
23 ALTER TABLE t1 ADD COLUMN f2 INTEGER, LOCK=EXCLUSIVE;
24
25 # In Galera, a concurrent transaction aborts in the face of ALTER
26 --connection node_2
27 --error ER_LOCK_DEADLOCK
28 COMMIT;
29
30 --connection node_1
31 INSERT INTO t1 VALUES (2, 2);
32 SELECT COUNT(*) = 2 FROM t1;
33
34 --connection node_2
35 INSERT INTO t1 VALUES (3, 3);
36 SELECT COUNT(*) = 3 FROM t1;
37
38 DROP TABLE t1;