diff options
Diffstat (limited to 'mysql-test/suite/innodb_zip/t/innochecksum_3.test')
-rw-r--r-- | mysql-test/suite/innodb_zip/t/innochecksum_3.test | 270 |
1 files changed, 270 insertions, 0 deletions
diff --git a/mysql-test/suite/innodb_zip/t/innochecksum_3.test b/mysql-test/suite/innodb_zip/t/innochecksum_3.test new file mode 100644 index 00000000..ef6d8225 --- /dev/null +++ b/mysql-test/suite/innodb_zip/t/innochecksum_3.test @@ -0,0 +1,270 @@ +#************************************************************ +# 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: innodb_checksum_algorithm is set to.*"); + +CREATE TABLE tab1 (pk INTEGER NOT NULL PRIMARY KEY, +linestring_key GEOMETRY NOT NULL, +linestring_nokey GEOMETRY NOT NULL) +ENGINE=InnoDB ; + +INSERT INTO tab1 (pk, linestring_key, linestring_nokey) +VALUES (1, ST_GeomFromText('POINT(10 10) '), ST_GeomFromText('POINT(10 10) ')); + +CREATE INDEX linestring_index ON tab1(linestring_nokey(5)); +ALTER TABLE tab1 ADD KEY (linestring_key(5)); + +--echo # create a compressed table +CREATE TABLE tab2(col_1 CHAR (255) , +col_2 VARCHAR (255), col_3 longtext, +col_4 longtext,col_5 longtext, +col_6 longtext , col_7 int ) +engine = innodb row_format=compressed key_block_size=4; + +CREATE INDEX idx1 ON tab2(col_3(10)); +CREATE INDEX idx2 ON tab2(col_4(10)); +CREATE INDEX idx3 ON tab2(col_5(10)); + +# load the with repeat function +SET @col_1 = repeat('a', 5); +SET @col_2 = repeat('b', 20); +SET @col_3 = repeat('c', 100); +SET @col_4 = repeat('d', 100); +SET @col_5 = repeat('e', 100); +SET @col_6 = repeat('f', 100); + +# insert 5 records +let $i = 5; +while ($i) { + eval INSERT INTO tab2(col_1,col_2,col_3,col_4,col_5,col_6,col_7) + VALUES (@col_1,@col_2,@col_3,@col_4,@cl_5,@col_6,$i); + dec $i; +} + +--echo # stop the server +--source include/shutdown_mysqld.inc + +--echo [2]: Check the page type summary with shortform for tab1.ibd +--replace_regex /File.*.ibd/File::tab1.ibd/ /[0-9]+/#/ +--exec $INNOCHECKSUM -S $MYSQLD_DATADIR/test/tab1.ibd 2>$MYSQLTEST_VARDIR/tmp/page_summary_short.txt + +--echo [3]: Check the page type summary with longform for tab1.ibd +--replace_regex /File.*.ibd/File::tab1.ibd/ /[0-9]+/#/ +--exec $INNOCHECKSUM --page-type-summary $MYSQLD_DATADIR/test/tab1.ibd 2>$MYSQLTEST_VARDIR/tmp/page_summary_long.txt + +--remove_file $MYSQLTEST_VARDIR/tmp/page_summary_short.txt +--remove_file $MYSQLTEST_VARDIR/tmp/page_summary_long.txt +--echo [4]: Page type dump for with longform for tab1.ibd +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--exec $INNOCHECKSUM --page-type-dump $MYSQLTEST_VARDIR/tmp/dump.txt $MYSQLD_DATADIR/test/tab1.ibd + +perl; +use strict; +use warnings; +use File::Copy; +my $dir = $ENV{'MYSQLTEST_VARDIR'}; +opendir(DIR, $dir) or die $!; +my $file= 'dump.txt'; +# open file in write mode +open IN_FILE,"<", "$dir/tmp/$file" or die $!; +open OUT_FILE, ">", "$dir/tmp/innochecksum_3_tempfile" or die $!; +while(<IN_FILE>) +{ + # Replace the intergers to # and complete file path to file name only. + $_=~ s/Filename.+/Filename::tab1.ibd/g; + $_=~ s/\d+/#/g; + print OUT_FILE $_; +} +close(IN_FILE); +close(OUT_FILE); +# move the new content from tmp file to the orginal file. +move ("$dir/tmp/innochecksum_3_tempfile", "$dir/tmp/$file"); +closedir(DIR); +EOF + +--echo # Print the contents stored in dump.txt +cat_file $MYSQLTEST_VARDIR/tmp/dump.txt; +--remove_file $MYSQLTEST_VARDIR/tmp/dump.txt + +--echo # Variables used by page type dump for ibdata1 +--exec $INNOCHECKSUM -v --page-type-dump $MYSQLTEST_VARDIR/tmp/dump.txt $MYSQLD_DATADIR/ibdata1 > $MYSQLTEST_VARDIR/tmp/page_verbose_summary.txt + +--file_exists $MYSQLTEST_VARDIR/tmp/dump.txt +--remove_file $MYSQLTEST_VARDIR/tmp/dump.txt + +perl; +use strict; +use warnings; +use File::Copy; +my $dir = $ENV{'MYSQLTEST_VARDIR'}; +opendir(DIR, $dir) or die $!; +my $file= 'page_verbose_summary.txt'; +# open file in write mode +open IN_FILE,"<", "$dir/tmp/$file" or die $!; +open OUT_FILE, ">", "$dir/tmp/innochecksum_3_tempfile" or die $!; +while(<IN_FILE>) +{ + # Replace complete file path to file name only. + $_=~ s/$dir/MYSQLTEST_VARDIR/; + # Remove debug option, which is not in all builds + next if (/debug/); + print OUT_FILE $_; +} +close(IN_FILE); +close(OUT_FILE); +# move the new content from tmp file to the orginal file. +move ("$dir/tmp/innochecksum_3_tempfile", "$dir/tmp/$file"); +closedir(DIR); +EOF + +cat_file $MYSQLTEST_VARDIR/tmp/page_verbose_summary.txt; +--remove_file $MYSQLTEST_VARDIR/tmp/page_verbose_summary.txt + +--echo [5]: Page type dump for with shortform for tab1.ibd +--exec $INNOCHECKSUM -D $MYSQLTEST_VARDIR/tmp/dump.txt $MYSQLD_DATADIR/test/tab1.ibd + +perl; +use strict; +use warnings; +use File::Copy; +my $dir = $ENV{'MYSQLTEST_VARDIR'}; +opendir(DIR, $dir) or die $!; +my $file= 'dump.txt'; +# open file in write mode +open IN_FILE,"<", "$dir/tmp/$file" or die $!; +open OUT_FILE, ">", "$dir/tmp/innochecksum_3_tempfile" or die $!; +while(<IN_FILE>) +{ + # Replace the intergers to # and complete file path to file name only. + $_=~ s/Filename.+/Filename::tab1.ibd/g; + $_=~ s/\d+/#/g; + print OUT_FILE $_; +} +close(IN_FILE); +close(OUT_FILE); +# move the new content from tmp file to the orginal file. +move ("$dir/tmp/innochecksum_3_tempfile", "$dir/tmp/$file"); +closedir(DIR); +EOF + +# Print the contents stored in dump.txt +cat_file $MYSQLTEST_VARDIR/tmp/dump.txt; +--remove_file $MYSQLTEST_VARDIR/tmp/dump.txt + +--echo [6]: check the valid lower bound values for option +--echo # allow-mismatches,page,start-page,end-page +--exec $INNOCHECKSUM --allow-mismatches=0 $MYSQLD_DATADIR/test/tab1.ibd +--exec $INNOCHECKSUM -a 0 $MYSQLD_DATADIR/test/tab1.ibd +--exec $INNOCHECKSUM --page=0 $MYSQLD_DATADIR/test/tab1.ibd +--exec $INNOCHECKSUM -p 0 $MYSQLD_DATADIR/test/tab1.ibd +--exec $INNOCHECKSUM --start-page=0 $MYSQLD_DATADIR/test/tab1.ibd +--exec $INNOCHECKSUM -s 0 $MYSQLD_DATADIR/test/tab1.ibd +--exec $INNOCHECKSUM --end-page=0 $MYSQLD_DATADIR/test/tab1.ibd +--exec $INNOCHECKSUM -e 0 $MYSQLD_DATADIR/test/tab1.ibd + +# +# These produce now errors +# +#--echo [7]: check the negative values for option +#--echo # allow-mismatches,page,start-page,end-page. +#--echo # They will reset to zero for negative values. +#--echo # check the invalid lower bound values +#--exec $INNOCHECKSUM --allow-mismatches=-1 $MYSQLD_DATADIR/test/tab1.ibd +#--exec $INNOCHECKSUM -a -1 $MYSQLD_DATADIR/test/tab1.ibd +#--exec $INNOCHECKSUM --page=-1 $MYSQLD_DATADIR/test/tab1.ibd +#--exec $INNOCHECKSUM -p -1 $MYSQLD_DATADIR/test/tab1.ibd +#--exec $INNOCHECKSUM --start-page=-1 $MYSQLD_DATADIR/test/tab1.ibd +#--exec $INNOCHECKSUM -s -1 $MYSQLD_DATADIR/test/tab1.ibd +#--exec $INNOCHECKSUM --end-page=-1 $MYSQLD_DATADIR/test/tab1.ibd +#--exec $INNOCHECKSUM -e -1 $MYSQLD_DATADIR/test/tab1.ibd +# +#--echo [8]: check the valid upper bound values for +#--echo # both short and long options "allow-mismatches" and "end-page" +# +#--exec $INNOCHECKSUM --allow-mismatches=18446744073709551615 $MYSQLD_DATADIR/test/tab1.ibd +#--exec $INNOCHECKSUM -a 18446744073709551615 $MYSQLD_DATADIR/test/tab1.ibd +#--exec $INNOCHECKSUM --end-page=18446744073709551615 $MYSQLD_DATADIR/test/tab1.ibd +#--exec $INNOCHECKSUM -e 18446744073709551615 $MYSQLD_DATADIR/test/tab1.ibd + +--echo [9]: check the both short and long options "page" and "start-page" when +--echo # seek value is larger than file size. +--error 1 +--exec $INNOCHECKSUM --page=18446744073709551615 $MYSQLD_DATADIR/test/tab1.ibd 2> $SEARCH_FILE +let SEARCH_PATTERN= Error: Unable to seek to necessary offset; +--source include/search_pattern_in_file.inc + +--error 1 +--exec $INNOCHECKSUM -p 18446744073709551615 $MYSQLD_DATADIR/test/tab1.ibd 2> $SEARCH_FILE +--source include/search_pattern_in_file.inc + +--error 1 +--exec $INNOCHECKSUM --start-page=18446744073709551615 $MYSQLD_DATADIR/test/tab1.ibd 2> $SEARCH_FILE +--source include/search_pattern_in_file.inc + +--error 1 +--exec $INNOCHECKSUM -s 18446744073709551615 $MYSQLD_DATADIR/test/tab1.ibd 2> $SEARCH_FILE +--source include/search_pattern_in_file.inc + +--echo [34]: check the invalid upper bound values for options, allow-mismatches, end-page, start-page and page. +--echo # innochecksum will fail with error code: 1 +--error 1 +--exec $INNOCHECKSUM --allow-mismatches=18446744073709551616 $MYSQLD_DATADIR/test/tab1.ibd 2> $SEARCH_FILE +let SEARCH_PATTERN= Incorrect unsigned integer value: '18446744073709551616'; +--source include/search_pattern_in_file.inc + +--error 1 +--exec $INNOCHECKSUM -a 18446744073709551616 $MYSQLD_DATADIR/test/tab1.ibd 2> $SEARCH_FILE +let SEARCH_PATTERN= Incorrect unsigned integer value: '18446744073709551616'; +--source include/search_pattern_in_file.inc + +--error 1 +--exec $INNOCHECKSUM --end-page=18446744073709551616 $MYSQLD_DATADIR/test/tab1.ibd 2> $SEARCH_FILE +let SEARCH_PATTERN= Incorrect unsigned integer value: '18446744073709551616'; +--source include/search_pattern_in_file.inc + +--error 1 +--exec $INNOCHECKSUM -e 18446744073709551616 $MYSQLD_DATADIR/test/tab1.ibd 2> $SEARCH_FILE +let SEARCH_PATTERN= Incorrect unsigned integer value: '18446744073709551616'; +--source include/search_pattern_in_file.inc + +--error 1 +--exec $INNOCHECKSUM --page=18446744073709551616 $MYSQLD_DATADIR/test/tab1.ibd 2> $SEARCH_FILE +let SEARCH_PATTERN= Incorrect unsigned integer value: '18446744073709551616'; +--source include/search_pattern_in_file.inc + +--error 1 +--exec $INNOCHECKSUM -p 18446744073709551616 $MYSQLD_DATADIR/test/tab1.ibd 2> $SEARCH_FILE +let SEARCH_PATTERN= Incorrect unsigned integer value: '18446744073709551616'; +--source include/search_pattern_in_file.inc + +--error 1 +--exec $INNOCHECKSUM --start-page=18446744073709551616 $MYSQLD_DATADIR/test/tab1.ibd 2> $SEARCH_FILE +let SEARCH_PATTERN= Incorrect unsigned integer value: '18446744073709551616'; +--source include/search_pattern_in_file.inc + +--error 1 +--exec $INNOCHECKSUM -s 18446744073709551616 $MYSQLD_DATADIR/test/tab1.ibd 2> $SEARCH_FILE +let SEARCH_PATTERN= Incorrect unsigned integer value: '18446744073709551616'; +--source include/search_pattern_in_file.inc +--remove_file $SEARCH_FILE + +# Cleanup +--source include/start_mysqld.inc + +DROP TABLE tab1,tab2; |