| 1 |
#************************************************************ |
| 2 |
# WL6045:Improve Innochecksum |
| 3 |
#************************************************************ |
| 4 |
--source include/have_innodb_max_16k.inc |
| 5 |
|
| 6 |
-- source include/big_test.inc |
| 7 |
|
| 8 |
--disable_query_log |
| 9 |
# This warning occurs due to small buffer pool size(i.e. 8MB). It doesn't occur |
| 10 |
# with --mysqld=--innodb_buffer_pool_size=10MB |
| 11 |
call mtr.add_suppression("\\[Warning\\] .*MY-\\d+.* Difficult to find free blocks in the buffer pool.*"); |
| 12 |
--enable_query_log |
| 13 |
let MYSQLD_BASEDIR= `SELECT @@basedir`; |
| 14 |
let MYSQLD_DATADIR= `SELECT @@datadir`; |
| 15 |
let SEARCH_FILE= $MYSQLTEST_VARDIR/log/my_restart.err; |
| 16 |
|
| 17 |
SET GLOBAL innodb_compression_level=0; |
| 18 |
SELECT @@innodb_compression_level; |
| 19 |
|
| 20 |
CREATE TABLE t1 (j LONGBLOB) ENGINE = InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1; |
| 21 |
INSERT INTO t1 VALUES (repeat('abcdefghijklmnopqrstuvwxyz',200)); |
| 22 |
let $i=10; |
| 23 |
while ($i > 0) { |
| 24 |
INSERT INTO t1 SELECT * from t1; |
| 25 |
dec $i; |
| 26 |
} |
| 27 |
|
| 28 |
--echo # stop the server |
| 29 |
--source include/shutdown_mysqld.inc |
| 30 |
|
| 31 |
# Page_type_dump for t1 |
| 32 |
--exec $INNOCHECKSUM -v --page-type-dump $MYSQLTEST_VARDIR/tmp/dump.txt $MYSQLD_DATADIR/test/t1.ibd |
| 33 |
--file_exists $MYSQLTEST_VARDIR/tmp/dump.txt |
| 34 |
--remove_file $MYSQLTEST_VARDIR/tmp/dump.txt |
| 35 |
|
| 36 |
--echo [1]:# check the both short and long options for "help" |
| 37 |
--exec $INNOCHECKSUM --help $MYSQLD_DATADIR/test/t1.ibd > $MYSQLTEST_VARDIR/tmp/help_output_long.txt |
| 38 |
--exec $INNOCHECKSUM -I $MYSQLD_DATADIR/test/t1.ibd > $MYSQLTEST_VARDIR/tmp/help_output_short.txt |
| 39 |
--diff_files $MYSQLTEST_VARDIR/tmp/help_output_long.txt $MYSQLTEST_VARDIR/tmp/help_output_short.txt |
| 40 |
|
| 41 |
--echo [2]:# Run the innochecksum when file isn't provided. |
| 42 |
--echo # It will print the innochecksum usage similar to --help option. |
| 43 |
--error 1 |
| 44 |
--exec $INNOCHECKSUM > $MYSQLTEST_VARDIR/tmp/usage.txt |
| 45 |
--diff_files $MYSQLTEST_VARDIR/tmp/help_output_long.txt $MYSQLTEST_VARDIR/tmp/usage.txt |
| 46 |
--remove_file $MYSQLTEST_VARDIR/tmp/usage.txt |
| 47 |
|
| 48 |
perl; |
| 49 |
use strict; |
| 50 |
use warnings; |
| 51 |
use File::Copy; |
| 52 |
my $dir = $ENV{'MYSQLTEST_VARDIR'}; |
| 53 |
my $file= 'help_output_long.txt'; |
| 54 |
# open file in write mode |
| 55 |
open IN_FILE,"<", "$dir/tmp/$file" or die $!; |
| 56 |
open OUT_FILE, ">", "$dir/tmp/tmpfile" or die $!; |
| 57 |
while(<IN_FILE>) { |
| 58 |
unless ($_=~ /^debug.*$/ || $_=~ /\-#, \-\-debug.*$/ || $_=~ /http:.*html/) { |
| 59 |
$_=~ s/^\S*innochecksum.+Ver.+[0-9]*\.[0-9]*\.[0-9]*.+$/innochecksum Ver #.#.#/g; |
| 60 |
$_=~ s/(Copyright\s\(c\))\s([0-9]*),\s([0-9]*)(.*)/$1 YEAR, YEAR $4/g; |
| 61 |
$_=~ s/Usage:.*\[-c/Usage: innochecksum [-c/g; |
| 62 |
print OUT_FILE $_; |
| 63 |
} |
| 64 |
} |
| 65 |
close(IN_FILE); |
| 66 |
close(OUT_FILE); |
| 67 |
# move the new content from tmp file to the orginal file. |
| 68 |
move ("$dir/tmp/tmpfile", "$dir/tmp/$file"); |
| 69 |
EOF |
| 70 |
|
| 71 |
--cat_file $MYSQLTEST_VARDIR/tmp/help_output_long.txt |
| 72 |
--remove_file $MYSQLTEST_VARDIR/tmp/help_output_long.txt |
| 73 |
--remove_file $MYSQLTEST_VARDIR/tmp/help_output_short.txt |
| 74 |
|
| 75 |
--echo [3]:# check the both short and long options for "count" and exit |
| 76 |
--replace_regex /[0-9]+/#/ |
| 77 |
--exec $INNOCHECKSUM --count $MYSQLD_DATADIR/test/t1.ibd |
| 78 |
--replace_regex /[0-9]+/#/ |
| 79 |
--exec $INNOCHECKSUM -c $MYSQLD_DATADIR/test/t1.ibd |
| 80 |
|
| 81 |
--echo [4]:# Print the version of innochecksum and exit |
| 82 |
--replace_regex /.*innochecksum.*Ver.*[0-9]*.[0-9]*.[0-9]*.*/innochecksum Ver #.#.#/ |
| 83 |
--exec $INNOCHECKSUM -V $MYSQLD_DATADIR/test/t1.ibd |
| 84 |
|
| 85 |
--echo # Restart the DB server |
| 86 |
--source include/start_mysqld.inc |
| 87 |
|
| 88 |
DROP TABLE t1; |
| 89 |
|
| 90 |
--echo [5]:# Check the innochecksum for compressed table t1 with different key_block_size |
| 91 |
--echo # Test for KEY_BLOCK_SIZE=1 |
| 92 |
--let $size=1 |
| 93 |
--source ../include/innodb-wl6045.inc |
| 94 |
|
| 95 |
--echo # Test for KEY_BLOCK_SIZE=2 |
| 96 |
--let $size=2 |
| 97 |
--source ../include/innodb-wl6045.inc |
| 98 |
|
| 99 |
--echo # Test for for KEY_BLOCK_SIZE=4 |
| 100 |
--let $size=4 |
| 101 |
--source ../include/innodb-wl6045.inc |
| 102 |
|
| 103 |
set innodb_strict_mode=off; |
| 104 |
--echo # Test for for KEY_BLOCK_SIZE=8 |
| 105 |
--let $size=8 |
| 106 |
--source ../include/innodb-wl6045.inc |
| 107 |
|
| 108 |
set innodb_strict_mode=off; |
| 109 |
--echo # Test for KEY_BLOCK_SIZE=16 |
| 110 |
--let $size=16 |
| 111 |
--source ../include/innodb-wl6045.inc |
| 112 |
--echo # Test[5] completed |