File: alter_dml_apply.test

package info (click to toggle)
mariadb 1%3A11.8.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, trixie
  • size: 765,428 kB
  • sloc: ansic: 2,382,827; cpp: 1,803,532; asm: 378,315; perl: 63,176; sh: 46,496; pascal: 40,776; java: 39,363; yacc: 20,428; python: 19,506; sql: 17,864; xml: 12,463; ruby: 8,544; makefile: 6,059; cs: 5,855; ada: 1,700; lex: 1,193; javascript: 1,039; objc: 80; tcl: 73; awk: 46; php: 22
file content (60 lines) | stat: -rw-r--r-- 1,735 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
--source include/have_innodb.inc
--source include/have_debug.inc
--source include/have_debug_sync.inc
--source include/have_sequence.inc
--source include/no_valgrind_without_big.inc

CREATE TABLE t1(f1 INT NOT NULL, f2 INT NOT NULL,
		f3 CHAR(200), f4 CHAR(200),
		PRIMARY KEY(f1))ENGINE=InnoDB;
INSERT INTO t1 VALUES(6000, 6000, "InnoDB", "MariaDB");

# InnoDB DML thread applies the online log, aborts other online index

SET DEBUG_SYNC="inplace_after_index_build SIGNAL dml_start WAIT_FOR dml_commit";
SEND ALTER TABLE t1 ADD UNIQUE KEY(f2), ADD UNIQUE INDEX(f4(10));

# InnoDB DML thread applies insert log

connect(con1,localhost,root,,,);
SET DEBUG_SYNC="now WAIT_FOR dml_start";
# Rollback should avoid online index
BEGIN;
DELETE FROM t1 WHERE f1= 6000;
INSERT INTO t1 VALUES(6000, 6000, "InnoDB", "MariaDB");
ROLLBACK;

# Insert log will fetch the previous version in this case
BEGIN;
DELETE FROM t1 WHERE f1= 6000;
INSERT INTO t1 VALUES(6000, 6000, "InnoDB", "MariaDB");
INSERT INTO t1 SELECT seq, seq, repeat('a', 200), repeat('b', 200) FROM seq_1_to_4000;
COMMIT;
SET DEBUG_SYNC="now SIGNAL dml_commit";

connection default;
--error ER_DUP_ENTRY
reap;

# DML Thread applies update log

SET DEBUG_SYNC="inplace_after_index_build SIGNAL dml_start WAIT_FOR dml_commit";
SEND ALTER TABLE t1 ADD UNIQUE KEY(f2), ADD INDEX(f3(10));

connection con1;
SET DEBUG_SYNC="now WAIT_FOR dml_start";
BEGIN;
DELETE FROM t1;
INSERT INTO t1 SELECT seq, seq, repeat('d', 200), repeat('e', 200) FROM
seq_1_to_4000;
UPDATE t1 SET f3=repeat('c', 200), f4= repeat('d', 200), f2=3;
COMMIT;
SET DEBUG_SYNC="now SIGNAL dml_commit";

connection default;
--error ER_DUP_ENTRY
reap;
disconnect con1;
CHECK TABLE t1;
DROP TABLE t1;
SET DEBUG_SYNC=reset;