Debian Codegraph @

mysql-test/suite/innodb/include/innodb_bulk_inject_errors.inc

raw
1 --echo # ###########################################################
2 --echo # Prepare
3
4 if ($row_format != 'COMPRESSED')
5 {
6 # Create general tablespace
7 CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENGINE=InnoDB;
8
9 # Create table in file-per-table tablespace.
10 eval CREATE TABLE t1
11 (c1 VARCHAR(300), c2 TEXT)
12 ENGINE=InnoDB
13 ROW_FORMAT=$row_format
14 TABLESPACE innodb_file_per_table;
15 }
16
17 if ($row_format == 'COMPRESSED')
18 {
19 # Create general tablespace
20 CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' FILE_BLOCK_SIZE=4096 ENGINE=InnoDB;
21
22 # Create table in file-per-table tablespace.
23 eval CREATE TABLE t1
24 (c1 VARCHAR(300), c2 TEXT)
25 ENGINE=InnoDB
26 ROW_FORMAT=$row_format
27 KEY_BLOCK_SIZE=4
28 TABLESPACE innodb_file_per_table;
29 }
30
31 # Insert some values (make sure more than one page would be used for records)
32 --disable_query_log
33 BEGIN;
34 LET $insert_idx = 1;
35 LET $insert_cnt = 100; # 30000 (total size) / 300 (rec size)
36 WHILE ($insert_idx <= $insert_cnt)
37 {
38 INSERT INTO t1 VALUES (REPEAT('1', 300), REPEAT('a', 16000));
39 INC $insert_idx;
40 }
41 COMMIT;
42 --enable_query_log
43
44 --echo # ###########################################################
45 --echo # Inject error during bulk insert
46
47 SET debug = '+d,ddl_btree_build_too_big_record';
48
49 # Move table to general tablespace
50 --replace_regex /not counting BLOBs, is [0-9]+/not counting BLOBs, is #value#/
51 --error ER_TOO_BIG_ROWSIZE
52 ALTER TABLE t1 TABLESPACE ts1;
53
54 SET debug = '-d,ddl_btree_build_too_big_record';
55
56 FLUSH TABLES;
57
58 --echo # ###########################################################
59 --echo # Inject error during bulk reserve space
60
61 SET debug = '+d,ddl_btree_build_oom';
62
63 # Move table to general tablespace
64 --error ER_OUT_OF_RESOURCES
65 ALTER TABLE t1 TABLESPACE ts1;
66
67 FLUSH TABLES;
68
69 SET debug = '-d,ddl_btree_build_oom';
70
71 --echo # ###########################################################
72 --echo # No error - check for final success
73
74 # Move table to general tablespace
75 ALTER TABLE t1 TABLESPACE ts1;
76
77 FLUSH TABLES;
78
79 --echo # ###########################################################
80 --echo # Cleanup
81
82 DROP TABLE t1;
83 DROP TABLESPACE ts1;