summaryrefslogtreecommitdiff
path: root/mysql-test/suite/innodb/t/innodb_zip_innochecksum.test
blob: 63a4b418677ed1dfd587bb54fd13c0702d59c89e (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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
#************************************************************
# WL6045:Improve Innochecksum
#************************************************************
--source include/innodb_page_size_small.inc
--source include/no_valgrind_without_big.inc
# Embedded server does not support crashing.
--source include/not_embedded.inc

# Avoid CrashReporter popup on Mac.
--source include/not_crashrep.inc

--echo # Set the environmental variables
let MYSQLD_BASEDIR= `SELECT @@basedir`;
let MYSQLD_DATADIR= `SELECT @@datadir`;
let SEARCH_FILE= $MYSQLTEST_VARDIR/log/my_restart.err;
call mtr.add_suppression("InnoDB: Unable to read tablespace .* page no .* into the buffer pool after 100 attempts");
call mtr.add_suppression("InnoDB: Warning: database page corruption or a failed");

CREATE TABLE tab1(c1 INT PRIMARY KEY,c2 VARCHAR(20)) ENGINE=InnoDB;
CREATE INDEX idx1 ON tab1(c2(10));
INSERT INTO tab1 VALUES(1, 'Innochecksum InnoDB1');
CREATE TABLE t1(id INT AUTO_INCREMENT PRIMARY KEY, msg VARCHAR(255)) ENGINE=INNODB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4;
insert into t1 values(1,"i");
insert into t1 values(2,"am");
insert into t1 values(3,"compressed table");

--echo # Shutdown the Server
--source include/shutdown_mysqld.inc
--echo # Server Default checksum = innodb

#
# Not repeatable with --parallel= >1
#
#--echo [1a]: check the innochecksum when file doesn't exists
#--error 1
#--exec $INNOCHECKSUM  $MYSQLD_DATADIR/test/aa.ibd 2> $SEARCH_FILE
#let SEARCH_PATTERN= Error: $MYSQLD_DATADIR/test/aa.ibd cannot be found;
#--source include/search_pattern_in_file.inc

--echo [1b]: check the innochecksum without --strict-check
--exec $INNOCHECKSUM  $MYSQLD_DATADIR/test/tab1.ibd

--echo [2]: check the innochecksum with full form --strict-check=crc32
--exec $INNOCHECKSUM  --strict-check=crc32 $MYSQLD_DATADIR/test/tab1.ibd

--echo [3]: check the innochecksum with short form -C crc32
--exec $INNOCHECKSUM  -C crc32 $MYSQLD_DATADIR/test/tab1.ibd

--echo [4]: check the innochecksum with --no-check ignores algorithm check, warning is expected
--error 1
--exec $INNOCHECKSUM --no-check $MYSQLD_DATADIR/test/tab1.ibd 2> $SEARCH_FILE
let SEARCH_PATTERN= Error: --no-check must be associated with --write option.;
--source include/search_pattern_in_file.inc

--echo [5]: check the innochecksum with short form --no-check ignores algorithm check, warning is expected
--error 1
--exec $INNOCHECKSUM  -n $MYSQLD_DATADIR/test/tab1.ibd 2> $SEARCH_FILE
let SEARCH_PATTERN= Error: --no-check must be associated with --write option.;
--source include/search_pattern_in_file.inc

--echo [6]: check the innochecksum with full form strict-check & no-check , an error is expected
--error 1
--exec $INNOCHECKSUM --strict-check=innodb  --no-check $MYSQLD_DATADIR/test/tab1.ibd 2> $SEARCH_FILE
let SEARCH_PATTERN= Error: --strict-check option cannot be used together with --no-check option.;
--source include/search_pattern_in_file.inc

--echo [7]: check the innochecksum with short form strict-check & no-check , an error is expected
--error 1
--exec $INNOCHECKSUM -C innodb -n $MYSQLD_DATADIR/test/tab1.ibd 2> $SEARCH_FILE
let SEARCH_PATTERN= Error: --strict-check option cannot be used together with --no-check option.;
--source include/search_pattern_in_file.inc

--echo [8]: check the innochecksum with short & full form combination
--echo # strict-check & no-check, an error is expected
--error 1
--exec $INNOCHECKSUM --strict-check=innodb -n $MYSQLD_DATADIR/test/tab1.ibd 2> $SEARCH_FILE
let SEARCH_PATTERN= Error: --strict-check option cannot be used together with --no-check option.;
--source include/search_pattern_in_file.inc

--echo [9]: check the innochecksum with full form --strict-check=innodb
# Server Default checksum = crc32
--exec $INNOCHECKSUM  --strict-check=innodb $MYSQLD_DATADIR/test/tab1.ibd 2> $SEARCH_FILE

--echo [10]: check the innochecksum with full form --strict-check=none
--echo # when server Default checksum=crc32
--exec $INNOCHECKSUM  --strict-check=none $MYSQLD_DATADIR/test/tab1.ibd 2> $SEARCH_FILE

--echo [11]: check the innochecksum with short form -C innodb
--echo # when server Default checksum=crc32
--exec $INNOCHECKSUM  -C innodb $MYSQLD_DATADIR/test/tab1.ibd 2> $SEARCH_FILE

--echo [12]: check the innochecksum with short form -C none
--echo # when server Default checksum=crc32
--exec $INNOCHECKSUM  -C none $MYSQLD_DATADIR/test/tab1.ibd 2> $SEARCH_FILE

--echo [13]: check strict-check with invalid values
--error 1
--exec $INNOCHECKSUM --strict-check=strict_innodb $MYSQLD_DATADIR/test/tab1.ibd 2> $SEARCH_FILE
let SEARCH_PATTERN= Error while setting value \'strict_innodb\' to \'strict-check\';
--source include/search_pattern_in_file.inc

--error 1
--exec $INNOCHECKSUM -C strict_innodb $MYSQLD_DATADIR/test/tab1.ibd 2> $SEARCH_FILE
let SEARCH_PATTERN= Error while setting value \'strict_innodb\' to \'strict-check\';
--source include/search_pattern_in_file.inc

--error 1
--exec $INNOCHECKSUM --strict-check=strict_crc32 $MYSQLD_DATADIR/test/tab1.ibd 2> $SEARCH_FILE
let SEARCH_PATTERN= Error while setting value \'strict_crc32\' to \'strict-check\';
--source include/search_pattern_in_file.inc

--error 1
--exec $INNOCHECKSUM -C strict_crc32 $MYSQLD_DATADIR/test/tab1.ibd 2> $SEARCH_FILE
let SEARCH_PATTERN= Error while setting value \'strict_crc32\' to \'strict-check\';
--source include/search_pattern_in_file.inc

--error 1
--exec $INNOCHECKSUM --strict-check=strict_none $MYSQLD_DATADIR/test/tab1.ibd 2> $SEARCH_FILE
let SEARCH_PATTERN= Error while setting value \'strict_none\' to \'strict-check\';
--source include/search_pattern_in_file.inc

--error 1
--exec $INNOCHECKSUM -C strict_none $MYSQLD_DATADIR/test/tab1.ibd 2> $SEARCH_FILE
let SEARCH_PATTERN= Error while setting value \'strict_none\' to \'strict-check\';
--source include/search_pattern_in_file.inc

--error 1
--exec $INNOCHECKSUM --strict-check=InnoBD $MYSQLD_DATADIR/test/tab1.ibd 2> $SEARCH_FILE
let SEARCH_PATTERN= Error while setting value \'InnoBD\' to \'strict-check\';
--source include/search_pattern_in_file.inc

--error 1
--exec $INNOCHECKSUM -C InnoBD $MYSQLD_DATADIR/test/tab1.ibd 2>$SEARCH_FILE
let SEARCH_PATTERN= Error while setting value \'InnoBD\' to \'strict-check\';
--source include/search_pattern_in_file.inc

--error 1
--exec $INNOCHECKSUM --strict-check=crc $MYSQLD_DATADIR/test/tab1.ibd 2> $SEARCH_FILE
let SEARCH_PATTERN= Error while setting value \'crc\' to \'strict-check\';
--source include/search_pattern_in_file.inc

--error 1
--exec $INNOCHECKSUM --strict-check=no $MYSQLD_DATADIR/test/tab1.ibd 2> $SEARCH_FILE
let SEARCH_PATTERN= Error while setting value \'no\' to \'strict-check\';
--source include/search_pattern_in_file.inc

--echo [14a]: when server default checksum=crc32 rewrite new checksum=crc32 with innochecksum
--echo # Also check the long form of write option.
--exec $INNOCHECKSUM --strict-check=crc32 --write=crc32 $MYSQLD_DATADIR/test/tab1.ibd
--exec $INNOCHECKSUM --strict-check=crc32 --write=crc32 $MYSQLD_DATADIR/test/t1.ibd
# Rewrite done, verify with --strict-check=crc32
--exec $INNOCHECKSUM --strict-check=crc32 $MYSQLD_DATADIR/test/tab1.ibd
--exec $INNOCHECKSUM --strict-check=crc32 $MYSQLD_DATADIR/test/t1.ibd

--echo [14b]: when server default checksum=crc32 rewrite new checksum=innodb with innochecksum
--echo # Also check the long form of write option.
--exec $INNOCHECKSUM --no-check --write=innodb $MYSQLD_DATADIR/test/tab1.ibd
--exec $INNOCHECKSUM --strict-check=crc32 --write=innodb $MYSQLD_DATADIR/test/t1.ibd
# Rewrite done, verify with --strict-check=innodb
--exec $INNOCHECKSUM --strict-check=innodb $MYSQLD_DATADIR/test/tab1.ibd

--echo # start the server with innodb_checksum_algorithm=InnoDB
--let $restart_parameters= --innodb_checksum_algorithm=innodb
--source include/start_mysqld.inc

INSERT INTO tab1 VALUES(2, 'Innochecksum CRC32');
SELECT c1,c2 FROM tab1 order by c1,c2;

--echo # Stop the server
--source include/shutdown_mysqld.inc

--echo [15]: when server default checksum=crc32 rewrite new checksum=none with innochecksum
--echo # Also check the short form of write option.
--exec $INNOCHECKSUM --no-check -w none $MYSQLD_DATADIR/test/tab1.ibd
--exec $INNOCHECKSUM --no-check -w none $MYSQLD_DATADIR/test/t1.ibd
# Rewrite done, verify with --strict-check=none
--exec $INNOCHECKSUM --strict-check=none $MYSQLD_DATADIR/test/tab1.ibd
--exec $INNOCHECKSUM --strict-check=none $MYSQLD_DATADIR/test/t1.ibd

--echo # Start the server with checksum algorithm=none
--let $restart_parameters= --innodb_checksum_algorithm=none
--source include/start_mysqld.inc

INSERT INTO tab1 VALUES(3, 'Innochecksum None');
SELECT c1,c2 FROM tab1 order by c1,c2;
DROP TABLE t1;

--echo # Stop the server
--source include/shutdown_mysqld.inc

--echo [16]: rewrite into new checksum=crc32 with innochecksum
--exec $INNOCHECKSUM --no-check --write=crc32 $MYSQLD_DATADIR/test/tab1.ibd

--echo # Restart the DB server with  innodb_checksum_algorithm=crc32
--let $restart_parameters= --innodb_checksum_algorithm=crc32
--source include/start_mysqld.inc

SELECT * FROM tab1;
DELETE FROM tab1 where c1=3;
SELECT c1,c2 FROM tab1 order by c1,c2;

--echo # Stop server
--source include/shutdown_mysqld.inc

--echo [17]: rewrite into new checksum=InnoDB
--exec $INNOCHECKSUM --no-check --write=InnoDB $MYSQLD_DATADIR/test/tab1.ibd

--echo # Restart the DB server with innodb_checksum_algorithm=InnoDB
--let $restart_parameters= --innodb_checksum_algorithm=innodb
--source include/start_mysqld.inc

DELETE FROM tab1 where c1=2;
SELECT * FROM tab1;

--echo # Stop server
--source include/shutdown_mysqld.inc

--echo [18]:check Innochecksum with invalid write options
--error 1
--exec $INNOCHECKSUM --no-check --write=strict_crc32 $MYSQLD_DATADIR/test/tab1.ibd 2> $SEARCH_FILE
let SEARCH_PATTERN=Error while setting value \'strict_crc32\' to \'write\';
--source include/search_pattern_in_file.inc

--error 1
--exec $INNOCHECKSUM --no-check --write=strict_innodb $MYSQLD_DATADIR/test/tab1.ibd 2> $SEARCH_FILE
let SEARCH_PATTERN=Error while setting value \'strict_innodb\' to \'write\';
--source include/search_pattern_in_file.inc

--error 1
--exec $INNOCHECKSUM --no-check --write=crc23 $MYSQLD_DATADIR/test/tab1.ibd 2> $SEARCH_FILE
let SEARCH_PATTERN=Error while setting value \'crc23\' to \'write\';
--source include/search_pattern_in_file.inc
--remove_file $SEARCH_FILE

# Cleanup
--let $restart_parameters=
--source include/start_mysqld.inc

DROP TABLE tab1;