summaryrefslogtreecommitdiff
path: root/mysql-test/suite/innodb/t/innodb_scrub.test
blob: 9bb7a359e6841039f8b1e4f6a711225471b05516 (plain)
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
-- source include/have_innodb.inc
-- source include/not_embedded.inc

let $MYSQLD_DATADIR=`select @@datadir`;
let ib1_IBD = $MYSQLD_DATADIR/ibdata1;
let t1_IBD = $MYSQLD_DATADIR/test/t1.ibd;

create table snapshot_status engine = myisam
select * from information_schema.global_status
where variable_name like 'innodb_scrub%';

let $rowcount=500;
let $formatno = 3;
while ($formatno)
{
let $format = `select case $formatno
               when 1 then 'dynamic'
               when 2 then 'redundant'
               when 3 then 'compact'
               end`;
dec $formatno;

-- echo #
-- echo # Test delete of records
-- echo #

eval create table t1 (
  a int auto_increment primary key,
  b varchar(256),
  c text) engine = innodb row_format=$format;

let $numinserts = $rowcount;
-- echo # Populate table with rows
--disable_query_log
while ($numinserts)
{
  dec $numinserts;
  insert into t1(b,c) values ('bicycle', repeat('repairman', 1000));
}
--enable_query_log

delete from t1;

-- echo # restart mysqld so that all pages are flushed
-- source include/restart_mysqld.inc
-- echo # read all rows from table
-- disable_result_log
select * from t1;
-- enable_result_log

-- echo # $format: delete from: grep -c bicycle t1.ibd
-- exec grep -c bicycle $t1_IBD || true
-- echo # $format: delete from: grep -c bicycle ibdata1
-- exec grep -c bicycle $ib1_IBD || true
-- echo # $format: delete from: grep -c repairman t1.ibd
-- exec grep -c repairman $t1_IBD || true
-- echo # $format: delete from: grep -c repairman ibdata1
-- exec grep -c repairman $ib1_IBD || true

drop table t1;

-- echo #
-- echo # Test delete+rollback+delete
-- echo #

eval create table t1 (
  a int auto_increment primary key,
  b varchar(256),
  c text) engine = innodb row_format=$format;

let $numinserts = $rowcount;
-- echo # Populate table with rows
--disable_query_log
while ($numinserts)
{
  dec $numinserts;
  insert into t1(b,c) values ('bicycle', repeat('repairman', 1000));
}
--enable_query_log

begin;
delete from t1;
rollback;
delete from t1;

-- echo # restart mysqld so that all pages are flushed
-- source include/restart_mysqld.inc
-- echo # read all rows from table
-- disable_result_log
select * from t1;
-- enable_result_log

-- echo # $format: delete rollback: grep -c bicycle t1.ibd
-- exec grep -c bicycle $t1_IBD || true
-- echo # $format: delete rollback: grep -c bicycle ibdata1
-- exec grep -c bicycle $ib1_IBD || true
-- echo # $format: delete rollback: grep -c repairman t1.ibd
-- exec grep -c repairman $t1_IBD || true
-- echo # $format: delete rollback: grep -c repairman ibdata1
-- exec grep -c repairman $ib1_IBD || true

drop table t1;

-- echo #
-- echo # Test insert+rollback
-- echo #

eval create table t1 (
  a int auto_increment primary key,
  b varchar(256),
  c text) engine = innodb row_format=$format;

let $numinserts = $rowcount;
-- echo # Populate table with rows
begin;
--disable_query_log
while ($numinserts)
{
  dec $numinserts;
  insert into t1(b,c) values ('bicycle', repeat('repairman', 1000));
}
--enable_query_log

rollback;

-- echo # restart mysqld so that all pages are flushed
-- source include/restart_mysqld.inc
-- echo # read all rows from table
-- disable_result_log
select * from t1;
-- enable_result_log

-- echo # $format: insert rollback: grep -c bicycle t1.ibd
-- exec grep -c bicycle $t1_IBD || true
-- echo # $format: insert rollback: grep -c bicycle ibdata1
-- exec grep -c bicycle $ib1_IBD || true
-- echo # $format: insert rollback: grep -c repairman t1.ibd
-- exec grep -c repairman $t1_IBD || true
-- echo # $format: insert rollback: grep -c repairman ibdata1
-- exec grep -c repairman $ib1_IBD || true

drop table t1;
}

show variables like 'innodb_%scrub_data%';

--echo # verify that this test have not caused any background scrubbing
--sorted_result
select ss.variable_name, gs.variable_value - ss.variable_value as variable_value
from snapshot_status ss,
     information_schema.global_status gs
where ss.variable_name = gs.variable_name;

drop table snapshot_status;