revision-id: 5e4f3af9b7b7ad46dae09d5020f9147cadffc14e parent(s): 3d2c0f61e71adb80b914e9b87e57be90cb881def committer: Sergei Petrunia branch nick: 10.2-mariarocks-merge timestamp: 2018-08-29 17:25:58 +0300 message: MyRocks: post-merge fixes part #5: make rocksdb.rocksdb_checksums test pass --- mysql-test/include/search_pattern_in_file.inc | 16 ++++++++++++++-- .../mysql-test/rocksdb/r/rocksdb_checksums.result | 21 ++++++++++++++++++--- .../mysql-test/rocksdb/t/rocksdb_checksums.test | 15 +++++++++------ 3 files changed, 41 insertions(+), 11 deletions(-) diff --git a/mysql-test/include/search_pattern_in_file.inc b/mysql-test/include/search_pattern_in_file.inc index 21192b5..6bead62 100644 --- a/mysql-test/include/search_pattern_in_file.inc +++ b/mysql-test/include/search_pattern_in_file.inc @@ -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 diff --git a/storage/rocksdb/mysql-test/rocksdb/r/rocksdb_checksums.result b/storage/rocksdb/mysql-test/rocksdb/r/rocksdb_checksums.result index 17ddb6f..505487c 100644 --- a/storage/rocksdb/mysql-test/rocksdb/r/rocksdb_checksums.result +++ b/storage/rocksdb/mysql-test/rocksdb/r/rocksdb_checksums.result @@ -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; diff --git a/storage/rocksdb/mysql-test/rocksdb/t/rocksdb_checksums.test b/storage/rocksdb/mysql-test/rocksdb/t/rocksdb_checksums.test index 99dbc42..42a4c83 100644 --- a/storage/rocksdb/mysql-test/rocksdb/t/rocksdb_checksums.test +++ b/storage/rocksdb/mysql-test/rocksdb/t/rocksdb_checksums.test @@ -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;