mirror of
https://github.com/MariaDB/server.git
synced 2025-01-27 01:04:19 +01:00
243 lines
10 KiB
Text
243 lines
10 KiB
Text
#************************************************************
|
|
# WL6045:Improve Innochecksum
|
|
#************************************************************
|
|
--source include/have_innodb.inc
|
|
--source include/have_innodb_zip.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");
|
|
|
|
SET GLOBAL innodb_file_per_table=on;
|
|
|
|
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_options= : --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_options= : --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_options= : --innodb_checksum_algorithm=crc32 --innodb_file_per_table=on
|
|
--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_options= : --innodb_checksum_algorithm=innodb --innodb_file_per_table=on
|
|
--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
|
|
--echo # Restart the server
|
|
--source include/start_mysqld.inc
|
|
|
|
DROP TABLE tab1;
|
|
SET GLOBAL innodb_file_per_table=default;
|