Commit 5e4f3af9 authored by Sergei Petrunia's avatar Sergei Petrunia

MyRocks: post-merge fixes part #5: make rocksdb.rocksdb_checksums test pass

parent 3d2c0f61
......@@ -18,6 +18,11 @@
# Optionally, SEARCH_ABORT can be set to "FOUND" or "NOT FOUND" and this
# will abort if the search result doesn't match the requested one.
#
# Optionally, SEARCH_OUTPUT can be set to control the format of output.
# Supported formats:
# - (default) : "FOUND n /pattern/ in FILE " or "NOT FOUND ..."
# - "matches" : Each match is printed, on a separate line
#
# In case of
# - SEARCH_FILE and/or SEARCH_PATTERN is not set
# - SEARCH_FILE cannot be opened
......@@ -75,7 +80,14 @@ perl;
my @matches=($content =~ m/$search_pattern/gs);
my $res=@matches ? "FOUND " . scalar(@matches) : "NOT FOUND";
$ENV{SEARCH_FILE} =~ s{^.*?([^/\\]+)$}{$1};
print "$res /$search_pattern/ in $ENV{SEARCH_FILE}\n";
if ($ENV{SEARCH_OUTPUT} eq "matches") {
foreach (@matches) {
print $_ . "\n";
}
} else {
print "$res /$search_pattern/ in $ENV{SEARCH_FILE}\n";
}
die "$ENV{SEARCH_ABORT}\n"
if $ENV{SEARCH_ABORT} && $res =~ /^$ENV{SEARCH_ABORT}/;
if $ENV{SEARCH_ABORT} && $res =~ /^$ENV{SEARCH_ABORT}/;
EOF
......@@ -11,7 +11,12 @@ insert into t1 values (1,1,1),(2,2,2),(3,3,3);
check table t1;
Table Op Msg_type Msg_text
test.t1 check status OK
FOUND 1 /0 table records had checksums/ in mysqld.1.err
CHECKTABLE t1: Checking table t1
CHECKTABLE t1: Checking index a
CHECKTABLE t1: ... 3 index entries checked (0 had checksums)
CHECKTABLE t1: Checking index b
CHECKTABLE t1: ... 3 index entries checked (0 had checksums)
CHECKTABLE t1: 0 table records had checksums
drop table t1;
set session rocksdb_store_row_debug_checksums=on;
create table t2 (pk int primary key, a int, b int, key(a), key(b)) engine=rocksdb;
......@@ -19,7 +24,12 @@ insert into t2 values (1,1,1),(2,2,2),(3,3,3);
check table t2;
Table Op Msg_type Msg_text
test.t2 check status OK
FOUND 1 /3 table records had checksums/ in mysqld.1.err
CHECKTABLE t2: Checking table t2
CHECKTABLE t2: Checking index a
CHECKTABLE t2: ... 3 index entries checked (3 had checksums)
CHECKTABLE t2: Checking index b
CHECKTABLE t2: ... 3 index entries checked (3 had checksums)
CHECKTABLE t2: 3 table records had checksums
# Now, make a table that has both rows with checksums and without
create table t3 (pk int primary key, a int, b int, key(a), key(b)) engine=rocksdb;
insert into t3 values (1,1,1),(2,2,2),(3,3,3);
......@@ -29,7 +39,12 @@ set session rocksdb_store_row_debug_checksums=on;
check table t3;
Table Op Msg_type Msg_text
test.t3 check status OK
FOUND 1 /2 table records had checksums/ in mysqld.1.err
CHECKTABLE t3: Checking table t3
CHECKTABLE t3: Checking index a
CHECKTABLE t3: ... 3 index entries checked (3 had checksums)
CHECKTABLE t3: Checking index b
CHECKTABLE t3: ... 3 index entries checked (2 had checksums)
CHECKTABLE t3: 2 table records had checksums
set session rocksdb_store_row_debug_checksums=on;
set session rocksdb_checksums_pct=5;
create table t4 (pk int primary key, a int, b int, key(a), key(b)) engine=rocksdb;
......
......@@ -19,8 +19,10 @@ show variables like 'rocksdb_%checksum%';
create table t1 (pk int primary key, a int, b int, key(a), key(b)) engine=rocksdb;
insert into t1 values (1,1,1),(2,2,2),(3,3,3);
check table t1;
--let SEARCH_FILE=$MYSQLTEST_VARDIR/log/mysqld.1.err
--let SEARCH_FILE=$LOG
--let SEARCH_PATTERN=0 table records had checksums
--let SEARCH_PATTERN=CHECKTABLE t1[^\n]*
--let SEARCH_OUTPUT=matches
--source include/search_pattern_in_file.inc
drop table t1;
......@@ -29,7 +31,7 @@ set session rocksdb_store_row_debug_checksums=on;
create table t2 (pk int primary key, a int, b int, key(a), key(b)) engine=rocksdb;
insert into t2 values (1,1,1),(2,2,2),(3,3,3);
check table t2;
--let SEARCH_PATTERN=3 table records had checksums
--let SEARCH_PATTERN=CHECKTABLE t2[^\n]*
--source include/search_pattern_in_file.inc
--echo # Now, make a table that has both rows with checksums and without
......@@ -39,7 +41,7 @@ set session rocksdb_store_row_debug_checksums=off;
update t3 set b=3 where a=2;
set session rocksdb_store_row_debug_checksums=on;
check table t3;
--let SEARCH_PATTERN=2 table records had checksums
--let SEARCH_PATTERN=CHECKTABLE t3[^\n]*
--source include/search_pattern_in_file.inc
set session rocksdb_store_row_debug_checksums=on;
......@@ -58,11 +60,12 @@ while ($i<4000)
--enable_query_log
check table t4;
perl;
$total=10000;
$total=4000;
$pct=5;
@out=();
$filename= "$ENV{MYSQLTEST_VARDIR}/log/mysqld.1.err";
$filename= "$ENV{LOG}";
print $filename "\n";
open(F, '<', $filename) || die("Can't open file $filename: $!");
while(<F>) {
@out=() if /^CURRENT_TEST:/;
......@@ -144,6 +147,6 @@ set @@global.rocksdb_verify_row_debug_checksums=@save_rocksdb_verify_row_debug_c
set @@global.rocksdb_checksums_pct=@save_rocksdb_checksums_pct;
--source include/restart_mysqld.inc
--remove_file $LOG
#--remove_file $LOG
drop table t2,t3,t4;
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment