config root man

Current Path : /home/usr.opt/mysql57/mysql-test/suite/innodb/t/

FreeBSD hs32.drive.ne.jp 9.1-RELEASE FreeBSD 9.1-RELEASE #1: Wed Jan 14 12:18:08 JST 2015 root@hs32.drive.ne.jp:/sys/amd64/compile/hs32 amd64
Upload File :
Current File : /home/usr.opt/mysql57/mysql-test/suite/innodb/t/innodb-wl6045-linux.test

#************************************************************
# WL6045:Improve Innochecksum
# Test Case [1] Check the innochecksum tool when read from stdin and without any rewrite of checksum.
# Test Case [2] Check the innochecksum tool when read from stdin and rewrite to "crc32" checksum.
# Test Case [3] Check the innochecksum tool when read from stdin and rewrite to "none" checksum 
#               and page-type-summary output.
# Test Case [4] Check the innochecksum tool when read from stdin and rewrite to "innodb" checksum.
# Test Case [5] Test for lock: As mysqld is running, & then start the innochecksum which must fail.
#************************************************************

--source include/have_innodb.inc
--source include/not_windows.inc

# Valgrind would complain about memory leaks when we crash on purpose.
--source include/not_valgrind.inc

# Embedded server does not support crashing.
--source include/not_embedded.inc

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

let MYSQLD_BASEDIR= `SELECT @@basedir`;
let MYSQLD_DATADIR= `SELECT @@datadir`;
let SEARCH_FILE= $MYSQLTEST_VARDIR/log/my_restart.err;

SET GLOBAL innodb_file_per_table=on;

SHOW variables like '%innodb_checksum_algorithm%';
# Disable compression for this table
CREATE TABLE t1(c1 INT PRIMARY KEY,c2 VARCHAR(20)) COMPRESSION="none", ENGINE=InnoDB;
INSERT INTO t1 VALUES(1, 'Innochecksum InnoDB');
INSERT INTO t1 VALUES(2, 'Innochecksum CRC32');

--echo # Shutdown the Server
--source include/shutdown_mysqld.inc

# Test cases for read from standard input for innochecksum tool
--echo # Test[1(a)]: for read from standard input for innochecksum tool without rewrite of checksum with log option.
perl;
use strict;
use warnings;
my $innochecksum = $ENV{'INNOCHECKSUM'};
my $mysqltest_vardir= $ENV{'MYSQLTEST_VARDIR'};
my $mysqld_datadir= $ENV{'MYSQLD_DATADIR'};
exec("cat $mysqld_datadir/test/t1.ibd | $innochecksum --log='$mysqltest_vardir/tmp/mtrchecksum.log' -");
EOF

perl;
use strict;
use warnings;
use File::Copy;
my $dir = $ENV{'MYSQLTEST_VARDIR'};
my $file= 'mtrchecksum.log';
# open file in write mode
open IN_FILE,"<", "$dir/tmp/$file" or die $! ;
open OUT_FILE, ">", "$dir/tmp/tmpfile" or die $! ;
while(<IN_FILE>) {
 # Replace all intergers to #
 $_=~ s/\d+/#/g;
 $_=~ s/crc#/crc32/g;
 $_=~ s/Filename =.+/Filename = -/g;
 print OUT_FILE $_;
}
close(IN_FILE);
close(OUT_FILE);
#move the new content from tmp file to the orginal file.
move ("$dir/tmp/tmpfile", "$dir/tmp/$file");
EOF

# Print the information for log option.
cat_file $MYSQLTEST_VARDIR/tmp/mtrchecksum.log;
--remove_file $MYSQLTEST_VARDIR/tmp/mtrchecksum.log

--echo # Test[1(b)]: for read from standard input for innochecksum tool Test checking for page: 3 to page:5
perl;
use strict;
use warnings;
my $innochecksum = $ENV{'INNOCHECKSUM'};
my $mysqltest_vardir= $ENV{'MYSQLTEST_VARDIR'};
my $mysqld_datadir= $ENV{'MYSQLD_DATADIR'};
exec("cat $mysqld_datadir/test/t1.ibd | $innochecksum --log='$mysqltest_vardir/tmp/mtrchecksum.log' -s 3 -e 5 -");
EOF

perl;
use strict;
use warnings;
use File::Copy;
my $dir = $ENV{'MYSQLTEST_VARDIR'};
my $file= 'mtrchecksum.log';
# open file in write mode
open IN_FILE,"<", "$dir/tmp/$file" or die $! ;
open OUT_FILE, ">", "$dir/tmp/tmpfile" or die $! ;
while(<IN_FILE>) {
 # Replace all intergers to #
 $_=~ s/\d+/#/g;
 $_=~ s/crc#/crc32/g;
 $_=~ s/Filename =.+/Filename = -/g;
 $_=~ s/file .+ =/file - =/g;
 print OUT_FILE $_;
}
close(IN_FILE);
close(OUT_FILE);
#move the new content from tmp file to the orginal file.
move ("$dir/tmp/tmpfile", "$dir/tmp/$file");
EOF

# Print the information for log option.
cat_file $MYSQLTEST_VARDIR/tmp/mtrchecksum.log;
--remove_file $MYSQLTEST_VARDIR/tmp/mtrchecksum.log

--echo # Test[1] End
--echo # Test [2] for read from standard input for innochecksum tool with rewrite of crc32 checksum.
let t1_IBD = $MYSQLD_DATADIR/test/t1.ibd;
--echo # Backup the t1.ibd before any rewrite of checksum, so used for further testing.
--copy_file $t1_IBD $MYSQLD_DATADIR/test/t1.ibd.backup

perl;
use strict;
use warnings;
my $innochecksum = $ENV{'INNOCHECKSUM'};
my $mysqltest_vardir= $ENV{'MYSQLTEST_VARDIR'};
my $mysqld_datadir= $ENV{'MYSQLD_DATADIR'};
exec("cat $mysqld_datadir/test/t1.ibd | $innochecksum --log='$mysqltest_vardir/tmp/mtrchecksum.log' --write=crc32 - > $mysqltest_vardir/tmp/a.ibd");
EOF

perl;
use strict;
use warnings;
use File::Copy;
my $dir = $ENV{'MYSQLTEST_VARDIR'};
my $file= 'mtrchecksum.log';
# open file in write mode
open IN_FILE,"<", "$dir/tmp/$file" or die $!;
open OUT_FILE, ">", "$dir/tmp/tmpfile" or die $!;
while(<IN_FILE>) {
 # Replace all intergers to #
 $_=~ s/\d+/#/g;
 $_=~ s/crc#/crc32/g;
 $_=~ s/Filename =.+/Filename = -/g;
 $_=~ s/file .+ =/file t1.ibd =/g;
 print OUT_FILE $_;
}
close(IN_FILE);
close(OUT_FILE);
# move the new content from tmp file to the orginal file.
move ("$dir/tmp/tmpfile", "$dir/tmp/$file");
EOF
--echo # Print the information for log option.
cat_file $MYSQLTEST_VARDIR/tmp/mtrchecksum.log;
--remove_file $MYSQLTEST_VARDIR/tmp/mtrchecksum.log

--echo # Recheck the a.ibd created file having crc32 checksum with the --strict-check=crc32 for innochecksum tool.
--exec $INNOCHECKSUM --log="$MYSQLTEST_VARDIR/tmp/mtrchecksum.log" --strict-check=crc32 $MYSQLTEST_VARDIR/tmp/a.ibd

perl;
use strict;
use warnings;
use File::Copy;
my $dir = $ENV{'MYSQLTEST_VARDIR'};
my $file= 'mtrchecksum.log';
# open file in write mode
open IN_FILE,"<", "$dir/tmp/$file" or die $!;
open OUT_FILE, ">", "$dir/tmp/tmpfile" or die $!;
while(<IN_FILE>) {
 # Replace all intergers to #
 $_=~ s/\d+/#/g;
 $_=~ s/crc#/crc32/g;
 $_=~ s/Filename =.+/Filename = a.ibd/g;
 $_=~ s/file .+ =/file t1.ibd =/g;
 print OUT_FILE $_;
}
close(IN_FILE);
close(OUT_FILE);
# move the new content from tmp file to the orginal file.
move ("$dir/tmp/tmpfile", "$dir/tmp/$file");
EOF

# Print the information for log option.
cat_file $MYSQLTEST_VARDIR/tmp/mtrchecksum.log;
--remove_file $MYSQLTEST_VARDIR/tmp/mtrchecksum.log

--echo #Replace the t.ibd with the newly created a.ibd having crc32 checksum.
--remove_file $MYSQLD_DATADIR/test/t1.ibd
--copy_file $MYSQLTEST_VARDIR/tmp/a.ibd $MYSQLD_DATADIR/test/t1.ibd
--remove_file $MYSQLTEST_VARDIR/tmp/a.ibd

--echo # Start the server to validate the t1.ibd having crc32 checksum.
--source include/start_mysqld.inc

select * from t1;

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

--echo # Test[2] End
--echo # Test[3] for read from standard input for innochecksum tool with rewrite of "none" checksum.

--echo # Retrieve the original t1.ibd before any rewrite of checksum, so used for further testing.
--remove_file $t1_IBD
--copy_file $MYSQLD_DATADIR/test/t1.ibd.backup $t1_IBD

--echo # Check for innochecksum tool to read from stdin and rewrite the checksum to "none"
--echo # along with check for --verbose & --page-type-summary
perl;
use strict;
use warnings;
my $innochecksum = $ENV{'INNOCHECKSUM'};
my $vardir= $ENV{'MYSQLTEST_VARDIR'};
my $mysqld_datadir= $ENV{'MYSQLD_DATADIR'};
exec("cat $mysqld_datadir/test/t1.ibd | $innochecksum -v -S --log='$vardir/tmp/mtrchecksum.log' --write=none - > $vardir/tmp/a.ibd 2>$vardir/tmp/veroutput");
EOF

perl;
use strict;
use warnings;
use File::Copy;
my $dir = $ENV{'MYSQLTEST_VARDIR'};
my $file= 'mtrchecksum.log';
# open file in write mode
open IN_FILE,"<", "$dir/tmp/$file" or die $!;
open OUT_FILE, ">", "$dir/tmp/tmpfile" or die $!;
while(<IN_FILE>) {
 # Replace all intergers to #
 $_=~ s/\d+/#/g;
 $_=~ s/crc#/crc32/g;
 $_=~ s/Filename =.+/Filename = -/g;
 $_=~ s/file .+ =/file - =/g;;
 print OUT_FILE $_;
}
close(IN_FILE);
close(OUT_FILE);
# move the new content from tmp file to the orginal file.
move ("$dir/tmp/tmpfile", "$dir/tmp/$file");

$file= 'veroutput';
# open file in write mode
open IN_FILE,"<", "$dir/tmp/$file" or die $!;
open OUT_FILE, ">", "$dir/tmp/tmpfile" or die $!;
while(<IN_FILE>) {
  unless ($_=~ /^debug.*$/) {
    # Replace all intergers to #
    $_=~ s/\d+/#/g;
    $_=~ s/log(\s+)(.*log)/log$1mtrchecksum.log/g;
    print OUT_FILE $_;
  }
}
close(IN_FILE);
close(OUT_FILE);
# move the new content from tmp file to the orginal file.
move ("$dir/tmp/tmpfile", "$dir/tmp/$file");
EOF
--echo # Print the content for --verbose and --page-type-summary
cat_file $MYSQLTEST_VARDIR/tmp/veroutput;
--remove_file $MYSQLTEST_VARDIR/tmp/veroutput

--echo # Print the information for log option.
cat_file $MYSQLTEST_VARDIR/tmp/mtrchecksum.log;
--remove_file $MYSQLTEST_VARDIR/tmp/mtrchecksum.log

--echo # Recheck the a.ibd created file having crc32 checksum with the --strict-check=none for innochecksum tool.
--exec $INNOCHECKSUM --log="$MYSQLTEST_VARDIR/tmp/mtrchecksum.log" --strict-check=none $MYSQLTEST_VARDIR/tmp/a.ibd

perl;
use strict;
use warnings;
use File::Copy;
my $dir = $ENV{'MYSQLTEST_VARDIR'};
my $file= 'mtrchecksum.log';
# open file in write mode
open IN_FILE,"<", "$dir/tmp/$file" or die $!;
open OUT_FILE, ">", "$dir/tmp/tmpfile" or die $!;
while(<IN_FILE>) {
 # Replace all intergers to #
 $_=~ s/\d+/#/g;
 $_=~ s/crc#/crc32/g;
 $_=~ s/Filename =.+/Filename = a.ibd/g;
 $_=~ s/file .+ =/file t1.ibd =/g;
 print OUT_FILE $_;
}
close(IN_FILE);
close(OUT_FILE);
# move the new content from tmp file to the orginal file.
move ("$dir/tmp/tmpfile", "$dir/tmp/$file");
EOF

# Print the information for log option.
cat_file $MYSQLTEST_VARDIR/tmp/mtrchecksum.log;
--remove_file $MYSQLTEST_VARDIR/tmp/mtrchecksum.log

# Replace the t.ibd with the newly created a.ibd having "none" checksum.
--remove_file $MYSQLD_DATADIR/test/t1.ibd
--copy_file $MYSQLTEST_VARDIR/tmp/a.ibd $MYSQLD_DATADIR/test/t1.ibd
--remove_file $MYSQLTEST_VARDIR/tmp/a.ibd

--echo # Start the server to validate the t1.ibd having "none" checksum.
--source include/start_mysqld.inc

select * from t1;

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

--echo # Test[3] End

--echo # Test[4] for read from standard input for innochecksum tool with rewrite of "innodb" checksum.
# Retrieve the original t1.ibd before any rewrite of checksum.
--remove_file $t1_IBD
--copy_file $MYSQLD_DATADIR/test/t1.ibd.backup $t1_IBD

--echo # Command for innochecksum tool to read from stdin and rewrite the checksum to "innodb"
perl;
use strict;
use warnings;
my $innochecksum = $ENV{'INNOCHECKSUM'};
my $mysqltest_vardir= $ENV{'MYSQLTEST_VARDIR'};
my $mysqld_datadir= $ENV{'MYSQLD_DATADIR'};
exec("cat $mysqld_datadir/test/t1.ibd | $innochecksum --log='$mysqltest_vardir/tmp/mtrchecksum.log' --write=innodb - > $mysqltest_vardir/tmp/a.ibd");
EOF

perl;
use strict;
use warnings;
use File::Copy;
my $dir = $ENV{'MYSQLTEST_VARDIR'};
my $file= 'mtrchecksum.log';
# open file in write mode
open IN_FILE,"<", "$dir/tmp/$file" or die $!;
open OUT_FILE, ">", "$dir/tmp/tmpfile" or die $!;
while(<IN_FILE>) {
 # Replace all intergers to #
 $_=~ s/\d+/#/g;
 $_=~ s/crc#/crc32/g;
 $_=~ s/Filename =.+/Filename = -/g;
 $_=~ s/file .+ =/file - =/g;
 print OUT_FILE $_;
}
close(IN_FILE);
close(OUT_FILE);
# move the new content from tmp file to the orginal file.
move ("$dir/tmp/tmpfile", "$dir/tmp/$file");
EOF
--echo # Print the information for log option.
cat_file $MYSQLTEST_VARDIR/tmp/mtrchecksum.log;
--remove_file $MYSQLTEST_VARDIR/tmp/mtrchecksum.log

--echo # Recheck the a.ibd created file having crc32 checksum with the --strict-check=innodb for innochecksum tool.
--exec $INNOCHECKSUM --log="$MYSQLTEST_VARDIR/tmp/mtrchecksum.log" --strict-check=innodb $MYSQLTEST_VARDIR/tmp/a.ibd

perl;
use strict;
use warnings;
use File::Copy;
my $dir = $ENV{'MYSQLTEST_VARDIR'};
my $file= 'mtrchecksum.log';
# open file in write mode
open IN_FILE,"<", "$dir/tmp/$file" or die $!;
open OUT_FILE, ">", "$dir/tmp/tmpfile" or die $!;
while(<IN_FILE>) {
 # Replace all intergers to #
 $_=~ s/\d+/#/g;
 $_=~ s/crc#/crc32/g;
 $_=~ s/Filename =.+/Filename = a.ibd/g;
 $_=~ s/file .+ =/file t1.ibd =/g;
 print OUT_FILE $_;
}
close(IN_FILE);
close(OUT_FILE);
# move the new content from tmp file to the orginal file.
move ("$dir/tmp/tmpfile", "$dir/tmp/$file");
EOF

# Print the information for log option.
cat_file $MYSQLTEST_VARDIR/tmp/mtrchecksum.log;
--remove_file $MYSQLTEST_VARDIR/tmp/mtrchecksum.log

--echo # Replace the t.ibd with the newly created a.ibd having "innodb" checksum.
--remove_file $MYSQLD_DATADIR/test/t1.ibd
--copy_file $MYSQLTEST_VARDIR/tmp/a.ibd $MYSQLD_DATADIR/test/t1.ibd
--remove_file $MYSQLTEST_VARDIR/tmp/a.ibd

--echo # Start the server to validate the t1.ibd having "innodb" checksum.
--source include/start_mysqld.inc

select * from t1;

--echo # Test[4] End
--remove_file $MYSQLD_DATADIR/test/t1.ibd.backup

--echo # Test[5] for lock.
--echo # Test Scenario: As mysqld is running, & then start the innochecksum which must fail.

--error 1
--exec $INNOCHECKSUM $MYSQLD_DATADIR/test/t1.ibd 2> $SEARCH_FILE
let SEARCH_PATTERN=Error: Unable to lock file:: $MYSQLD_DATADIR/test/t1.ibd;
--source include/search_pattern_in_file.inc

let SEARCH_PATTERN=fcntl: Resource temporarily unavailable;
--source include/search_pattern_in_file.inc
--remove_file $SEARCH_FILE

--echo # Test[5] end
# cleanup
DROP TABLE t1;

Man Man