Debian Codegraph @

mysql-test/suite/innodb_zip/include/atomic_truncate_table_scale.inc

raw
1 #
2 # load tables with some significant amount of data and then truncate it.
3 #
4
5 #-----------------------------------------------------------------------------
6 #
7 # create test-bed
8 #
9 let $per_table = `select @@innodb_file_per_table`;
10
11 let $WL6501_TMP_DIR = `select @@tmpdir`;
12 let $WL6501_DATA_DIR = `select @@datadir`;
13 set innodb_strict_mode=OFF;
14
15 #-----------------------------------------------------------------------------
16 #
17 # create procedure to load data
18 #
19 delimiter |;
20 create procedure populate()
21 begin
22 declare i int default 1;
23 while (i <= 5000) do
24 insert into t1 values (i, 'a', 'b');
25 insert into t2 values (i, 'a', 'b');
26 insert into t3 values (i, 'a', 'b');
27 set i = i + 1;
28 end while;
29 end|
30 create procedure populate_small()
31 begin
32 declare i int default 10001;
33 while (i <= 12000) do
34 insert into t1 values (i, 'c', 'd');
35 insert into t2 values (i, 'a', 'b');
36 insert into t3 values (i, 'a', 'b');
37 set i = i + 1;
38 end while;
39 end|
40 delimiter ;|
41
42 #-----------------------------------------------------------------------------
43 #
44 # create and load the tables.
45 #
46 eval set global innodb_file_per_table = $wl6501_file_per_table;
47 --replace_regex /[0-9]+/NUMBER/
48 eval create table t1
49 (i int, c1 char(100), c2 char(100),
50 index c1_idx(c1))
51 engine=innodb row_format=$wl6501_row_fmt
52 key_block_size=$wl6501_kbs;
53 eval create table t2
54 (i int, c1 char(100), c2 char(100),
55 index c1_idx(c1))
56 engine=innodb row_format=$wl6501_row_fmt
57 key_block_size=$wl6501_kbs;
58 eval create temporary table t3
59 (i int, c1 char(100), c2 char(100),
60 index c1_idx(c1))
61 engine=innodb row_format=$wl6501_row_fmt
62 key_block_size=$wl6501_kbs;
63 #
64 select count(*) from t1;
65 select count(*) from t2;
66 select count(*) from t3;
67 begin;
68 call populate();
69 commit;
70 select count(*) from t1;
71 select count(*) from t2;
72 select count(*) from t3;
73 #
74 truncate table t1;
75 select count(*) from t1;
76 select count(*) from t2;
77 select count(*) from t3;
78 #
79 call populate_small();
80 select count(*) from t1;
81 select count(*) from t2;
82 select count(*) from t3;
83 #
84 truncate table t2;
85 --echo # WL#7811/WL#7743/WL#7141 TODO: Remove the warnings!
86 truncate table t3;
87 select count(*) from t1;
88 select count(*) from t2;
89 select count(*) from t3;
90 #
91 call populate_small();
92 select count(*) from t1;
93 select count(*) from t2;
94 select count(*) from t3;
95 #
96 drop table t1;
97 drop table t2;
98 drop table t3;
99
100 #-----------------------------------------------------------------------------
101 #
102 # drop the procedure
103 #
104 drop procedure populate;
105 drop procedure populate_small;
106
107 #-----------------------------------------------------------------------------
108 #
109 # remove test-bed
110 #
111 eval set global innodb_file_per_table = $per_table;