Commit 16a99c5a authored by Sergei Golubchik's avatar Sergei Golubchik

MariaRocks tests: various cleanups

remove hard-coded paths (that assumed we're in a source tree)
remove various shell/perl/awk/whatsnot scripts, use mysqltest and perl
remove numerous --exec /some/unix/tool commands, use mysqltest and perl
parent b2865a43
#!/usr/bin/perl
die unless($ARGV[0]);
open(my $f, "<", $ARGV[0]) or die $!;
my @sst;
while(my $l = readline($f)) {
chomp($l);
push @sst, int($l);
}
for(my $i= 0; $i < $#sst; $i++) {
printf("checking sst file reduction on optimize table from %d to %d..\n", $i, $i+1);
if($sst[$i] - 1000 < $sst[$i+1]) {
printf("sst file reduction was not enough. %d->%d (minimum 1000kb)\n", $sst[$i], $sst[$i+1]);
die;
}else {
print "ok.\n";
}
}
exit(0);
...@@ -7,13 +7,7 @@ CREATE PROCEDURE bloom_end() ...@@ -7,13 +7,7 @@ CREATE PROCEDURE bloom_end()
BEGIN BEGIN
select case when variable_value-@c > 0 then 'true' else 'false' end as checked from information_schema.global_status where variable_name='rocksdb_bloom_filter_prefix_checked'; select case when variable_value-@c > 0 then 'true' else 'false' end as checked from information_schema.global_status where variable_name='rocksdb_bloom_filter_prefix_checked';
END// END//
drop table if exists t1; create or replace table t1 (
Warnings:
Note 1051 Unknown table 'test.t1'
drop table if exists t2;
Warnings:
Note 1051 Unknown table 'test.t2'
create table t1 (
id1 bigint not null, id1 bigint not null,
id2 bigint not null, id2 bigint not null,
id3 varchar(100) not null, id3 varchar(100) not null,
...@@ -21,15 +15,15 @@ id4 int not null, ...@@ -21,15 +15,15 @@ id4 int not null,
id5 int not null, id5 int not null,
value bigint, value bigint,
value2 varchar(100), value2 varchar(100),
primary key (id1, id2, id3, id4), primary key (id1, id2, id3, id4) ,
index id2 (id2), index id2 (id2) ,
index id2_id1 (id2, id1), index id2_id1 (id2, id1) ,
index id2_id3 (id2, id3), index id2_id3 (id2, id3) ,
index id2_id4 (id2, id4), index id2_id4 (id2, id4) ,
index id2_id3_id1_id4 (id2, id3, id1, id4), index id2_id3_id1_id4 (id2, id3, id1, id4) ,
index id3_id2 (id3, id2) index id3_id2 (id3, id2)
) engine=ROCKSDB; ) engine=ROCKSDB;
create table t2 ( create or replace table t2 (
id1 bigint not null, id1 bigint not null,
id2 bigint not null, id2 bigint not null,
id3 varchar(100) not null, id3 varchar(100) not null,
...@@ -37,14 +31,18 @@ id4 int not null, ...@@ -37,14 +31,18 @@ id4 int not null,
id5 int not null, id5 int not null,
value bigint, value bigint,
value2 varchar(100), value2 varchar(100),
primary key (id4), primary key (id4) ,
index id2 (id2), index id2 (id2) ,
index id2_id3 (id2, id3), index id2_id3 (id2, id3) ,
index id2_id4 (id2, id4), index id2_id4 (id2, id4) ,
index id2_id4_id5 (id2, id4, id5), index id2_id4_id5 (id2, id4, id5) ,
index id3_id4 (id3, id4), index id3_id4 (id3, id4) ,
index id3_id5 (id3, id5) index id3_id5 (id3, id5)
) engine=ROCKSDB; ) engine=ROCKSDB;
insert t1
select (seq+9) div 10, (seq+4) div 5, (seq+4) div 5, seq, seq, 1000, "aaabbbccc"
from seq_1_to_10000;
insert t2 select * from t1;
call bloom_start(); call bloom_start();
select count(*) from t1; select count(*) from t1;
count(*) count(*)
...@@ -409,9 +407,7 @@ count(*) ...@@ -409,9 +407,7 @@ count(*)
call bloom_end(); call bloom_end();
checked checked
false false
drop table if exists t1; create or replace table t1 (
drop table if exists t2;
create table t1 (
id1 bigint not null, id1 bigint not null,
id2 bigint not null, id2 bigint not null,
id3 varchar(100) not null, id3 varchar(100) not null,
...@@ -427,7 +423,7 @@ index id2_id4 (id2, id4) COMMENT 'cf_short_prefix', ...@@ -427,7 +423,7 @@ index id2_id4 (id2, id4) COMMENT 'cf_short_prefix',
index id2_id3_id1_id4 (id2, id3, id1, id4) COMMENT 'cf_short_prefix', index id2_id3_id1_id4 (id2, id3, id1, id4) COMMENT 'cf_short_prefix',
index id3_id2 (id3, id2) COMMENT 'cf_short_prefix' index id3_id2 (id3, id2) COMMENT 'cf_short_prefix'
) engine=ROCKSDB; ) engine=ROCKSDB;
create table t2 ( create or replace table t2 (
id1 bigint not null, id1 bigint not null,
id2 bigint not null, id2 bigint not null,
id3 varchar(100) not null, id3 varchar(100) not null,
...@@ -443,6 +439,10 @@ index id2_id4_id5 (id2, id4, id5) COMMENT 'cf_short_prefix', ...@@ -443,6 +439,10 @@ index id2_id4_id5 (id2, id4, id5) COMMENT 'cf_short_prefix',
index id3_id4 (id3, id4) COMMENT 'cf_short_prefix', index id3_id4 (id3, id4) COMMENT 'cf_short_prefix',
index id3_id5 (id3, id5) COMMENT 'cf_short_prefix' index id3_id5 (id3, id5) COMMENT 'cf_short_prefix'
) engine=ROCKSDB; ) engine=ROCKSDB;
insert t1
select (seq+9) div 10, (seq+4) div 5, (seq+4) div 5, seq, seq, 1000, "aaabbbccc"
from seq_1_to_10000;
insert t2 select * from t1;
call bloom_start(); call bloom_start();
select count(*) from t1; select count(*) from t1;
count(*) count(*)
...@@ -807,9 +807,7 @@ count(*) ...@@ -807,9 +807,7 @@ count(*)
call bloom_end(); call bloom_end();
checked checked
true true
drop table if exists t1; create or replace table t1 (
drop table if exists t2;
create table t1 (
id1 bigint not null, id1 bigint not null,
id2 bigint not null, id2 bigint not null,
id3 varchar(100) not null, id3 varchar(100) not null,
...@@ -825,7 +823,7 @@ index id2_id4 (id2, id4) COMMENT 'cf_long_prefix', ...@@ -825,7 +823,7 @@ index id2_id4 (id2, id4) COMMENT 'cf_long_prefix',
index id2_id3_id1_id4 (id2, id3, id1, id4) COMMENT 'cf_long_prefix', index id2_id3_id1_id4 (id2, id3, id1, id4) COMMENT 'cf_long_prefix',
index id3_id2 (id3, id2) COMMENT 'cf_long_prefix' index id3_id2 (id3, id2) COMMENT 'cf_long_prefix'
) engine=ROCKSDB; ) engine=ROCKSDB;
create table t2 ( create or replace table t2 (
id1 bigint not null, id1 bigint not null,
id2 bigint not null, id2 bigint not null,
id3 varchar(100) not null, id3 varchar(100) not null,
...@@ -841,6 +839,10 @@ index id2_id4_id5 (id2, id4, id5) COMMENT 'cf_long_prefix', ...@@ -841,6 +839,10 @@ index id2_id4_id5 (id2, id4, id5) COMMENT 'cf_long_prefix',
index id3_id4 (id3, id4) COMMENT 'cf_long_prefix', index id3_id4 (id3, id4) COMMENT 'cf_long_prefix',
index id3_id5 (id3, id5) COMMENT 'cf_long_prefix' index id3_id5 (id3, id5) COMMENT 'cf_long_prefix'
) engine=ROCKSDB; ) engine=ROCKSDB;
insert t1
select (seq+9) div 10, (seq+4) div 5, (seq+4) div 5, seq, seq, 1000, "aaabbbccc"
from seq_1_to_10000;
insert t2 select * from t1;
call bloom_start(); call bloom_start();
select count(*) from t1; select count(*) from t1;
count(*) count(*)
......
...@@ -7,13 +7,7 @@ CREATE PROCEDURE bloom_end() ...@@ -7,13 +7,7 @@ CREATE PROCEDURE bloom_end()
BEGIN BEGIN
select case when variable_value-@c > 0 then 'true' else 'false' end as checked from information_schema.global_status where variable_name='rocksdb_bloom_filter_prefix_checked'; select case when variable_value-@c > 0 then 'true' else 'false' end as checked from information_schema.global_status where variable_name='rocksdb_bloom_filter_prefix_checked';
END// END//
drop table if exists t1; create or replace table t1 (
Warnings:
Note 1051 Unknown table 'test.t1'
drop table if exists t2;
Warnings:
Note 1051 Unknown table 'test.t2'
create table t1 (
id1 bigint not null, id1 bigint not null,
id2 bigint not null, id2 bigint not null,
id3 varchar(100) not null, id3 varchar(100) not null,
...@@ -21,15 +15,15 @@ id4 int not null, ...@@ -21,15 +15,15 @@ id4 int not null,
id5 int not null, id5 int not null,
value bigint, value bigint,
value2 varchar(100), value2 varchar(100),
primary key (id1, id2, id3, id4), primary key (id1, id2, id3, id4) ,
index id2 (id2), index id2 (id2) ,
index id2_id1 (id2, id1), index id2_id1 (id2, id1) ,
index id2_id3 (id2, id3), index id2_id3 (id2, id3) ,
index id2_id4 (id2, id4), index id2_id4 (id2, id4) ,
index id2_id3_id1_id4 (id2, id3, id1, id4), index id2_id3_id1_id4 (id2, id3, id1, id4) ,
index id3_id2 (id3, id2) index id3_id2 (id3, id2)
) engine=ROCKSDB; ) engine=ROCKSDB;
create table t2 ( create or replace table t2 (
id1 bigint not null, id1 bigint not null,
id2 bigint not null, id2 bigint not null,
id3 varchar(100) not null, id3 varchar(100) not null,
...@@ -37,14 +31,18 @@ id4 int not null, ...@@ -37,14 +31,18 @@ id4 int not null,
id5 int not null, id5 int not null,
value bigint, value bigint,
value2 varchar(100), value2 varchar(100),
primary key (id4), primary key (id4) ,
index id2 (id2), index id2 (id2) ,
index id2_id3 (id2, id3), index id2_id3 (id2, id3) ,
index id2_id4 (id2, id4), index id2_id4 (id2, id4) ,
index id2_id4_id5 (id2, id4, id5), index id2_id4_id5 (id2, id4, id5) ,
index id3_id4 (id3, id4), index id3_id4 (id3, id4) ,
index id3_id5 (id3, id5) index id3_id5 (id3, id5)
) engine=ROCKSDB; ) engine=ROCKSDB;
insert t1
select (seq+9) div 10, (seq+4) div 5, (seq+4) div 5, seq, seq, 1000, "aaabbbccc"
from seq_1_to_10000;
insert t2 select * from t1;
call bloom_start(); call bloom_start();
select count(*) from t1; select count(*) from t1;
count(*) count(*)
...@@ -409,9 +407,7 @@ count(*) ...@@ -409,9 +407,7 @@ count(*)
call bloom_end(); call bloom_end();
checked checked
false false
drop table if exists t1; create or replace table t1 (
drop table if exists t2;
create table t1 (
id1 bigint not null, id1 bigint not null,
id2 bigint not null, id2 bigint not null,
id3 varchar(100) not null, id3 varchar(100) not null,
...@@ -427,7 +423,7 @@ index id2_id4 (id2, id4) COMMENT 'cf_short_prefix', ...@@ -427,7 +423,7 @@ index id2_id4 (id2, id4) COMMENT 'cf_short_prefix',
index id2_id3_id1_id4 (id2, id3, id1, id4) COMMENT 'cf_short_prefix', index id2_id3_id1_id4 (id2, id3, id1, id4) COMMENT 'cf_short_prefix',
index id3_id2 (id3, id2) COMMENT 'cf_short_prefix' index id3_id2 (id3, id2) COMMENT 'cf_short_prefix'
) engine=ROCKSDB; ) engine=ROCKSDB;
create table t2 ( create or replace table t2 (
id1 bigint not null, id1 bigint not null,
id2 bigint not null, id2 bigint not null,
id3 varchar(100) not null, id3 varchar(100) not null,
...@@ -443,6 +439,10 @@ index id2_id4_id5 (id2, id4, id5) COMMENT 'cf_short_prefix', ...@@ -443,6 +439,10 @@ index id2_id4_id5 (id2, id4, id5) COMMENT 'cf_short_prefix',
index id3_id4 (id3, id4) COMMENT 'cf_short_prefix', index id3_id4 (id3, id4) COMMENT 'cf_short_prefix',
index id3_id5 (id3, id5) COMMENT 'cf_short_prefix' index id3_id5 (id3, id5) COMMENT 'cf_short_prefix'
) engine=ROCKSDB; ) engine=ROCKSDB;
insert t1
select (seq+9) div 10, (seq+4) div 5, (seq+4) div 5, seq, seq, 1000, "aaabbbccc"
from seq_1_to_10000;
insert t2 select * from t1;
call bloom_start(); call bloom_start();
select count(*) from t1; select count(*) from t1;
count(*) count(*)
...@@ -807,9 +807,7 @@ count(*) ...@@ -807,9 +807,7 @@ count(*)
call bloom_end(); call bloom_end();
checked checked
false false
drop table if exists t1; create or replace table t1 (
drop table if exists t2;
create table t1 (
id1 bigint not null, id1 bigint not null,
id2 bigint not null, id2 bigint not null,
id3 varchar(100) not null, id3 varchar(100) not null,
...@@ -825,7 +823,7 @@ index id2_id4 (id2, id4) COMMENT 'cf_long_prefix', ...@@ -825,7 +823,7 @@ index id2_id4 (id2, id4) COMMENT 'cf_long_prefix',
index id2_id3_id1_id4 (id2, id3, id1, id4) COMMENT 'cf_long_prefix', index id2_id3_id1_id4 (id2, id3, id1, id4) COMMENT 'cf_long_prefix',
index id3_id2 (id3, id2) COMMENT 'cf_long_prefix' index id3_id2 (id3, id2) COMMENT 'cf_long_prefix'
) engine=ROCKSDB; ) engine=ROCKSDB;
create table t2 ( create or replace table t2 (
id1 bigint not null, id1 bigint not null,
id2 bigint not null, id2 bigint not null,
id3 varchar(100) not null, id3 varchar(100) not null,
...@@ -841,6 +839,10 @@ index id2_id4_id5 (id2, id4, id5) COMMENT 'cf_long_prefix', ...@@ -841,6 +839,10 @@ index id2_id4_id5 (id2, id4, id5) COMMENT 'cf_long_prefix',
index id3_id4 (id3, id4) COMMENT 'cf_long_prefix', index id3_id4 (id3, id4) COMMENT 'cf_long_prefix',
index id3_id5 (id3, id5) COMMENT 'cf_long_prefix' index id3_id5 (id3, id5) COMMENT 'cf_long_prefix'
) engine=ROCKSDB; ) engine=ROCKSDB;
insert t1
select (seq+9) div 10, (seq+4) div 5, (seq+4) div 5, seq, seq, 1000, "aaabbbccc"
from seq_1_to_10000;
insert t2 select * from t1;
call bloom_start(); call bloom_start();
select count(*) from t1; select count(*) from t1;
count(*) count(*)
......
...@@ -107,7 +107,7 @@ ALTER TABLE t2 ADD INDEX(value); ...@@ -107,7 +107,7 @@ ALTER TABLE t2 ADD INDEX(value);
ERROR HY000: Unsupported collation on string indexed column test.t2.value Use binary collation (latin1_bin, binary, utf8_bin). ERROR HY000: Unsupported collation on string indexed column test.t2.value Use binary collation (latin1_bin, binary, utf8_bin).
DROP TABLE t2; DROP TABLE t2;
SET GLOBAL rocksdb_strict_collation_exceptions="[a-b"; SET GLOBAL rocksdb_strict_collation_exceptions="[a-b";
Invalid pattern in strict_collation_exceptions: [a-b FOUND 1 /Invalid pattern in strict_collation_exceptions: \[a-b/ in mysqld.1.err
CREATE TABLE a (id INT PRIMARY KEY, value varchar(50), index(value)) engine=rocksdb charset utf8; CREATE TABLE a (id INT PRIMARY KEY, value varchar(50), index(value)) engine=rocksdb charset utf8;
ERROR HY000: Unsupported collation on string indexed column test.a.value Use binary collation (latin1_bin, binary, utf8_bin). ERROR HY000: Unsupported collation on string indexed column test.a.value Use binary collation (latin1_bin, binary, utf8_bin).
SET GLOBAL rocksdb_strict_collation_exceptions="[a-b]"; SET GLOBAL rocksdb_strict_collation_exceptions="[a-b]";
...@@ -118,7 +118,7 @@ ERROR HY000: Unsupported collation on string indexed column test.c.value Use bin ...@@ -118,7 +118,7 @@ ERROR HY000: Unsupported collation on string indexed column test.c.value Use bin
DROP TABLE a, b; DROP TABLE a, b;
call mtr.add_suppression("Invalid pattern in strict_collation_exceptions:"); call mtr.add_suppression("Invalid pattern in strict_collation_exceptions:");
SET GLOBAL rocksdb_strict_collation_exceptions="abc\\"; SET GLOBAL rocksdb_strict_collation_exceptions="abc\\";
Invalid pattern in strict_collation_exceptions: abc\ FOUND 1 /Invalid pattern in strict_collation_exceptions: abc/ in mysqld.1.err
CREATE TABLE abc (id INT PRIMARY KEY, value varchar(50), index(value)) engine=rocksdb charset utf8; CREATE TABLE abc (id INT PRIMARY KEY, value varchar(50), index(value)) engine=rocksdb charset utf8;
ERROR HY000: Unsupported collation on string indexed column test.abc.value Use binary collation (latin1_bin, binary, utf8_bin). ERROR HY000: Unsupported collation on string indexed column test.abc.value Use binary collation (latin1_bin, binary, utf8_bin).
SET GLOBAL rocksdb_strict_collation_exceptions="abc"; SET GLOBAL rocksdb_strict_collation_exceptions="abc";
......
...@@ -22,9 +22,6 @@ set global rocksdb_compaction_sequential_deletes_window=0; ...@@ -22,9 +22,6 @@ set global rocksdb_compaction_sequential_deletes_window=0;
set global rocksdb_compaction_sequential_deletes= 0; set global rocksdb_compaction_sequential_deletes= 0;
set global rocksdb_compaction_sequential_deletes_file_size=0; set global rocksdb_compaction_sequential_deletes_file_size=0;
set global rocksdb_force_flush_memtable_now=1; set global rocksdb_force_flush_memtable_now=1;
select sleep(1);
sleep(1)
0
wait_for_delete: 0 wait_for_delete: 0
There are deletes left There are deletes left
SET GLOBAL rocksdb_compaction_sequential_deletes= 0; SET GLOBAL rocksdb_compaction_sequential_deletes= 0;
...@@ -36,9 +33,6 @@ set global rocksdb_compaction_sequential_deletes_window=1000; ...@@ -36,9 +33,6 @@ set global rocksdb_compaction_sequential_deletes_window=1000;
set global rocksdb_compaction_sequential_deletes= 990; set global rocksdb_compaction_sequential_deletes= 990;
set global rocksdb_compaction_sequential_deletes_file_size=0; set global rocksdb_compaction_sequential_deletes_file_size=0;
set global rocksdb_force_flush_memtable_now=1; set global rocksdb_force_flush_memtable_now=1;
select sleep(1);
sleep(1)
0
wait_for_delete: 1 wait_for_delete: 1
No more deletes left No more deletes left
SET GLOBAL rocksdb_compaction_sequential_deletes= 0; SET GLOBAL rocksdb_compaction_sequential_deletes= 0;
...@@ -50,9 +44,6 @@ set global rocksdb_compaction_sequential_deletes_window=1000; ...@@ -50,9 +44,6 @@ set global rocksdb_compaction_sequential_deletes_window=1000;
set global rocksdb_compaction_sequential_deletes= 1000; set global rocksdb_compaction_sequential_deletes= 1000;
set global rocksdb_compaction_sequential_deletes_file_size=1000000; set global rocksdb_compaction_sequential_deletes_file_size=1000000;
set global rocksdb_force_flush_memtable_now=1; set global rocksdb_force_flush_memtable_now=1;
select sleep(1);
sleep(1)
0
wait_for_delete: 0 wait_for_delete: 0
There are deletes left There are deletes left
SET GLOBAL rocksdb_compaction_sequential_deletes= 0; SET GLOBAL rocksdb_compaction_sequential_deletes= 0;
...@@ -64,9 +55,6 @@ set global rocksdb_compaction_sequential_deletes_window=1000; ...@@ -64,9 +55,6 @@ set global rocksdb_compaction_sequential_deletes_window=1000;
set global rocksdb_compaction_sequential_deletes= 50; set global rocksdb_compaction_sequential_deletes= 50;
set global rocksdb_compaction_sequential_deletes_file_size=0; set global rocksdb_compaction_sequential_deletes_file_size=0;
set global rocksdb_force_flush_memtable_now=1; set global rocksdb_force_flush_memtable_now=1;
select sleep(1);
sleep(1)
0
wait_for_delete: 1 wait_for_delete: 1
No more deletes left No more deletes left
SET GLOBAL rocksdb_compaction_sequential_deletes= 0; SET GLOBAL rocksdb_compaction_sequential_deletes= 0;
...@@ -81,9 +69,6 @@ set global rocksdb_compaction_sequential_deletes_window=1000; ...@@ -81,9 +69,6 @@ set global rocksdb_compaction_sequential_deletes_window=1000;
set global rocksdb_compaction_sequential_deletes= 50; set global rocksdb_compaction_sequential_deletes= 50;
set global rocksdb_compaction_sequential_deletes_file_size=0; set global rocksdb_compaction_sequential_deletes_file_size=0;
set global rocksdb_force_flush_memtable_now=1; set global rocksdb_force_flush_memtable_now=1;
select sleep(1);
sleep(1)
0
wait_for_delete: 1 wait_for_delete: 1
No more deletes left No more deletes left
SET GLOBAL rocksdb_compaction_sequential_deletes= 0; SET GLOBAL rocksdb_compaction_sequential_deletes= 0;
......
call mtr.add_suppression("Column family 'cf1' not found");
call mtr.add_suppression("Column family 'rev:cf2' not found");
DROP TABLE IF EXISTS t1; DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t2; DROP TABLE IF EXISTS t2;
DROP TABLE IF EXISTS t3; DROP TABLE IF EXISTS t3;
......
call mtr.add_suppression("Column family 'cf1' not found");
call mtr.add_suppression("Column family 'rev:cf2' not found");
DROP TABLE IF EXISTS t1; DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t2; DROP TABLE IF EXISTS t2;
DROP TABLE IF EXISTS t3; DROP TABLE IF EXISTS t3;
......
call mtr.add_suppression("Column family 'cf1' not found");
call mtr.add_suppression("Column family 'rev:cf2' not found");
DROP TABLE IF EXISTS t1; DROP TABLE IF EXISTS t1;
set global rocksdb_compact_cf = 'cf1'; set global rocksdb_compact_cf = 'cf1';
set global rocksdb_compact_cf = 'rev:cf2'; set global rocksdb_compact_cf = 'rev:cf2';
......
...@@ -38,15 +38,16 @@ update r1 set value1=value1+100 where id1=1 and id2=1 and id3='1'; ...@@ -38,15 +38,16 @@ update r1 set value1=value1+100 where id1=1 and id2=1 and id3='1';
/*!50601 SET @enable_bulk_load = IF (@is_rocksdb_supported, 'SET SESSION rocksdb_bulk_load=1', 'SET @dummy = 0') */; /*!50601 SET @enable_bulk_load = IF (@is_rocksdb_supported, 'SET SESSION rocksdb_bulk_load=1', 'SET @dummy = 0') */;
/*!50601 PREPARE s FROM @enable_bulk_load */; /*!50601 PREPARE s FROM @enable_bulk_load */;
/*!50601 EXECUTE s */; /*!50601 EXECUTE s */;
-- CHANGE MASTER TO MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=3893; -- CHANGE MASTER TO MASTER_LOG_FILE='master-bin.000002', MASTER_LOG_POS=4832;
-- SET GLOBAL gtid_slave_pos='0-1-18';
DROP TABLE IF EXISTS `r1`; DROP TABLE IF EXISTS `r1`;
/*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */; /*!40101 SET character_set_client = utf8 */;
CREATE TABLE `r1` ( CREATE TABLE `r1` (
`id1` int(11) NOT NULL DEFAULT '0', `id1` int(11) NOT NULL,
`id2` int(11) NOT NULL DEFAULT '0', `id2` int(11) NOT NULL,
`id3` varchar(100) NOT NULL DEFAULT '', `id3` varchar(100) NOT NULL,
`id4` int(11) NOT NULL DEFAULT '0', `id4` int(11) NOT NULL,
`value1` int(11) DEFAULT NULL, `value1` int(11) DEFAULT NULL,
`value2` int(11) DEFAULT NULL, `value2` int(11) DEFAULT NULL,
`value3` int(11) DEFAULT NULL, `value3` int(11) DEFAULT NULL,
...@@ -90,15 +91,16 @@ SET GLOBAL default_storage_engine=rocksdb; ...@@ -90,15 +91,16 @@ SET GLOBAL default_storage_engine=rocksdb;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
-- CHANGE MASTER TO MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=3893; -- CHANGE MASTER TO MASTER_LOG_FILE='master-bin.000002', MASTER_LOG_POS=4832;
-- SET GLOBAL gtid_slave_pos='0-1-18';
DROP TABLE IF EXISTS `r1`; DROP TABLE IF EXISTS `r1`;
/*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */; /*!40101 SET character_set_client = utf8 */;
CREATE TABLE `r1` ( CREATE TABLE `r1` (
`id1` int(11) NOT NULL DEFAULT '0', `id1` int(11) NOT NULL,
`id2` int(11) NOT NULL DEFAULT '0', `id2` int(11) NOT NULL,
`id3` varchar(100) NOT NULL DEFAULT '', `id3` varchar(100) NOT NULL,
`id4` int(11) NOT NULL DEFAULT '0', `id4` int(11) NOT NULL,
`value1` int(11) DEFAULT NULL, `value1` int(11) DEFAULT NULL,
`value2` int(11) DEFAULT NULL, `value2` int(11) DEFAULT NULL,
`value3` int(11) DEFAULT NULL, `value3` int(11) DEFAULT NULL,
...@@ -136,15 +138,16 @@ UNLOCK TABLES; ...@@ -136,15 +138,16 @@ UNLOCK TABLES;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
-- CHANGE MASTER TO MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=3893; -- CHANGE MASTER TO MASTER_LOG_FILE='master-bin.000002', MASTER_LOG_POS=4832;
-- SET GLOBAL gtid_slave_pos='0-1-18';
DROP TABLE IF EXISTS `r1`; DROP TABLE IF EXISTS `r1`;
/*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */; /*!40101 SET character_set_client = utf8 */;
CREATE TABLE `r1` ( CREATE TABLE `r1` (
`id1` int(11) NOT NULL DEFAULT '0', `id1` int(11) NOT NULL,
`id2` int(11) NOT NULL DEFAULT '0', `id2` int(11) NOT NULL,
`id3` varchar(100) NOT NULL DEFAULT '', `id3` varchar(100) NOT NULL,
`id4` int(11) NOT NULL DEFAULT '0', `id4` int(11) NOT NULL,
`value1` int(11) DEFAULT NULL, `value1` int(11) DEFAULT NULL,
`value2` int(11) DEFAULT NULL, `value2` int(11) DEFAULT NULL,
`value3` int(11) DEFAULT NULL, `value3` int(11) DEFAULT NULL,
......
...@@ -32,15 +32,19 @@ delete from t6 where id <= 9900; ...@@ -32,15 +32,19 @@ delete from t6 where id <= 9900;
optimize table t1; optimize table t1;
Table Op Msg_type Msg_text Table Op Msg_type Msg_text
test.t1 optimize status OK test.t1 optimize status OK
sst file reduction ok
optimize table t3; optimize table t3;
Table Op Msg_type Msg_text Table Op Msg_type Msg_text
test.t3 optimize status OK test.t3 optimize status OK
sst file reduction ok
optimize table t4; optimize table t4;
Table Op Msg_type Msg_text Table Op Msg_type Msg_text
test.t4 optimize status OK test.t4 optimize status OK
sst file reduction ok
optimize table t6; optimize table t6;
Table Op Msg_type Msg_text Table Op Msg_type Msg_text
test.t6 optimize status OK test.t6 optimize status OK
sst file reduction ok
select count(*) from t1; select count(*) from t1;
count(*) count(*)
100 100
...@@ -59,14 +63,6 @@ count(*) ...@@ -59,14 +63,6 @@ count(*)
select count(*) from t6; select count(*) from t6;
count(*) count(*)
100 100
checking sst file reduction on optimize table from 0 to 1..
ok.
checking sst file reduction on optimize table from 1 to 2..
ok.
checking sst file reduction on optimize table from 2 to 3..
ok.
checking sst file reduction on optimize table from 3 to 4..
ok.
optimize table t2; optimize table t2;
Table Op Msg_type Msg_text Table Op Msg_type Msg_text
test.t2 optimize status OK test.t2 optimize status OK
......
set @save_rocksdb_store_row_debug_checksums=@@global.rocksdb_store_row_debug_checksums; 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_verify_row_debug_checksums=@@global.rocksdb_verify_row_debug_checksums;
set @save_rocksdb_checksums_pct=@@global.rocksdb_checksums_pct; set @save_rocksdb_checksums_pct=@@global.rocksdb_checksums_pct;
drop table if exists t1,t2,t3;
show variables like 'rocksdb_%checksum%'; show variables like 'rocksdb_%checksum%';
Variable_name Value Variable_name Value
rocksdb_checksums_pct 100 rocksdb_checksums_pct 100
...@@ -12,12 +11,7 @@ insert into t1 values (1,1,1),(2,2,2),(3,3,3); ...@@ -12,12 +11,7 @@ insert into t1 values (1,1,1),(2,2,2),(3,3,3);
check table t1; check table t1;
Table Op Msg_type Msg_text Table Op Msg_type Msg_text
test.t1 check status OK test.t1 check status OK
CHECKTABLE t1: Checking table t1 FOUND 1 /0 table records had checksums/ in mysqld.1.err
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; drop table t1;
set session rocksdb_store_row_debug_checksums=on; 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; create table t2 (pk int primary key, a int, b int, key(a), key(b)) engine=rocksdb;
...@@ -25,12 +19,7 @@ insert into t2 values (1,1,1),(2,2,2),(3,3,3); ...@@ -25,12 +19,7 @@ insert into t2 values (1,1,1),(2,2,2),(3,3,3);
check table t2; check table t2;
Table Op Msg_type Msg_text Table Op Msg_type Msg_text
test.t2 check status OK test.t2 check status OK
CHECKTABLE t2: Checking table t2 FOUND 1 /3 table records had checksums/ in mysqld.1.err
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 # 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; 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); insert into t3 values (1,1,1),(2,2,2),(3,3,3);
...@@ -40,12 +29,7 @@ set session rocksdb_store_row_debug_checksums=on; ...@@ -40,12 +29,7 @@ set session rocksdb_store_row_debug_checksums=on;
check table t3; check table t3;
Table Op Msg_type Msg_text Table Op Msg_type Msg_text
test.t3 check status OK test.t3 check status OK
CHECKTABLE t3: Checking table t3 FOUND 1 /2 table records had checksums/ in mysqld.1.err
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_store_row_debug_checksums=on;
set session rocksdb_checksums_pct=5; set session rocksdb_checksums_pct=5;
create table t4 (pk int primary key, a int, b int, key(a), key(b)) engine=rocksdb; create table t4 (pk int primary key, a int, b int, key(a), key(b)) engine=rocksdb;
......
Check for the number of MANIFEST files Check for MANIFEST files
1 MANIFEST-000006
call mtr.add_suppression("Column family 'cf1' not found");
call mtr.add_suppression("Column family 'rev:cf2' not found");
DROP TABLE IF EXISTS t1; DROP TABLE IF EXISTS t1;
set global rocksdb_compact_cf = 'cf1'; set global rocksdb_compact_cf = 'cf1';
set global rocksdb_compact_cf = 'rev:cf2'; set global rocksdb_compact_cf = 'rev:cf2';
......
RocksDB: Can't enable both use_direct_reads and allow_mmap_reads call mtr.add_suppression("rocksdb");
RocksDB: Can't enable both use_direct_writes and allow_mmap_writes call mtr.add_suppression("Aborting");
FOUND 1 /enable both use_direct_reads/ in mysqld.1.err
FOUND 1 /enable both use_direct_writes/ in mysqld.1.err
DROP TABLE IF EXISTS t1, t2; call mtr.add_suppression('RocksDB: Schema mismatch');
CREATE TABLE t1 (pk int primary key) ENGINE=ROCKSDB; CREATE TABLE t1 (pk int primary key) ENGINE=ROCKSDB;
CREATE TABLE t2 (pk int primary key) ENGINE=ROCKSDB PARTITION BY KEY(pk) PARTITIONS 4; CREATE TABLE t2 (pk int primary key) ENGINE=ROCKSDB PARTITION BY KEY(pk) PARTITIONS 4;
Expect errors that we are missing two .frm files "Expect errors that we are missing two .frm files"
RocksDB: Schema mismatch - Table test.t1 is registered in RocksDB but does not have a .frm file FOUND 2 /Schema mismatch/ in mysqld.1.err
RocksDB: Schema mismatch - Table test.t2 is registered in RocksDB but does not have a .frm file "Expect an error that we have an extra .frm file"
Expect an error that we have an extra .frm file FOUND 3 /Schema mismatch/ in mysqld.1.err
RocksDB: Schema mismatch - A .frm file exists for table test.t1_dummy, but that table is not registered in RocksDB
DROP TABLE t1, t2; DROP TABLE t1, t2;
package My::Suite::Rocksdb_sys_vars; package My::Suite::Rocksdb;
@ISA = qw(My::Suite); @ISA = qw(My::Suite);
sub is_default { not $::opt_embedded_server } sub is_default { not $::opt_embedded_server }
my ($sst_dump) = grep { -x "$_/sst_dump" } "$::bindir/storage/rocksdb", $::path_client_bindir;
return "RocksDB is not compiled, no sst_dump" unless $sst_dump;
$ENV{MARIAROCKS_SST_DUMP}="$sst_dump/sst_dump";
bless { }; bless { };
--source include/have_rocksdb.inc --source include/have_rocksdb.inc
let tmpl_ddl= ../storage/rocksdb/mysql-test/rocksdb/t/bloomfilter_table_def.tmpl;
let ddl= $MYSQL_TMP_DIR/bloomfilter_create.sql;
DELIMITER //; DELIMITER //;
CREATE PROCEDURE bloom_start() CREATE PROCEDURE bloom_start()
BEGIN BEGIN
...@@ -17,20 +14,20 @@ DELIMITER ;// ...@@ -17,20 +14,20 @@ DELIMITER ;//
#BF is sometimes invoked and useful #BF is sometimes invoked and useful
--exec sed s/##CF##//g $tmpl_ddl > $ddl --let $CF=
--source $ddl --source bloomfilter_table_def.inc
--source t/bloomfilter_load_select.inc --source bloomfilter_load_select.inc
#BF is always invoked but not useful at all #BF is always invoked but not useful at all
--exec sed s/##CF##/" COMMENT 'cf_short_prefix'"/g $tmpl_ddl > $ddl --let $CF=COMMENT 'cf_short_prefix'
--source $ddl --source bloomfilter_table_def.inc
--source t/bloomfilter_load_select.inc --source bloomfilter_load_select.inc
#BF is most of the time invoked and useful #BF is most of the time invoked and useful
--exec sed s/##CF##/" COMMENT 'cf_long_prefix'"/g $tmpl_ddl > $ddl --let $CF=COMMENT 'cf_long_prefix'
--source $ddl --source bloomfilter_table_def.inc
--source t/bloomfilter_load_select.inc --source bloomfilter_load_select.inc
# BUG: Prev() with prefix lookup should not use prefix bloom filter # BUG: Prev() with prefix lookup should not use prefix bloom filter
create table r1 (id1 bigint, id2 bigint, id3 bigint, v1 int, v2 text, primary key (id1, id2, id3)) engine=rocksdb DEFAULT CHARSET=latin1 collate latin1_bin; create table r1 (id1 bigint, id2 bigint, id3 bigint, v1 int, v2 text, primary key (id1, id2, id3)) engine=rocksdb DEFAULT CHARSET=latin1 collate latin1_bin;
...@@ -60,4 +57,3 @@ optimize table t2; ...@@ -60,4 +57,3 @@ optimize table t2;
drop table if exists t1; drop table if exists t1;
drop table if exists t2; drop table if exists t2;
drop table if exists r1; drop table if exists r1;
--remove_file $ddl
source include/have_sequence.inc;
# loading some data (larger than write buf size) to cause compaction # loading some data (larger than write buf size) to cause compaction
--exec perl ../storage/rocksdb/mysql-test/rocksdb/t/gen_insert.pl t1 > $MYSQL_TMP_DIR/insert_t1.sql insert t1
--exec perl ../storage/rocksdb/mysql-test/rocksdb/t/gen_insert.pl t2 > $MYSQL_TMP_DIR/insert_t2.sql select (seq+9) div 10, (seq+4) div 5, (seq+4) div 5, seq, seq, 1000, "aaabbbccc"
--disable_query_log from seq_1_to_10000;
--source $MYSQL_TMP_DIR/insert_t1.sql insert t2 select * from t1;
--source $MYSQL_TMP_DIR/insert_t2.sql
--enable_query_log
# BF conditions (prefix short(4B)|medium(20B)|long(240B)) # BF conditions (prefix short(4B)|medium(20B)|long(240B))
#0 no eq condition (o, x, x) #0 no eq condition (o, x, x)
......
drop table if exists t1; eval create or replace table t1 (
drop table if exists t2;
create table t1 (
id1 bigint not null, id1 bigint not null,
id2 bigint not null, id2 bigint not null,
id3 varchar(100) not null, id3 varchar(100) not null,
...@@ -8,16 +6,16 @@ create table t1 ( ...@@ -8,16 +6,16 @@ create table t1 (
id5 int not null, id5 int not null,
value bigint, value bigint,
value2 varchar(100), value2 varchar(100),
primary key (id1, id2, id3, id4)##CF##, primary key (id1, id2, id3, id4) $CF,
index id2 (id2)##CF##, index id2 (id2) $CF,
index id2_id1 (id2, id1)##CF##, index id2_id1 (id2, id1) $CF,
index id2_id3 (id2, id3)##CF##, index id2_id3 (id2, id3) $CF,
index id2_id4 (id2, id4)##CF##, index id2_id4 (id2, id4) $CF,
index id2_id3_id1_id4 (id2, id3, id1, id4)##CF##, index id2_id3_id1_id4 (id2, id3, id1, id4) $CF,
index id3_id2 (id3, id2)##CF## index id3_id2 (id3, id2) $CF
) engine=ROCKSDB; ) engine=ROCKSDB;
create table t2 ( eval create or replace table t2 (
id1 bigint not null, id1 bigint not null,
id2 bigint not null, id2 bigint not null,
id3 varchar(100) not null, id3 varchar(100) not null,
...@@ -25,12 +23,11 @@ create table t2 ( ...@@ -25,12 +23,11 @@ create table t2 (
id5 int not null, id5 int not null,
value bigint, value bigint,
value2 varchar(100), value2 varchar(100),
primary key (id4)##CF##, primary key (id4) $CF,
index id2 (id2)##CF##, index id2 (id2) $CF,
index id2_id3 (id2, id3)##CF##, index id2_id3 (id2, id3) $CF,
index id2_id4 (id2, id4)##CF##, index id2_id4 (id2, id4) $CF,
index id2_id4_id5 (id2, id4, id5)##CF##, index id2_id4_id5 (id2, id4, id5) $CF,
index id3_id4 (id3, id4)##CF##, index id3_id4 (id3, id4) $CF,
index id3_id5 (id3, id5)##CF## index id3_id5 (id3, id5) $CF
) engine=ROCKSDB; ) engine=ROCKSDB;
--source include/have_rocksdb.inc --source include/have_rocksdb.inc
# Unixisms ("exec ls" in set_checkpoint.inc etc)
--source include/not_windows.inc
--disable_warnings --disable_warnings
DROP TABLE IF EXISTS t1; DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t2; DROP TABLE IF EXISTS t2;
......
...@@ -3,10 +3,6 @@ ...@@ -3,10 +3,6 @@
# following check is commented out: # following check is commented out:
# --source include/have_fullregex.inc # --source include/have_fullregex.inc
# Unixisms (exec grep)
--source include/not_windows.inc
SET @start_global_value = @@global.ROCKSDB_STRICT_COLLATION_EXCEPTIONS; SET @start_global_value = @@global.ROCKSDB_STRICT_COLLATION_EXCEPTIONS;
--disable_warnings --disable_warnings
...@@ -159,9 +155,10 @@ DROP TABLE t2; ...@@ -159,9 +155,10 @@ DROP TABLE t2;
# test invalid regex (missing end bracket) # test invalid regex (missing end bracket)
--exec echo "" >$MYSQLTEST_VARDIR/log/mysqld.1.err
SET GLOBAL rocksdb_strict_collation_exceptions="[a-b"; SET GLOBAL rocksdb_strict_collation_exceptions="[a-b";
--exec grep "Invalid pattern" $MYSQLTEST_VARDIR/log/mysqld.1.err | cut -d] -f2 let SEARCH_FILE=$MYSQLTEST_VARDIR/log/mysqld.1.err;
let SEARCH_PATTERN=Invalid pattern in strict_collation_exceptions: \[a-b;
source include/search_pattern_in_file.inc;
--error ER_UNKNOWN_ERROR --error ER_UNKNOWN_ERROR
CREATE TABLE a (id INT PRIMARY KEY, value varchar(50), index(value)) engine=rocksdb charset utf8; CREATE TABLE a (id INT PRIMARY KEY, value varchar(50), index(value)) engine=rocksdb charset utf8;
SET GLOBAL rocksdb_strict_collation_exceptions="[a-b]"; SET GLOBAL rocksdb_strict_collation_exceptions="[a-b]";
...@@ -173,9 +170,9 @@ DROP TABLE a, b; ...@@ -173,9 +170,9 @@ DROP TABLE a, b;
call mtr.add_suppression("Invalid pattern in strict_collation_exceptions:"); call mtr.add_suppression("Invalid pattern in strict_collation_exceptions:");
# test invalid regex (trailing escape) # test invalid regex (trailing escape)
--exec echo "" >$MYSQLTEST_VARDIR/log/mysqld.1.err
SET GLOBAL rocksdb_strict_collation_exceptions="abc\\"; SET GLOBAL rocksdb_strict_collation_exceptions="abc\\";
--exec grep "Invalid pattern" $MYSQLTEST_VARDIR/log/mysqld.1.err | cut -d] -f2 let SEARCH_PATTERN=Invalid pattern in strict_collation_exceptions: abc;
source include/search_pattern_in_file.inc;
--error ER_UNKNOWN_ERROR --error ER_UNKNOWN_ERROR
CREATE TABLE abc (id INT PRIMARY KEY, value varchar(50), index(value)) engine=rocksdb charset utf8; CREATE TABLE abc (id INT PRIMARY KEY, value varchar(50), index(value)) engine=rocksdb charset utf8;
SET GLOBAL rocksdb_strict_collation_exceptions="abc"; SET GLOBAL rocksdb_strict_collation_exceptions="abc";
......
...@@ -31,8 +31,8 @@ while ($i<1000) ...@@ -31,8 +31,8 @@ while ($i<1000)
set global rocksdb_force_flush_memtable_now=1; set global rocksdb_force_flush_memtable_now=1;
optimize table r1; optimize table r1;
--exec echo Test 1: Do a bunch of updates without setting the compaction sysvar --echo Test 1: Do a bunch of updates without setting the compaction sysvar
--exec echo Expect: no compaction --echo Expect: no compaction
let $window = 0; let $window = 0;
let $deletes = 0; let $deletes = 0;
let $file_size = 0; let $file_size = 0;
...@@ -41,8 +41,8 @@ let $primary = 1; ...@@ -41,8 +41,8 @@ let $primary = 1;
let $no_more_deletes = 0; let $no_more_deletes = 0;
--source compact_deletes_test.inc --source compact_deletes_test.inc
--exec echo Test 2: Do a bunch of updates and set the compaction sysvar --echo Test 2: Do a bunch of updates and set the compaction sysvar
--exec echo Expect: compaction --echo Expect: compaction
let $window = 1000; let $window = 1000;
let $deletes = 990; let $deletes = 990;
let $file_size = 0; let $file_size = 0;
...@@ -51,8 +51,8 @@ let $primary = 1; ...@@ -51,8 +51,8 @@ let $primary = 1;
let $no_more_deletes = 1; let $no_more_deletes = 1;
--source compact_deletes_test.inc --source compact_deletes_test.inc
--exec echo Test 3: Do a bunch of updates and set the compaction sysvar and a file size to something large --echo Test 3: Do a bunch of updates and set the compaction sysvar and a file size to something large
--exec echo Expect: no compaction --echo Expect: no compaction
let $window = 1000; let $window = 1000;
let $deletes = 1000; let $deletes = 1000;
let $file_size = 1000000; let $file_size = 1000000;
...@@ -61,8 +61,8 @@ let $primary = 1; ...@@ -61,8 +61,8 @@ let $primary = 1;
let $no_more_deletes = 0; let $no_more_deletes = 0;
--source compact_deletes_test.inc --source compact_deletes_test.inc
--exec echo Test 4: Do a bunch of secondary key updates and set the compaction sysvar --echo Test 4: Do a bunch of secondary key updates and set the compaction sysvar
--exec echo Expect: compaction --echo Expect: compaction
let $window = 1000; let $window = 1000;
let $deletes = 50; let $deletes = 50;
let $file_size = 0; let $file_size = 0;
...@@ -71,9 +71,9 @@ let $primary = 0; ...@@ -71,9 +71,9 @@ let $primary = 0;
let $no_more_deletes = 1; let $no_more_deletes = 1;
--source compact_deletes_test.inc --source compact_deletes_test.inc
--exec echo Test 5: Do a bunch of secondary key updates and set the compaction sysvar, --echo Test 5: Do a bunch of secondary key updates and set the compaction sysvar,
--exec echo and rocksdb_compaction_sequential_deletes_count_sd turned on --echo and rocksdb_compaction_sequential_deletes_count_sd turned on
--exec echo Expect: compaction --echo Expect: compaction
let $window = 1000; let $window = 1000;
let $deletes = 50; let $deletes = 50;
let $file_size = 0; let $file_size = 0;
......
...@@ -27,7 +27,7 @@ while ($i<1000) ...@@ -27,7 +27,7 @@ while ($i<1000)
} }
--enable_query_log --enable_query_log
set global rocksdb_force_flush_memtable_now=1; set global rocksdb_force_flush_memtable_now=1;
select sleep(1); --sleep 1
--disable_query_log --disable_query_log
let $wait_timeout= 300; # Override default 30 seconds with 300. let $wait_timeout= 300; # Override default 30 seconds with 300.
...@@ -37,8 +37,35 @@ let $wait_condition = select count(*) = 0 ...@@ -37,8 +37,35 @@ let $wait_condition = select count(*) = 0
--source include/wait_condition.inc --source include/wait_condition.inc
--enable_query_log --enable_query_log
let $MYSQL_SST_DUMP=../storage/rocksdb/sst_dump; let NO_MORE_DELETES=$no_more_deletes;
exec bash ../storage/rocksdb/mysql-test/rocksdb/t/sst_count_rows.sh $MYSQLTEST_VARDIR $MYSQL_SST_DUMP $no_more_deletes ; perl;
use autodie qw(open);
$num_retries=240;
$retry=0;
print "wait_for_delete: $ENV{no_more_deletes}\n";
while ($retry++ < $num_retries) {
$total_d=$total_e=0;
for $f (<$ENV{MYSQLTEST_VARDIR}/mysqld.1/data/.rocksdb/*.sst>) {
# excluding system cf
open D, '-|', "$ENV{MARIAROCKS_SST_DUMP} --command=scan --output_hex --file=$f";
while (<D>) {
next unless /'(\d{8})/ and $1 >= 8;
$total_d++ if /: [07]/;
$total_e++ if /: 1/;
}
close D;
}
last if $total_e and not ($total_d and $ENV{no_more_deletes});
sleep 1;
}
unless ($total_e) {
print "No records in the database\n";
exit;
}
print $total_d ? "There are deletes left\n" : "No more deletes left\n";
EOF
eval SET GLOBAL rocksdb_compaction_sequential_deletes= $save_rocksdb_compaction_sequential_deletes; eval SET GLOBAL rocksdb_compaction_sequential_deletes= $save_rocksdb_compaction_sequential_deletes;
eval SET GLOBAL rocksdb_compaction_sequential_deletes_file_size= $save_rocksdb_compaction_sequential_deletes_file_size; eval SET GLOBAL rocksdb_compaction_sequential_deletes_file_size= $save_rocksdb_compaction_sequential_deletes_file_size;
......
...@@ -44,3 +44,7 @@ show_engine : MariaRocks: MariaDB doesnt support SHOW ENGINE rocksdb TRANSACTION ...@@ -44,3 +44,7 @@ show_engine : MariaRocks: MariaDB doesnt support SHOW ENGINE rocksdb TRANSACTION
rpl_row_not_found : MariaDB doesnt support slave_exec_mode='SEMI_STRICT' rpl_row_not_found : MariaDB doesnt support slave_exec_mode='SEMI_STRICT'
blind_delete_without_tx_api: MDEV-12286: rocksdb.blind_delete_without_tx_api test fails blind_delete_without_tx_api: MDEV-12286: rocksdb.blind_delete_without_tx_api test fails
allow_no_pk_concurrent_insert: stress test
rocksdb_deadlock_stress_rc: stress test
rocksdb_deadlock_stress_rr: stress test
--source include/have_rocksdb.inc --source include/have_rocksdb.inc
#Unixisms (possibly Linuxisms, exec truncate) call mtr.add_suppression("Column family 'cf1' not found");
--source include/not_windows.inc call mtr.add_suppression("Column family 'rev:cf2' not found");
--disable_warnings --disable_warnings
DROP TABLE IF EXISTS t1; DROP TABLE IF EXISTS t1;
...@@ -15,7 +15,6 @@ set global rocksdb_compact_cf = 'cf1'; ...@@ -15,7 +15,6 @@ set global rocksdb_compact_cf = 'cf1';
set global rocksdb_compact_cf = 'rev:cf2'; set global rocksdb_compact_cf = 'rev:cf2';
set global rocksdb_signal_drop_index_thread = 1; set global rocksdb_signal_drop_index_thread = 1;
--source include/restart_mysqld.inc --source include/restart_mysqld.inc
--exec truncate --size=0 $MYSQLTEST_VARDIR/log/mysqld.1.err
CREATE TABLE t1 ( CREATE TABLE t1 (
a int not null, a int not null,
...@@ -111,7 +110,45 @@ let $wait_condition = select count(*) = 0 ...@@ -111,7 +110,45 @@ let $wait_condition = select count(*) = 0
# Get list of all indices needing to be dropped # Get list of all indices needing to be dropped
# Check total compacted-away rows for all indices # Check total compacted-away rows for all indices
# Check that all indices have been successfully dropped # Check that all indices have been successfully dropped
--exec perl ../storage/rocksdb/mysql-test/rocksdb/t/drop_table_compactions.pl $MYSQLTEST_VARDIR/log/mysqld.1.err perl;
use autodie qw(open);
sub print_array {
$str = shift;
$prev= $_[0];
foreach (@_) {
$dummy_idx = $_ - $prev;
$prev= $_;
print "$str $dummy_idx\n";
}
}
open F, '<', "$ENV{MYSQLTEST_VARDIR}/log/mysqld.1.err";
while (<F>) {
%a = @b = @c = () if /CURRENT_TEST/;
if (/Compacting away elements from dropped index \(\d+,(\d+)\): (\d+)/) {
$a{$1} += $2;
}
if (/Begin filtering dropped index \(\d+,(\d+)\)/) {
push @b, $1;
}
if (/Finished filtering dropped index \(\d+,(\d+)\)/) {
push @c, $1;
}
}
$prev= 0;
foreach (sort {$a <=> $b} keys %a){
if ($prev) {
$dummy_idx= $_ - $prev;
}else {
$dummy_idx= 0;
}
$prev= $_;
}
print_array("Begin filtering dropped index+", sort {$a <=> $b} @b);
print_array("Finished filtering dropped index+", sort {$a <=> $b} @c);
EOF
# Cleanup # Cleanup
drop table t1; drop table t1;
--source include/have_rocksdb.inc --source include/have_rocksdb.inc
#Unixisms (--exec truncate, du, grep ,sed) call mtr.add_suppression("Column family 'cf1' not found");
--source include/not_windows.inc call mtr.add_suppression("Column family 'rev:cf2' not found");
--disable_warnings --disable_warnings
DROP TABLE IF EXISTS t1; DROP TABLE IF EXISTS t1;
...@@ -16,7 +16,6 @@ set global rocksdb_compact_cf = 'cf1'; ...@@ -16,7 +16,6 @@ set global rocksdb_compact_cf = 'cf1';
set global rocksdb_compact_cf = 'rev:cf2'; set global rocksdb_compact_cf = 'rev:cf2';
set global rocksdb_signal_drop_index_thread = 1; set global rocksdb_signal_drop_index_thread = 1;
--source include/restart_mysqld.inc --source include/restart_mysqld.inc
--exec truncate --size=0 $MYSQLTEST_VARDIR/log/mysqld.1.err
CREATE TABLE t1 ( CREATE TABLE t1 (
a int not null, a int not null,
...@@ -90,9 +89,12 @@ let $max = 1000; ...@@ -90,9 +89,12 @@ let $max = 1000;
let $table = t5; let $table = t5;
--source drop_table_repopulate_table.inc --source drop_table_repopulate_table.inc
let $output= $MYSQLTEST_VARDIR/tmp/size_output; perl;
use autodie qw(open);
--exec du -c $MYSQLTEST_VARDIR/mysqld.1/data/.rocksdb/*.sst |grep total |sed 's/[\t]total/ before/' > $output $size+=-s $_ for (<$ENV{MYSQLTEST_VARDIR}/mysqld.1/data/.rocksdb/*.sst>);
open(F, '>', "$ENV{MYSQLTEST_VARDIR}/tmp/size_output");
print F $size;
EOF
drop table t1; drop table t1;
drop table t2; drop table t2;
drop table t3; drop table t3;
...@@ -107,7 +109,12 @@ let $wait_condition = select count(*) = 0 ...@@ -107,7 +109,12 @@ let $wait_condition = select count(*) = 0
--source include/wait_condition.inc --source include/wait_condition.inc
# Check that space is reclaimed # Check that space is reclaimed
--exec du -c $MYSQLTEST_VARDIR/mysqld.1/data/.rocksdb/*.sst |grep total |sed 's/[\t]total/ after/' >> $output perl;
--exec perl ../storage/rocksdb/mysql-test/rocksdb/t/drop_table2_check.pl $output use autodie qw(open);
$size+=-s $_ for (<$ENV{MYSQLTEST_VARDIR}/mysqld.1/data/.rocksdb/*.sst>);
open(F, '<', "$ENV{MYSQLTEST_VARDIR}/tmp/size_output");
$old=<F>;
print "Compacted\n" if $old > $size * 2;
EOF
# Cleanup # Cleanup
#!/usr/bin/perl
my $a = 0;
my $b=0;
die unless($ARGV[0]);
open(my $f, "<", $ARGV[0]) or die $!;
while(readline($f)) {
if (/(\d+) before/) {
$a = $1;
}
if (/(\d+) after/ ) {
$b = $1;
}
}
if ($a > $b * 2) {
printf("Compacted\n");
}
--source include/have_rocksdb.inc --source include/have_rocksdb.inc
call mtr.add_suppression("Column family 'cf1' not found");
call mtr.add_suppression("Column family 'rev:cf2' not found");
--disable_warnings --disable_warnings
DROP TABLE IF EXISTS t1; DROP TABLE IF EXISTS t1;
--enable_warnings --enable_warnings
...@@ -9,7 +12,6 @@ set global rocksdb_compact_cf = 'cf1'; ...@@ -9,7 +12,6 @@ set global rocksdb_compact_cf = 'cf1';
set global rocksdb_compact_cf = 'rev:cf2'; set global rocksdb_compact_cf = 'rev:cf2';
set global rocksdb_signal_drop_index_thread = 1; set global rocksdb_signal_drop_index_thread = 1;
--source include/restart_mysqld.inc --source include/restart_mysqld.inc
--exec truncate --size=0 $MYSQLTEST_VARDIR/log/mysqld.1.err
CREATE TABLE t1 ( CREATE TABLE t1 (
a int not null, a int not null,
......
sub print_array {
$str = shift;
@arr = @_;
$prev= 0;
foreach (@arr) {
if ($prev) {
$dummy_idx = $_ - $prev;
}else {
$dummy_idx = 0;
}
$prev= $_;
print "$str $dummy_idx\n";
}
}
while (<>) {
if (/Compacting away elements from dropped index \(\d+,(\d+)\): (\d+)/) {
$a{$1} += $2;
}
if (/Begin filtering dropped index \(\d+,(\d+)\)/) {
push @b, $1;
}
if (/Finished filtering dropped index \(\d+,(\d+)\)/) {
push @c, $1;
}
}
$prev= 0;
foreach (sort {$a <=> $b} keys %a){
if ($prev) {
$dummy_idx= $_ - $prev;
}else {
$dummy_idx= 0;
}
$prev= $_;
}
print_array("Begin filtering dropped index+", sort {$a <=> $b} @b);
print_array("Finished filtering dropped index+", sort {$a <=> $b} @c);
#!/usr/bin/perl
my $table_name= $ARGV[0];
my $id1= 1;
my $id2= 1;
my $id3= 1;
my $id4= 1;
my $id5= 1;
my $value= 1000;
my $value2= 'aaabbbccc';
my $max_rows = 1 * 10000;
for(my $row_id= 1; $row_id <= $max_rows; $row_id++) {
my $value_clause = "($id1, $id2, $id3, $id4, $id5, $value, \"$value2\")";
if ($row_id % 100 == 1) {
print "INSERT INTO $table_name VALUES";
}
if ($row_id % 100 == 0) {
print "$value_clause;\n";
}else {
print "$value_clause,";
}
$id4++;
$id5++;
$id3++ if($row_id % 5 == 0);
$id2++ if($row_id % 5 == 0);
$id1++ if($row_id % 10 == 0);
}
--source include/have_rocksdb.inc --source include/have_rocksdb.inc
--source include/have_log_bin.inc --source include/have_log_bin.inc
--enable_connect_log
--source include/restart_mysqld.inc --source include/restart_mysqld.inc
# Save the initial number of concurrent sessions # Save the initial number of concurrent sessions
--source include/count_sessions.inc --source include/count_sessions.inc
--disable_warnings
drop table if exists r1;
--enable_warnings
connect (con1,localhost,root,,); connect (con1,localhost,root,,);
connect (con2,localhost,root,,); connect (con2,localhost,root,,);
...@@ -46,20 +38,19 @@ rollback; ...@@ -46,20 +38,19 @@ rollback;
connection con1; connection con1;
--exec grep "START TRANSACTION WITH CONSISTENT ROCKSDB SNAPSHOT" $MYSQLTEST_VARDIR/mysqld.1/mysqld.log | wc -l let SEARCH_FILE=$MYSQLTEST_VARDIR/mysqld.1/mysqld.log;
let SEARCH_PATTERN=START TRANSACTION WITH CONSISTENT ROCKSDB SNAPSHOT;
source include/search_pattern_in_file.inc;
set @save_default_storage_engine=@@global.default_storage_engine; set @save_default_storage_engine=@@global.default_storage_engine;
SET GLOBAL default_storage_engine=rocksdb; SET GLOBAL default_storage_engine=rocksdb;
--exec $MYSQL_DUMP --skip-comments --single-transaction --master-data=2 --print-ordering-key test --exec $MYSQL_DUMP --skip-comments --single-transaction --master-data=2 --print-ordering-key test
--exec grep "START TRANSACTION WITH CONSISTENT ROCKSDB SNAPSHOT" $MYSQLTEST_VARDIR/mysqld.1/mysqld.log | wc -l source include/search_pattern_in_file.inc;
# Sanity test mysqldump when the --innodb-stats-on-metadata is specified (no effect) # Sanity test mysqldump when the --innodb-stats-on-metadata is specified (no effect)
--echo ==== mysqldump with --innodb-stats-on-metadata ==== --echo ==== mysqldump with --innodb-stats-on-metadata ====
--exec $MYSQL_DUMP --skip-comments --single-transaction --master-data=2 --print-ordering-key --innodb-stats-on-metadata test --exec $MYSQL_DUMP --skip-comments --single-transaction --master-data=2 --print-ordering-key --innodb-stats-on-metadata test
# wiping general log so that this test case doesn't fail with --repeat
--exec echo "" > $MYSQLTEST_VARDIR/mysqld.1/mysqld.log
# testing mysqldump work with statement based binary logging # testing mysqldump work with statement based binary logging
SET GLOBAL binlog_format=statement; SET GLOBAL binlog_format=statement;
--exec $MYSQL_DUMP --skip-comments --single-transaction --master-data=2 --print-ordering-key test > /dev/null --exec $MYSQL_DUMP --skip-comments --single-transaction --master-data=2 --print-ordering-key test > /dev/null
......
let $datadir = `SELECT @@datadir`; # run a check script to verify sst files reduced enough during each optimize table
perl;
--disable_warnings use autodie qw(open);
DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6;
--enable_warnings $size += -s $_ for (<$ENV{datadir}/.rocksdb/*.sst>);
create table t1 (id int primary key, value int, value2 varchar(200), index(value)) engine=rocksdb; $file= "$ENV{MYSQL_TMP_DIR}/sst_size.dat";
create table t2 (id int primary key, value int, value2 varchar(200), index(value)) engine=rocksdb;
create table t3 (id int primary key, value int, value2 varchar(200), index(value)) engine=rocksdb; if (-f $file) {
create table t4 (id int, value int, value2 varchar(200), primary key (id) comment 'rev:cf_i', index(value) comment 'rev:cf_i') engine=rocksdb; open(F, '<', $file);
create table t5 (id int, value int, value2 varchar(200), primary key (id) comment 'rev:cf_i', index(value) comment 'rev:cf_i') engine=rocksdb; $old = <F>;
create table t6 (id int, value int, value2 varchar(200), primary key (id) comment 'rev:cf_i', index(value) comment 'rev:cf_i') engine=rocksdb; close F;
if ($old - $size < 1e6) {
--disable_query_log print "sst file reduction was not enough $old -> $size (minimum 1000kb)\n";
let $t = 1; } else {
while ($t <= 6) { print "sst file reduction ok\n";
let $i = 1;
while ($i <= 10000) {
let $insert = INSERT INTO t$t VALUES($i, $i, REPEAT('x', 150));
inc $i;
eval $insert;
} }
inc $t;
} }
--enable_query_log open(F, '>', $file);
print F $size;
# Disable auto compaction so that effects of optimize table are stable close F;
let $restart_file= $MYSQLTEST_VARDIR/tmp/mysqld.1.expect; EOF
--exec echo "wait" > $restart_file
--shutdown_server 10
--source include/wait_until_disconnected.inc
-- exec echo "restart:--rocksdb_default_cf_options=write_buffer_size=64k;target_file_size_base=64k;max_bytes_for_level_base=1m;compression_per_level=kNoCompression;disable_auto_compactions=true;level0_stop_writes_trigger=1000 " > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
-- enable_reconnect
-- source include/wait_until_connected_again.inc
select count(*) from t1;
select count(*) from t2;
select count(*) from t3;
select count(*) from t4;
select count(*) from t5;
select count(*) from t6;
delete from t1 where id <= 9900;
delete from t2 where id <= 9900;
delete from t3 where id <= 9900;
delete from t4 where id <= 9900;
delete from t5 where id <= 9900;
delete from t6 where id <= 9900;
--let $size_cmd = du -ks $datadir/.rocksdb/*.sst | awk '{t=t+\$1} END{print t}' >> $MYSQL_TMP_DIR/sst_size.dat
--exec $size_cmd
optimize table t1;
--exec $size_cmd
optimize table t3;
--exec $size_cmd
optimize table t4;
--exec $size_cmd
optimize table t6;
--exec $size_cmd
select count(*) from t1;
select count(*) from t2;
select count(*) from t3;
select count(*) from t4;
select count(*) from t5;
select count(*) from t6;
# run a check script to verify sst files reduced enough during each optimize table
--exec perl ../storage/rocksdb/mysql-test/rocksdb/optimize_table_check_sst.pl $MYSQL_TMP_DIR/sst_size.dat
#cleanup
optimize table t2;
optimize table t5;
DROP TABLE t1;
DROP TABLE t2;
DROP TABLE t3;
DROP TABLE t4;
DROP TABLE t5;
DROP TABLE t6;
--remove_file $MYSQL_TMP_DIR/sst_size.dat
...@@ -4,5 +4,78 @@ ...@@ -4,5 +4,78 @@
# OPTIMIZE TABLE statements # OPTIMIZE TABLE statements
# #
--source optimize_table.inc let datadir = `SELECT @@datadir`;
--disable_warnings
DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6;
--enable_warnings
create table t1 (id int primary key, value int, value2 varchar(200), index(value)) engine=rocksdb;
create table t2 (id int primary key, value int, value2 varchar(200), index(value)) engine=rocksdb;
create table t3 (id int primary key, value int, value2 varchar(200), index(value)) engine=rocksdb;
create table t4 (id int, value int, value2 varchar(200), primary key (id) comment 'rev:cf_i', index(value) comment 'rev:cf_i') engine=rocksdb;
create table t5 (id int, value int, value2 varchar(200), primary key (id) comment 'rev:cf_i', index(value) comment 'rev:cf_i') engine=rocksdb;
create table t6 (id int, value int, value2 varchar(200), primary key (id) comment 'rev:cf_i', index(value) comment 'rev:cf_i') engine=rocksdb;
--disable_query_log
let $t = 1;
while ($t <= 6) {
let $i = 1;
while ($i <= 10000) {
let $insert = INSERT INTO t$t VALUES($i, $i, REPEAT('x', 150));
inc $i;
eval $insert;
}
inc $t;
}
--enable_query_log
# Disable auto compaction so that effects of optimize table are stable
let $restart_file= $MYSQLTEST_VARDIR/tmp/mysqld.1.expect;
--exec echo "wait" > $restart_file
--shutdown_server 10
--source include/wait_until_disconnected.inc
-- exec echo "restart:--rocksdb_default_cf_options=write_buffer_size=64k;target_file_size_base=64k;max_bytes_for_level_base=1m;compression_per_level=kNoCompression;disable_auto_compactions=true;level0_stop_writes_trigger=1000 " > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
-- enable_reconnect
-- source include/wait_until_connected_again.inc
select count(*) from t1;
select count(*) from t2;
select count(*) from t3;
select count(*) from t4;
select count(*) from t5;
select count(*) from t6;
delete from t1 where id <= 9900;
delete from t2 where id <= 9900;
delete from t3 where id <= 9900;
delete from t4 where id <= 9900;
delete from t5 where id <= 9900;
delete from t6 where id <= 9900;
source optimize_table.inc;
optimize table t1;
source optimize_table.inc;
optimize table t3;
source optimize_table.inc;
optimize table t4;
source optimize_table.inc;
optimize table t6;
source optimize_table.inc;
select count(*) from t1;
select count(*) from t2;
select count(*) from t3;
select count(*) from t4;
select count(*) from t5;
select count(*) from t6;
#cleanup
optimize table t2;
optimize table t5;
DROP TABLE t1;
DROP TABLE t2;
DROP TABLE t3;
DROP TABLE t4;
DROP TABLE t5;
DROP TABLE t6;
--remove_file $MYSQL_TMP_DIR/sst_size.dat
...@@ -33,7 +33,6 @@ select cf_name, option_type, value ...@@ -33,7 +33,6 @@ select cf_name, option_type, value
order by cf_name, option_type; order by cf_name, option_type;
# restart with cf configs for cf1 and cf2 # restart with cf configs for cf1 and cf2
--exec echo "" > $MYSQLTEST_VARDIR/log/mysqld.1.err
--let $restart_parameters=--rocksdb_override_cf_options=cf1={write_buffer_size=8m;target_file_size_base=2m};cf2={write_buffer_size=16m;max_bytes_for_level_multiplier=8};z={target_file_size_base=4m}; --let $restart_parameters=--rocksdb_override_cf_options=cf1={write_buffer_size=8m;target_file_size_base=2m};cf2={write_buffer_size=16m;max_bytes_for_level_multiplier=8};z={target_file_size_base=4m};
--source include/restart_mysqld.inc --source include/restart_mysqld.inc
......
$file=$ARGV[0];
$total=$ARGV[1];
$pct=$ARGV[2];
open($fh, "<", $file) or die $!;
while(readline($fh)) {
if (/(\d+) index entries checked \((\d+) had checksums/) {
if ($1 == $total && $2 >= $total*($pct-2)/100 && $2 <= $total*($pct+2)/100) {
printf("%d index entries had around %d checksums\n", $total, $total*$pct/100);
}
}elsif (/(\d+) table records had checksums/) {
if ($1 >= $total*($pct-2)/100 && $1 <= $total*($pct+2)/100) {
printf("Around %d table records had checksums\n", $total*$pct/100);
}
}
}
--source include/have_rocksdb.inc --source include/have_rocksdb.inc
# Does not run on Windows, because of unixisms (exec grep, cut, truncate file with exec echo)
--source include/not_windows.inc
# #
# Tests for row checksums feature # Tests for row checksums feature
...@@ -11,20 +9,14 @@ set @save_rocksdb_store_row_debug_checksums=@@global.rocksdb_store_row_debug_che ...@@ -11,20 +9,14 @@ set @save_rocksdb_store_row_debug_checksums=@@global.rocksdb_store_row_debug_che
set @save_rocksdb_verify_row_debug_checksums=@@global.rocksdb_verify_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; 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%'; show variables like 'rocksdb_%checksum%';
create table t1 (pk int primary key, a int, b int, key(a), key(b)) engine=rocksdb; 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); insert into t1 values (1,1,1),(2,2,2),(3,3,3);
check table t1; check table t1;
--exec grep "^[0-9-]* \?[0-9:]* [0-9]* \[Note\] CHECKTABLE t1" $MYSQLTEST_VARDIR/log/mysqld.1.err | cut -d] -f2 --let SEARCH_FILE=$MYSQLTEST_VARDIR/log/mysqld.1.err
--let SEARCH_PATTERN=0 table records had checksums
--source include/search_pattern_in_file.inc
drop table t1; drop table t1;
...@@ -32,7 +24,8 @@ set session rocksdb_store_row_debug_checksums=on; ...@@ -32,7 +24,8 @@ 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; 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); insert into t2 values (1,1,1),(2,2,2),(3,3,3);
check table t2; check table t2;
--exec grep "^[0-9-]* \?[0-9:]* [0-9]* \[Note\] CHECKTABLE t2" $MYSQLTEST_VARDIR/log/mysqld.1.err | cut -d] -f2 --let SEARCH_PATTERN=3 table records had checksums
--source include/search_pattern_in_file.inc
--echo # Now, make a table that has both rows with checksums and without --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; create table t3 (pk int primary key, a int, b int, key(a), key(b)) engine=rocksdb;
...@@ -41,7 +34,8 @@ set session rocksdb_store_row_debug_checksums=off; ...@@ -41,7 +34,8 @@ set session rocksdb_store_row_debug_checksums=off;
update t3 set b=3 where a=2; update t3 set b=3 where a=2;
set session rocksdb_store_row_debug_checksums=on; set session rocksdb_store_row_debug_checksums=on;
check table t3; check table t3;
--exec grep "^[0-9-]* \?[0-9:]* [0-9]* \[Note\] CHECKTABLE t3" $MYSQLTEST_VARDIR/log/mysqld.1.err | cut -d] -f2 --let SEARCH_PATTERN=2 table records had checksums
--source include/search_pattern_in_file.inc
set session rocksdb_store_row_debug_checksums=on; set session rocksdb_store_row_debug_checksums=on;
set session rocksdb_checksums_pct=5; set session rocksdb_checksums_pct=5;
...@@ -58,9 +52,27 @@ while ($i<10000) ...@@ -58,9 +52,27 @@ while ($i<10000)
} }
--enable_query_log --enable_query_log
check table t4; 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 perl;
--exec perl ../storage/rocksdb/mysql-test/rocksdb/t/rocksdb_checksums.pl $MYSQL_TMP_DIR/rocksdb_checksums.log 10000 5 use autodie qw(open);
--remove_file $MYSQL_TMP_DIR/rocksdb_checksums.log $total=10000;
$pct=5;
@out=();
open(F, '<', "$ENV{MYSQLTEST_VARDIR}/log/mysqld.1.err");
while(<F>) {
@out=() if /^CURRENT_TEST:/;
if (/(\d+) index entries checked \((\d+) had checksums/) {
if ($1 == $total and $2 >= $total*($pct-2)/100 and $2 <= $total*($pct+2)/100) {
push @out, sprintf "%d index entries had around %d checksums\n", $total, $total*$pct/100;
}
} elsif (/(\d+) table records had checksums/) {
if ($1 >= $total*($pct-2)/100 and $1 <= $total*($pct+2)/100) {
push @out, sprintf "Around %d table records had checksums\n", $total*$pct/100;
}
}
}
print @out;
EOF
set session rocksdb_checksums_pct=100; set session rocksdb_checksums_pct=100;
--echo # --echo #
......
--source include/have_rocksdb.inc --source include/have_rocksdb.inc
# Unixisms (exec ls | wc -l)
--source include/not_windows.inc
let $ddir = $MYSQL_TMP_DIR/.rocksdb_datadir.test.install.db; let $ddir = $MYSQL_TMP_DIR/.rocksdb_datadir.test.install.db;
let $rdb_ddir = $MYSQL_TMP_DIR/.rocksdb_datadir.test; let $rdb_ddir = $MYSQL_TMP_DIR/.rocksdb_datadir.test;
let $sql_file = $MYSQL_TMP_DIR/rocksdb_datadir.sql; let $sql_file = $MYSQL_TMP_DIR/rocksdb_datadir.sql;
--write_file $sql_file --write_file $sql_file
DROP DATABASE IF EXISTS mysqltest;
CREATE DATABASE mysqltest; CREATE DATABASE mysqltest;
USE mysqltest; USE mysqltest;
CREATE TABLE t1 (a INT PRIMARY KEY); CREATE TABLE t1 (a INT PRIMARY KEY);
...@@ -14,6 +11,7 @@ INSERT INTO t1 VALUES(42); ...@@ -14,6 +11,7 @@ INSERT INTO t1 VALUES(42);
SET GLOBAL rocksdb_force_flush_memtable_now = 1; SET GLOBAL rocksdb_force_flush_memtable_now = 1;
SELECT sleep(1); SELECT sleep(1);
DROP TABLE t1; DROP TABLE t1;
DROP DATABASE mysqltest;
EOF EOF
# Must ensure this directory exists before launching mysqld # Must ensure this directory exists before launching mysqld
...@@ -23,10 +21,13 @@ let $plugin_dir=`select @@plugin_dir`; ...@@ -23,10 +21,13 @@ let $plugin_dir=`select @@plugin_dir`;
# Launch mysqld with non-standard rocksdb_datadir # Launch mysqld with non-standard rocksdb_datadir
exec $MYSQLD_BOOTSTRAP_CMD --plugin-dir=$plugin_dir --plugin-load=$HA_ROCKSDB_SO --datadir=$ddir --rocksdb_datadir=$rdb_ddir --default-storage-engine=rocksdb --skip-innodb --default-tmp-storage-engine=MyISAM --rocksdb < $sql_file; exec $MYSQLD_BOOTSTRAP_CMD --plugin-dir=$plugin_dir --plugin-load=$HA_ROCKSDB_SO --datadir=$ddir --rocksdb_datadir=$rdb_ddir --default-storage-engine=rocksdb --skip-innodb --default-tmp-storage-engine=MyISAM --rocksdb < $sql_file;
--echo Check for the number of MANIFEST files --echo Check for MANIFEST files
exec ls $rdb_ddir/MANIFEST-0000* | wc -l; --list_files $rdb_ddir MANIFEST-0000*
# Clean up # Clean up
exec rm -rf $ddir; remove_files_wildcard $ddir *;
remove_files_wildcard $ddir *;
remove_files_wildcard $rdb_ddir *; remove_files_wildcard $rdb_ddir *;
rmdir $ddir;
rmdir $rdb_ddir;
remove_file $sql_file; remove_file $sql_file;
...@@ -11,10 +11,13 @@ if ($succeeds) ...@@ -11,10 +11,13 @@ if ($succeeds)
eval SET GLOBAL ROCKSDB_CREATE_CHECKPOINT = '$checkpoint'; eval SET GLOBAL ROCKSDB_CREATE_CHECKPOINT = '$checkpoint';
# Check checkpoint # Check checkpoint
--exec ls $checkpoint/CURRENT | sed s/.*CURRENT/CURRENT/g --list_files $checkpoint CURRENT
# Cleanup # Cleanup
--exec rm -rf $checkpoint --remove_files_wildcard $checkpoint *
--rmdir $checkpoint
--disable_abort_on_error
--enable_abort_on_error
} }
if (!$succeeds) if (!$succeeds)
{ {
......
#!/bin/bash
sst_dump=$2
wait_for_no_more_deletes=$3
num_retries=240
retry=0
echo "wait_for_delete: $wait_for_no_more_deletes"
while : ; do
TOTAL_D=0
TOTAL_E=0
for f in `ls $1/mysqld.1/data/.rocksdb/*.sst`
do
# excluding system cf
DELETED=`$sst_dump --command=scan --output_hex --file=$f | \
perl -ne 'print if(/''(\d\d\d\d\d\d\d\d)/ && $1 >= 8)' | \
grep -e ": 0" -e ": 7" | wc -l`
EXISTS=`$sst_dump --command=scan --output_hex --file=$f | \
perl -ne 'print if(/''(\d\d\d\d\d\d\d\d)/ && $1 >= 8)' | \
grep ": 1" | wc -l`
TOTAL_D=$(($TOTAL_D+$DELETED))
TOTAL_E=$(($TOTAL_E+$EXISTS))
# echo "${f##*/} $DELETED $EXISTS"
done
if [ $TOTAL_E != "0" ]
then
if [ $TOTAL_D = "0" ] || [ $wait_for_no_more_deletes = "0" ]
then
break
fi
fi
if [ $retry -ge $num_retries ]
then
break
fi
sleep 1
retry=$(($retry + 1))
done
if [ "$TOTAL_E" = "0" ]
then
echo "No records in the database"
exit
fi
if [ "$TOTAL_D" = "0" ]
then
echo "No more deletes left"
else
echo "There are deletes left"
fi
...@@ -10,15 +10,15 @@ connect (con2,localhost,root,,); ...@@ -10,15 +10,15 @@ connect (con2,localhost,root,,);
connection con1; connection con1;
CREATE TABLE t1 (id1 INT NOT NULL, id2 INT NOT NULL, id3 VARCHAR(32), eval CREATE TABLE t1 (id1 INT NOT NULL, id2 INT NOT NULL, id3 VARCHAR(32),
id4 INT, id5 VARCHAR(32), id4 INT, id5 VARCHAR(32),
value1 INT, value2 INT, value3 VARCHAR(32), value1 INT, value2 INT, value3 VARCHAR(32),
PRIMARY KEY (id1, id2) ##CF##, PRIMARY KEY (id1, id2) $CF,
UNIQUE INDEX (id2, id1) ##CF##, UNIQUE INDEX (id2, id1) $CF,
UNIQUE INDEX (id2, id3, id4) ##CF##, UNIQUE INDEX (id2, id3, id4) $CF,
INDEX (id1) ##CF##, INDEX (id1) $CF,
INDEX (id3, id1) ##CF##, INDEX (id3, id1) $CF,
UNIQUE INDEX(id5) ##CF##, UNIQUE INDEX(id5) $CF,
INDEX (id2, id5)) ENGINE=ROCKSDB; INDEX (id2, id5)) ENGINE=ROCKSDB;
--disable_query_log --disable_query_log
......
--source include/have_rocksdb.inc --source include/have_rocksdb.inc
--source include/have_partition.inc --source include/have_partition.inc
# Unixism, exec sed
--source include/not_windows.inc
let ddl= $MYSQL_TMP_DIR/unique_sec.sql; --let $CF=
--exec sed s/##CF##//g ../storage/rocksdb/mysql-test/rocksdb/t/unique_sec.inc > $ddl --source unique_sec.inc
--source $ddl
--echo # --echo #
--echo # Issue #88: Creating unique index over column with duplicate values succeeds --echo # Issue #88: Creating unique index over column with duplicate values succeeds
......
--source include/have_rocksdb.inc --source include/have_rocksdb.inc
let ddl= $MYSQL_TMP_DIR/unique_sec_rev_cf.sql; let $CF=COMMENT 'rev:cf';
--exec sed s/##CF##/" COMMENT 'rev:cf'"/g ../storage/rocksdb/mysql-test/rocksdb/t/unique_sec.inc > $ddl --source unique_sec.inc
--source $ddl
--source include/have_rocksdb.inc --source include/have_rocksdb.inc
call mtr.add_suppression("rocksdb");
call mtr.add_suppression("Aborting");
# Issue221 # Issue221
# Turning on both --rocksdb-allow-mmap-reads and --rocksdb-use-direct-reads # Turning on both --rocksdb-allow-mmap-reads and --rocksdb-use-direct-reads
# caused an assertion in RocksDB. Now it should not be allowed and the # caused an assertion in RocksDB. Now it should not be allowed and the
...@@ -12,9 +15,6 @@ ...@@ -12,9 +15,6 @@
--exec echo "wait" >$_expect_file_name --exec echo "wait" >$_expect_file_name
shutdown_server 10; shutdown_server 10;
# Clear the log
--exec echo "" >$MYSQLTEST_VARDIR/log/mysqld.1.err
# Attempt to restart the server with invalid options # Attempt to restart the server with invalid options
--exec echo "restart:--rocksdb_use_direct_reads=1 --rocksdb_allow_mmap_reads=1" >$_expect_file_name --exec echo "restart:--rocksdb_use_direct_reads=1 --rocksdb_allow_mmap_reads=1" >$_expect_file_name
--sleep 0.1 # Wait 100ms - that is how long the sleep is in check_expected_crash_and_restart --sleep 0.1 # Wait 100ms - that is how long the sleep is in check_expected_crash_and_restart
...@@ -26,7 +26,9 @@ shutdown_server 10; ...@@ -26,7 +26,9 @@ shutdown_server 10;
--disable_reconnect --disable_reconnect
# We should now have an error message # We should now have an error message
--exec grep "enable both use_direct_reads" $MYSQLTEST_VARDIR/log/mysqld.1.err | cut -d] -f2 let SEARCH_FILE=$MYSQLTEST_VARDIR/log/mysqld.1.err;
let SEARCH_PATTERN=enable both use_direct_reads;
source include/search_pattern_in_file.inc;
# Repeat with --rocksdb-use-direct-writes # Repeat with --rocksdb-use-direct-writes
--let $_server_id= `SELECT @@server_id` --let $_server_id= `SELECT @@server_id`
...@@ -34,8 +36,6 @@ shutdown_server 10; ...@@ -34,8 +36,6 @@ shutdown_server 10;
--exec echo "wait" >$_expect_file_name --exec echo "wait" >$_expect_file_name
shutdown_server 10; shutdown_server 10;
--exec echo "" >$MYSQLTEST_VARDIR/log/mysqld.1.err
--exec echo "restart:--rocksdb_use_direct_writes=1 --rocksdb_allow_mmap_writes=1" >$_expect_file_name --exec echo "restart:--rocksdb_use_direct_writes=1 --rocksdb_allow_mmap_writes=1" >$_expect_file_name
--sleep 0.1 --sleep 0.1
--exec echo "restart:" >$_expect_file_name --exec echo "restart:" >$_expect_file_name
...@@ -44,4 +44,5 @@ shutdown_server 10; ...@@ -44,4 +44,5 @@ shutdown_server 10;
--source include/wait_until_connected_again.inc --source include/wait_until_connected_again.inc
--disable_reconnect --disable_reconnect
--exec grep "enable both use_direct_writes" $MYSQLTEST_VARDIR/log/mysqld.1.err | cut -d] -f2 let SEARCH_PATTERN=enable both use_direct_writes;
source include/search_pattern_in_file.inc;
...@@ -10,9 +10,7 @@ ...@@ -10,9 +10,7 @@
# it in the log bug still start: --rocksdb_validate_tables=2 # it in the log bug still start: --rocksdb_validate_tables=2
# #
--disable_warnings call mtr.add_suppression('RocksDB: Schema mismatch');
DROP TABLE IF EXISTS t1, t2;
--enable_warnings
CREATE TABLE t1 (pk int primary key) ENGINE=ROCKSDB; CREATE TABLE t1 (pk int primary key) ENGINE=ROCKSDB;
CREATE TABLE t2 (pk int primary key) ENGINE=ROCKSDB PARTITION BY KEY(pk) PARTITIONS 4; CREATE TABLE t2 (pk int primary key) ENGINE=ROCKSDB PARTITION BY KEY(pk) PARTITIONS 4;
...@@ -44,54 +42,48 @@ shutdown_server 10; ...@@ -44,54 +42,48 @@ shutdown_server 10;
--exec echo "wait" >$_expect_file_name --exec echo "wait" >$_expect_file_name
shutdown_server 10; shutdown_server 10;
# Clear the log
--exec echo "" >$MYSQLTEST_VARDIR/log/mysqld.1.err
# Rename the file # Rename the file
--exec mv $MYSQLTEST_VARDIR/mysqld.1/data/test/t1.frm $MYSQLTEST_VARDIR/mysqld.1/data/test/t1.frm.tmp --move_file $MYSQLTEST_VARDIR/mysqld.1/data/test/t1.frm $MYSQLTEST_VARDIR/mysqld.1/data/test/t1.frm.tmp
--exec mv $MYSQLTEST_VARDIR/mysqld.1/data/test/t2.frm $MYSQLTEST_VARDIR/mysqld.1/data/test/t2.frm.tmp --move_file $MYSQLTEST_VARDIR/mysqld.1/data/test/t2.frm $MYSQLTEST_VARDIR/mysqld.1/data/test/t2.frm.tmp
# Attempt to restart the server # Attempt to restart the server
--exec echo "restart:--rocksdb_validate_tables=2" >$_expect_file_name --exec echo "restart:--rocksdb_validate_tables=2" >$_expect_file_name
--sleep 5
--enable_reconnect --enable_reconnect
--source include/wait_until_connected_again.inc --source include/wait_until_connected_again.inc
--disable_reconnect --disable_reconnect
# We should now have an error message # We should now have an error message
--exec echo "Expect errors that we are missing two .frm files" --echo "Expect errors that we are missing two .frm files"
--exec grep "Schema mismatch" $MYSQLTEST_VARDIR/log/mysqld.1.err | cut -d] -f2 --let SEARCH_FILE=$MYSQLTEST_VARDIR/log/mysqld.1.err
--let SEARCH_PATTERN=Schema mismatch
--source include/search_pattern_in_file.inc
# Now shut down again and rename one the .frm file back and make a copy of it # Now shut down again and rename one the .frm file back and make a copy of it
--exec echo "wait" >$_expect_file_name --exec echo "wait" >$_expect_file_name
shutdown_server 10; shutdown_server 10;
# Clear the log
--exec echo "" >$MYSQLTEST_VARDIR/log/mysqld.1.err
# Rename the file # Rename the file
--exec mv $MYSQLTEST_VARDIR/mysqld.1/data/test/t1.frm.tmp $MYSQLTEST_VARDIR/mysqld.1/data/test/t1.frm --move_file $MYSQLTEST_VARDIR/mysqld.1/data/test/t1.frm.tmp $MYSQLTEST_VARDIR/mysqld.1/data/test/t1.frm
--exec mv $MYSQLTEST_VARDIR/mysqld.1/data/test/t2.frm.tmp $MYSQLTEST_VARDIR/mysqld.1/data/test/t2.frm --move_file $MYSQLTEST_VARDIR/mysqld.1/data/test/t2.frm.tmp $MYSQLTEST_VARDIR/mysqld.1/data/test/t2.frm
--exec cp $MYSQLTEST_VARDIR/mysqld.1/data/test/t1.frm $MYSQLTEST_VARDIR/mysqld.1/data/test/t1_dummy.frm --copy_file $MYSQLTEST_VARDIR/mysqld.1/data/test/t1.frm $MYSQLTEST_VARDIR/mysqld.1/data/test/t1_dummy.frm
# Attempt to restart the server # Attempt to restart the server
--exec echo "restart:--rocksdb_validate_tables=2" >$_expect_file_name --exec echo "restart:--rocksdb_validate_tables=2" >$_expect_file_name
--sleep 5
--enable_reconnect --enable_reconnect
--source include/wait_until_connected_again.inc --source include/wait_until_connected_again.inc
--disable_reconnect --disable_reconnect
# We should now have an error message for the second case # We should now have an error message for the second case
--exec echo "Expect an error that we have an extra .frm file" --echo "Expect an error that we have an extra .frm file"
--exec grep "Schema mismatch" $MYSQLTEST_VARDIR/log/mysqld.1.err | cut -d] -f2 --let SEARCH_PATTERN=Schema mismatch
--source include/search_pattern_in_file.inc
# Shut down an clean up # Shut down an clean up
--exec echo "wait" >$_expect_file_name --exec echo "wait" >$_expect_file_name
shutdown_server 10; shutdown_server 10;
--exec echo "" >$MYSQLTEST_VARDIR/log/mysqld.1.err --remove_file $MYSQLTEST_VARDIR/mysqld.1/data/test/t1_dummy.frm
--exec rm $MYSQLTEST_VARDIR/mysqld.1/data/test/t1_dummy.frm
--exec echo "restart" >$_expect_file_name --exec echo "restart" >$_expect_file_name
--enable_reconnect --enable_reconnect
--source include/wait_until_connected_again.inc --source include/wait_until_connected_again.inc
......
...@@ -6,7 +6,7 @@ SET GLOBAL rocksdb_write_ignore_missing_column_families=true; ...@@ -6,7 +6,7 @@ SET GLOBAL rocksdb_write_ignore_missing_column_families=true;
create table aaa (id int primary key, i int) engine rocksdb; create table aaa (id int primary key, i int) engine rocksdb;
set @save_rocksdb_flush_log_at_trx_commit= @@global.rocksdb_flush_log_at_trx_commit; set @save_rocksdb_flush_log_at_trx_commit= @@global.rocksdb_flush_log_at_trx_commit;
SET LOCAL rocksdb_flush_log_at_trx_commit=0; SET LOCAL rocksdb_flush_log_at_trx_commit=0;
--exec sleep 30 sleep 30;
select variable_value into @a from information_schema.global_status where variable_name='rocksdb_wal_synced'; select variable_value into @a from information_schema.global_status where variable_name='rocksdb_wal_synced';
insert aaa(id, i) values(1,1); insert aaa(id, i) values(1,1);
select variable_value-@a from information_schema.global_status where variable_name='rocksdb_wal_synced'; select variable_value-@a from information_schema.global_status where variable_name='rocksdb_wal_synced';
......
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