Skip to content

Commit

Permalink
Remove truncate error log from rocksdb.rocksdb_checksums test
Browse files Browse the repository at this point in the history
Summary:
Restart the test using a new error log instead of truncating the old
error log. Also reduce the number of rows from 10000 to 4000 to speed up
the test.

Reviewed By: asandryh

Differential Revision: D7003203

fbshipit-source-id: 6b830ce
  • Loading branch information
Herman Lee authored and facebook-github-bot committed Feb 16, 2018
1 parent 2a10b62 commit f0cbe47
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 13 deletions.
6 changes: 3 additions & 3 deletions mysql-test/suite/rocksdb/r/rocksdb_checksums.result
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ create table t4 (pk int primary key, a int, b int, key(a), key(b)) engine=rocksd
check table t4;
Table Op Msg_type Msg_text
test.t4 check status OK
10000 index entries had around 500 checksums
10000 index entries had around 500 checksums
Around 500 table records had checksums
4000 index entries had around 200 checksums
4000 index entries had around 200 checksums
Around 200 table records had checksums
set session rocksdb_checksums_pct=100;
#
# Ok, table t2 has all rows with checksums. Simulate a few checksum mismatches.
Expand Down
24 changes: 14 additions & 10 deletions mysql-test/suite/rocksdb/t/rocksdb_checksums.test
Original file line number Diff line number Diff line change
Expand Up @@ -5,32 +5,33 @@
#
--source include/have_debug.inc

--let LOG=$MYSQLTEST_VARDIR/tmp/rocksdb_checksum.err
--let $_mysqld_option=--log-error=$LOG
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--source include/restart_mysqld_with_option.inc

set @save_rocksdb_store_row_debug_checksums=@@global.rocksdb_store_row_debug_checksums;
set @save_rocksdb_verify_row_debug_checksums=@@global.rocksdb_verify_row_debug_checksums;
set @save_rocksdb_checksums_pct=@@global.rocksdb_checksums_pct;

# wiping mysql log for repeatable tests
--exec echo "" > $MYSQLTEST_VARDIR/log/mysqld.1.err

--disable_warnings
drop table if exists t1,t2,t3;
--enable_warnings
-- exec echo "" > $MYSQLTEST_VARDIR/log/mysqld.1.err

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;
--exec grep "^[0-9-]* [0-9:]* [0-9]* \[Note\] CHECKTABLE t1" $MYSQLTEST_VARDIR/log/mysqld.1.err | cut -d] -f2
--exec grep "^[0-9-]* [0-9:]* [0-9]* \[Note\] CHECKTABLE t1" $LOG | cut -d] -f2

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;
insert into t2 values (1,1,1),(2,2,2),(3,3,3);
check table t2;
--exec grep "^[0-9-]* [0-9:]* [0-9]* \[Note\] CHECKTABLE t2" $MYSQLTEST_VARDIR/log/mysqld.1.err | cut -d] -f2
--exec grep "^[0-9-]* [0-9:]* [0-9]* \[Note\] CHECKTABLE t2" $LOG | cut -d] -f2

--echo # 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;
Expand All @@ -39,15 +40,15 @@ 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;
--exec grep "^[0-9-]* [0-9:]* [0-9]* \[Note\] CHECKTABLE t3" $MYSQLTEST_VARDIR/log/mysqld.1.err | cut -d] -f2
--exec grep "^[0-9-]* [0-9:]* [0-9]* \[Note\] CHECKTABLE t3" $LOG | cut -d] -f2

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;
--disable_query_log
let $i=0;
let $x= 100000;
while ($i<10000)
while ($i<4000)
{
inc $i;
eval insert t4(pk,a,b) values($i, $i, $i div 10);
Expand All @@ -56,8 +57,8 @@ while ($i<10000)
}
--enable_query_log
check table t4;
--exec grep "^[0-9-]* [0-9:]* [0-9]* \[Note\] CHECKTABLE t4" $MYSQLTEST_VARDIR/log/mysqld.1.err | cut -d] -f2 > $MYSQL_TMP_DIR/rocksdb_checksums.log
--exec perl suite/rocksdb/t/rocksdb_checksums.pl $MYSQL_TMP_DIR/rocksdb_checksums.log 10000 5
--exec grep "^[0-9-]* [0-9:]* [0-9]* \[Note\] CHECKTABLE t4" $LOG | cut -d] -f2 > $MYSQL_TMP_DIR/rocksdb_checksums.log
--exec perl suite/rocksdb/t/rocksdb_checksums.pl $MYSQL_TMP_DIR/rocksdb_checksums.log 4000 5
--remove_file $MYSQL_TMP_DIR/rocksdb_checksums.log
set session rocksdb_checksums_pct=100;

Expand Down Expand Up @@ -124,4 +125,7 @@ set @@global.rocksdb_store_row_debug_checksums=@save_rocksdb_store_row_debug_che
set @@global.rocksdb_verify_row_debug_checksums=@save_rocksdb_verify_row_debug_checksums;
set @@global.rocksdb_checksums_pct=@save_rocksdb_checksums_pct;

--source include/restart_mysqld.inc
--remove_file $LOG

drop table t2,t3,t4;

0 comments on commit f0cbe47

Please sign in to comment.