Debian Codegraph @

mysql-test/suite/innodb/t/alter_dml_apply.test

raw
1 --source include/have_innodb.inc
2 --source include/have_debug.inc
3 --source include/have_debug_sync.inc
4 --source include/have_sequence.inc
5 --source include/no_valgrind_without_big.inc
6
7 CREATE TABLE t1(f1 INT NOT NULL, f2 INT NOT NULL,
8 f3 CHAR(200), f4 CHAR(200),
9 PRIMARY KEY(f1))ENGINE=InnoDB;
10 INSERT INTO t1 VALUES(6000, 6000, "InnoDB", "MariaDB");
11
12 # InnoDB DML thread applies the online log, aborts other online index
13
14 SET DEBUG_SYNC="inplace_after_index_build SIGNAL dml_start WAIT_FOR dml_commit";
15 SEND ALTER TABLE t1 ADD UNIQUE KEY(f2), ADD UNIQUE INDEX(f4(10));
16
17 # InnoDB DML thread applies insert log
18
19 connect(con1,localhost,root,,,);
20 SET DEBUG_SYNC="now WAIT_FOR dml_start";
21 # Rollback should avoid online index
22 BEGIN;
23 DELETE FROM t1 WHERE f1= 6000;
24 INSERT INTO t1 VALUES(6000, 6000, "InnoDB", "MariaDB");
25 ROLLBACK;
26
27 # Insert log will fetch the previous version in this case
28 BEGIN;
29 DELETE FROM t1 WHERE f1= 6000;
30 INSERT INTO t1 VALUES(6000, 6000, "InnoDB", "MariaDB");
31 INSERT INTO t1 SELECT seq, seq, repeat('a', 200), repeat('b', 200) FROM seq_1_to_4000;
32 COMMIT;
33 SET DEBUG_SYNC="now SIGNAL dml_commit";
34
35 connection default;
36 --error ER_DUP_ENTRY
37 reap;
38
39 # DML Thread applies update log
40
41 SET DEBUG_SYNC="inplace_after_index_build SIGNAL dml_start WAIT_FOR dml_commit";
42 SEND ALTER TABLE t1 ADD UNIQUE KEY(f2), ADD INDEX(f3(10));
43
44 connection con1;
45 SET DEBUG_SYNC="now WAIT_FOR dml_start";
46 BEGIN;
47 DELETE FROM t1;
48 INSERT INTO t1 SELECT seq, seq, repeat('d', 200), repeat('e', 200) FROM
49 seq_1_to_4000;
50 UPDATE t1 SET f3=repeat('c', 200), f4= repeat('d', 200), f2=3;
51 COMMIT;
52 SET DEBUG_SYNC="now SIGNAL dml_commit";
53
54 connection default;
55 --error ER_DUP_ENTRY
56 reap;
57 disconnect con1;
58 CHECK TABLE t1;
59 DROP TABLE t1;
60 SET DEBUG_SYNC=reset;