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()
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';
END//
drop table if exists t1;
Warnings:
Note 1051 Unknown table 'test.t1'
drop table if exists t2;
Warnings:
Note 1051 Unknown table 'test.t2'
create table t1 (
create or replace table t1 (
id1 bigint not null,
id2 bigint not null,
id3 varchar(100) not null,
......@@ -21,15 +15,15 @@ id4 int not null,
id5 int not null,
value bigint,
value2 varchar(100),
primary key (id1, id2, id3, id4),
index id2 (id2),
index id2_id1 (id2, id1),
index id2_id3 (id2, id3),
index id2_id4 (id2, id4),
index id2_id3_id1_id4 (id2, id3, id1, id4),
index id3_id2 (id3, id2)
primary key (id1, id2, id3, id4) ,
index id2 (id2) ,
index id2_id1 (id2, id1) ,
index id2_id3 (id2, id3) ,
index id2_id4 (id2, id4) ,
index id2_id3_id1_id4 (id2, id3, id1, id4) ,
index id3_id2 (id3, id2)
) engine=ROCKSDB;
create table t2 (
create or replace table t2 (
id1 bigint not null,
id2 bigint not null,
id3 varchar(100) not null,
......@@ -37,14 +31,18 @@ id4 int not null,
id5 int not null,
value bigint,
value2 varchar(100),
primary key (id4),
index id2 (id2),
index id2_id3 (id2, id3),
index id2_id4 (id2, id4),
index id2_id4_id5 (id2, id4, id5),
index id3_id4 (id3, id4),
index id3_id5 (id3, id5)
primary key (id4) ,
index id2 (id2) ,
index id2_id3 (id2, id3) ,
index id2_id4 (id2, id4) ,
index id2_id4_id5 (id2, id4, id5) ,
index id3_id4 (id3, id4) ,
index id3_id5 (id3, id5)
) 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();
select count(*) from t1;
count(*)
......@@ -409,9 +407,7 @@ count(*)
call bloom_end();
checked
false
drop table if exists t1;
drop table if exists t2;
create table t1 (
create or replace table t1 (
id1 bigint not null,
id2 bigint not null,
id3 varchar(100) not null,
......@@ -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 id3_id2 (id3, id2) COMMENT 'cf_short_prefix'
) engine=ROCKSDB;
create table t2 (
create or replace table t2 (
id1 bigint not null,
id2 bigint not null,
id3 varchar(100) not null,
......@@ -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_id5 (id3, id5) COMMENT 'cf_short_prefix'
) 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();
select count(*) from t1;
count(*)
......@@ -807,9 +807,7 @@ count(*)
call bloom_end();
checked
true
drop table if exists t1;
drop table if exists t2;
create table t1 (
create or replace table t1 (
id1 bigint not null,
id2 bigint not null,
id3 varchar(100) not null,
......@@ -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 id3_id2 (id3, id2) COMMENT 'cf_long_prefix'
) engine=ROCKSDB;
create table t2 (
create or replace table t2 (
id1 bigint not null,
id2 bigint not null,
id3 varchar(100) not null,
......@@ -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_id5 (id3, id5) COMMENT 'cf_long_prefix'
) 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();
select count(*) from t1;
count(*)
......
......@@ -7,13 +7,7 @@ CREATE PROCEDURE bloom_end()
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';
END//
drop table if exists t1;
Warnings:
Note 1051 Unknown table 'test.t1'
drop table if exists t2;
Warnings:
Note 1051 Unknown table 'test.t2'
create table t1 (
create or replace table t1 (
id1 bigint not null,
id2 bigint not null,
id3 varchar(100) not null,
......@@ -21,15 +15,15 @@ id4 int not null,
id5 int not null,
value bigint,
value2 varchar(100),
primary key (id1, id2, id3, id4),
index id2 (id2),
index id2_id1 (id2, id1),
index id2_id3 (id2, id3),
index id2_id4 (id2, id4),
index id2_id3_id1_id4 (id2, id3, id1, id4),
index id3_id2 (id3, id2)
primary key (id1, id2, id3, id4) ,
index id2 (id2) ,
index id2_id1 (id2, id1) ,
index id2_id3 (id2, id3) ,
index id2_id4 (id2, id4) ,
index id2_id3_id1_id4 (id2, id3, id1, id4) ,
index id3_id2 (id3, id2)
) engine=ROCKSDB;
create table t2 (
create or replace table t2 (
id1 bigint not null,
id2 bigint not null,
id3 varchar(100) not null,
......@@ -37,14 +31,18 @@ id4 int not null,
id5 int not null,
value bigint,
value2 varchar(100),
primary key (id4),
index id2 (id2),
index id2_id3 (id2, id3),
index id2_id4 (id2, id4),
index id2_id4_id5 (id2, id4, id5),
index id3_id4 (id3, id4),
index id3_id5 (id3, id5)
primary key (id4) ,
index id2 (id2) ,
index id2_id3 (id2, id3) ,
index id2_id4 (id2, id4) ,
index id2_id4_id5 (id2, id4, id5) ,
index id3_id4 (id3, id4) ,
index id3_id5 (id3, id5)
) 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();
select count(*) from t1;
count(*)
......@@ -409,9 +407,7 @@ count(*)
call bloom_end();
checked
false
drop table if exists t1;
drop table if exists t2;
create table t1 (
create or replace table t1 (
id1 bigint not null,
id2 bigint not null,
id3 varchar(100) not null,
......@@ -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 id3_id2 (id3, id2) COMMENT 'cf_short_prefix'
) engine=ROCKSDB;
create table t2 (
create or replace table t2 (
id1 bigint not null,
id2 bigint not null,
id3 varchar(100) not null,
......@@ -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_id5 (id3, id5) COMMENT 'cf_short_prefix'
) 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();
select count(*) from t1;
count(*)
......@@ -807,9 +807,7 @@ count(*)
call bloom_end();
checked
false
drop table if exists t1;
drop table if exists t2;
create table t1 (
create or replace table t1 (
id1 bigint not null,
id2 bigint not null,
id3 varchar(100) not null,
......@@ -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 id3_id2 (id3, id2) COMMENT 'cf_long_prefix'
) engine=ROCKSDB;
create table t2 (
create or replace table t2 (
id1 bigint not null,
id2 bigint not null,
id3 varchar(100) not null,
......@@ -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_id5 (id3, id5) COMMENT 'cf_long_prefix'
) 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();
select count(*) from t1;
count(*)
......
......@@ -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).
DROP TABLE t2;
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;
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]";
......@@ -118,7 +118,7 @@ ERROR HY000: Unsupported collation on string indexed column test.c.value Use bin
DROP TABLE a, b;
call mtr.add_suppression("Invalid pattern in strict_collation_exceptions:");
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;
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";
......
......@@ -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_file_size=0;
set global rocksdb_force_flush_memtable_now=1;
select sleep(1);
sleep(1)
0
wait_for_delete: 0
There are deletes left
SET GLOBAL rocksdb_compaction_sequential_deletes= 0;
......@@ -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_file_size=0;
set global rocksdb_force_flush_memtable_now=1;
select sleep(1);
sleep(1)
0
wait_for_delete: 1
No more deletes left
SET GLOBAL rocksdb_compaction_sequential_deletes= 0;
......@@ -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_file_size=1000000;
set global rocksdb_force_flush_memtable_now=1;
select sleep(1);
sleep(1)
0
wait_for_delete: 0
There are deletes left
SET GLOBAL rocksdb_compaction_sequential_deletes= 0;
......@@ -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_file_size=0;
set global rocksdb_force_flush_memtable_now=1;
select sleep(1);
sleep(1)
0
wait_for_delete: 1
No more deletes left
SET GLOBAL rocksdb_compaction_sequential_deletes= 0;
......@@ -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_file_size=0;
set global rocksdb_force_flush_memtable_now=1;
select sleep(1);
sleep(1)
0
wait_for_delete: 1
No more deletes left
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 t2;
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 t2;
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;
set global rocksdb_compact_cf = 'cf1';
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';
/*!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 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`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `r1` (
`id1` int(11) NOT NULL DEFAULT '0',
`id2` int(11) NOT NULL DEFAULT '0',
`id3` varchar(100) NOT NULL DEFAULT '',
`id4` int(11) NOT NULL DEFAULT '0',
`id1` int(11) NOT NULL,
`id2` int(11) NOT NULL,
`id3` varchar(100) NOT NULL,
`id4` int(11) NOT NULL,
`value1` int(11) DEFAULT NULL,
`value2` int(11) DEFAULT NULL,
`value3` int(11) DEFAULT NULL,
......@@ -90,15 +91,16 @@ SET GLOBAL default_storage_engine=rocksdb;
/*!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' */;
/*!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`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `r1` (
`id1` int(11) NOT NULL DEFAULT '0',
`id2` int(11) NOT NULL DEFAULT '0',
`id3` varchar(100) NOT NULL DEFAULT '',
`id4` int(11) NOT NULL DEFAULT '0',
`id1` int(11) NOT NULL,
`id2` int(11) NOT NULL,
`id3` varchar(100) NOT NULL,
`id4` int(11) NOT NULL,
`value1` int(11) DEFAULT NULL,
`value2` int(11) DEFAULT NULL,
`value3` int(11) DEFAULT NULL,
......@@ -136,15 +138,16 @@ UNLOCK TABLES;
/*!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' */;
/*!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`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `r1` (
`id1` int(11) NOT NULL DEFAULT '0',
`id2` int(11) NOT NULL DEFAULT '0',
`id3` varchar(100) NOT NULL DEFAULT '',
`id4` int(11) NOT NULL DEFAULT '0',
`id1` int(11) NOT NULL,
`id2` int(11) NOT NULL,
`id3` varchar(100) NOT NULL,
`id4` int(11) NOT NULL,
`value1` int(11) DEFAULT NULL,
`value2` int(11) DEFAULT NULL,
`value3` int(11) DEFAULT NULL,
......
......@@ -32,15 +32,19 @@ delete from t6 where id <= 9900;
optimize table t1;
Table Op Msg_type Msg_text
test.t1 optimize status OK
sst file reduction ok
optimize table t3;
Table Op Msg_type Msg_text
test.t3 optimize status OK
sst file reduction ok
optimize table t4;
Table Op Msg_type Msg_text
test.t4 optimize status OK
sst file reduction ok
optimize table t6;
Table Op Msg_type Msg_text
test.t6 optimize status OK
sst file reduction ok
select count(*) from t1;
count(*)
100
......@@ -59,14 +63,6 @@ count(*)
select count(*) from t6;
count(*)
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;
Table Op Msg_type Msg_text
test.t2 optimize status OK
......
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;
drop table if exists t1,t2,t3;
show variables like 'rocksdb_%checksum%';
Variable_name Value
rocksdb_checksums_pct 100
......@@ -12,12 +11,7 @@ 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
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
FOUND 1 /0 table records had checksums/ in mysqld.1.err
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;
......@@ -25,12 +19,7 @@ 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
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
FOUND 1 /3 table records had checksums/ in mysqld.1.err
# 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);
......@@ -40,12 +29,7 @@ set session rocksdb_store_row_debug_checksums=on;
check table t3;
Table Op Msg_type Msg_text
test.t3 check status OK
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
FOUND 1 /2 table records had checksums/ in mysqld.1.err
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;
......
Check for the number of MANIFEST files
1
Check for MANIFEST files
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;
set global rocksdb_compact_cf = 'cf1';
set global rocksdb_compact_cf = 'rev:cf2';
......
......@@ -5,12 +5,12 @@ connection con1;
CREATE TABLE t1 (id1 INT NOT NULL, id2 INT NOT NULL, id3 VARCHAR(32),
id4 INT, id5 VARCHAR(32),
value1 INT, value2 INT, value3 VARCHAR(32),
PRIMARY KEY (id1, id2) ,
UNIQUE INDEX (id2, id1) ,
UNIQUE INDEX (id2, id3, id4) ,
INDEX (id1) ,
INDEX (id3, id1) ,
UNIQUE INDEX(id5) ,
PRIMARY KEY (id1, id2) ,
UNIQUE INDEX (id2, id1) ,
UNIQUE INDEX (id2, id3, id4) ,
INDEX (id1) ,
INDEX (id3, id1) ,
UNIQUE INDEX(id5) ,
INDEX (id2, id5)) ENGINE=ROCKSDB;
SELECT COUNT(*) FROM t1;
COUNT(*)
......
RocksDB: Can't enable both use_direct_reads and allow_mmap_reads
RocksDB: Can't enable both use_direct_writes and allow_mmap_writes
call mtr.add_suppression("rocksdb");
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 t2 (pk int primary key) ENGINE=ROCKSDB PARTITION BY KEY(pk) PARTITIONS 4;
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
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
RocksDB: Schema mismatch - A .frm file exists for table test.t1_dummy, but that table is not registered in RocksDB
"Expect errors that we are missing two .frm files"
FOUND 2 /Schema mismatch/ in mysqld.1.err
"Expect an error that we have an extra .frm file"
FOUND 3 /Schema mismatch/ in mysqld.1.err
DROP TABLE t1, t2;
package My::Suite::Rocksdb_sys_vars;
package My::Suite::Rocksdb;
@ISA = qw(My::Suite);
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 { };
--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 //;
CREATE PROCEDURE bloom_start()
BEGIN
......@@ -17,20 +14,20 @@ DELIMITER ;//
#BF is sometimes invoked and useful
--exec sed s/##CF##//g $tmpl_ddl > $ddl
--source $ddl
--source t/bloomfilter_load_select.inc
--let $CF=
--source bloomfilter_table_def.inc
--source bloomfilter_load_select.inc
#BF is always invoked but not useful at all
--exec sed s/##CF##/" COMMENT 'cf_short_prefix'"/g $tmpl_ddl > $ddl
--source $ddl
--source t/bloomfilter_load_select.inc
--let $CF=COMMENT 'cf_short_prefix'
--source bloomfilter_table_def.inc
--source bloomfilter_load_select.inc
#BF is most of the time invoked and useful
--exec sed s/##CF##/" COMMENT 'cf_long_prefix'"/g $tmpl_ddl > $ddl
--source $ddl
--source t/bloomfilter_load_select.inc
--let $CF=COMMENT 'cf_long_prefix'
--source bloomfilter_table_def.inc
--source bloomfilter_load_select.inc
# 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;
......@@ -60,4 +57,3 @@ optimize table t2;
drop table if exists t1;
drop table if exists t2;
drop table if exists r1;
--remove_file $ddl
source include/have_sequence.inc;
# 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
--exec perl ../storage/rocksdb/mysql-test/rocksdb/t/gen_insert.pl t2 > $MYSQL_TMP_DIR/insert_t2.sql
--disable_query_log
--source $MYSQL_TMP_DIR/insert_t1.sql
--source $MYSQL_TMP_DIR/insert_t2.sql
--enable_query_log
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;
# BF conditions (prefix short(4B)|medium(20B)|long(240B))
#0 no eq condition (o, x, x)
......
drop table if exists t1;
drop table if exists t2;
create table t1 (
eval create or replace table t1 (
id1 bigint not null,
id2 bigint not null,
id3 varchar(100) not null,
......@@ -8,16 +6,16 @@ create table t1 (
id5 int not null,
value bigint,
value2 varchar(100),
primary key (id1, id2, id3, id4)##CF##,
index id2 (id2)##CF##,
index id2_id1 (id2, id1)##CF##,
index id2_id3 (id2, id3)##CF##,
index id2_id4 (id2, id4)##CF##,
index id2_id3_id1_id4 (id2, id3, id1, id4)##CF##,
index id3_id2 (id3, id2)##CF##
primary key (id1, id2, id3, id4) $CF,
index id2 (id2) $CF,
index id2_id1 (id2, id1) $CF,
index id2_id3 (id2, id3) $CF,
index id2_id4 (id2, id4) $CF,
index id2_id3_id1_id4 (id2, id3, id1, id4) $CF,
index id3_id2 (id3, id2) $CF
) engine=ROCKSDB;
create table t2 (
eval create or replace table t2 (
id1 bigint not null,
id2 bigint not null,
id3 varchar(100) not null,
......@@ -25,12 +23,11 @@ create table t2 (
id5 int not null,
value bigint,
value2 varchar(100),
primary key (id4)##CF##,
index id2 (id2)##CF##,
index id2_id3 (id2, id3)##CF##,
index id2_id4 (id2, id4)##CF##,
index id2_id4_id5 (id2, id4, id5)##CF##,
index id3_id4 (id3, id4)##CF##,
index id3_id5 (id3, id5)##CF##
primary key (id4) $CF,
index id2 (id2) $CF,
index id2_id3 (id2, id3) $CF,
index id2_id4 (id2, id4) $CF,
index id2_id4_id5 (id2, id4, id5) $CF,
index id3_id4 (id3, id4) $CF,
index id3_id5 (id3, id5) $CF
) engine=ROCKSDB;
--source include/have_rocksdb.inc
# Unixisms ("exec ls" in set_checkpoint.inc etc)
--source include/not_windows.inc
--disable_warnings
DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t2;
......
......@@ -3,10 +3,6 @@
# following check is commented out:
# --source include/have_fullregex.inc
# Unixisms (exec grep)
--source include/not_windows.inc
SET @start_global_value = @@global.ROCKSDB_STRICT_COLLATION_EXCEPTIONS;
--disable_warnings
......@@ -159,9 +155,10 @@ DROP TABLE t2;
# test invalid regex (missing end bracket)
--exec echo "" >$MYSQLTEST_VARDIR/log/mysqld.1.err
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
CREATE TABLE a (id INT PRIMARY KEY, value varchar(50), index(value)) engine=rocksdb charset utf8;
SET GLOBAL rocksdb_strict_collation_exceptions="[a-b]";
......@@ -173,9 +170,9 @@ DROP TABLE a, b;
call mtr.add_suppression("Invalid pattern in strict_collation_exceptions:");
# test invalid regex (trailing escape)
--exec echo "" >$MYSQLTEST_VARDIR/log/mysqld.1.err
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
CREATE TABLE abc (id INT PRIMARY KEY, value varchar(50), index(value)) engine=rocksdb charset utf8;
SET GLOBAL rocksdb_strict_collation_exceptions="abc";
......
......@@ -31,8 +31,8 @@ while ($i<1000)
set global rocksdb_force_flush_memtable_now=1;
optimize table r1;
--exec echo Test 1: Do a bunch of updates without setting the compaction sysvar
--exec echo Expect: no compaction
--echo Test 1: Do a bunch of updates without setting the compaction sysvar
--echo Expect: no compaction
let $window = 0;
let $deletes = 0;
let $file_size = 0;
......@@ -41,8 +41,8 @@ let $primary = 1;
let $no_more_deletes = 0;
--source compact_deletes_test.inc
--exec echo Test 2: Do a bunch of updates and set the compaction sysvar
--exec echo Expect: compaction
--echo Test 2: Do a bunch of updates and set the compaction sysvar
--echo Expect: compaction
let $window = 1000;
let $deletes = 990;
let $file_size = 0;
......@@ -51,8 +51,8 @@ let $primary = 1;
let $no_more_deletes = 1;
--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
--exec echo Expect: no compaction
--echo Test 3: Do a bunch of updates and set the compaction sysvar and a file size to something large
--echo Expect: no compaction
let $window = 1000;
let $deletes = 1000;
let $file_size = 1000000;
......@@ -61,8 +61,8 @@ let $primary = 1;
let $no_more_deletes = 0;
--source compact_deletes_test.inc
--exec echo Test 4: Do a bunch of secondary key updates and set the compaction sysvar
--exec echo Expect: compaction
--echo Test 4: Do a bunch of secondary key updates and set the compaction sysvar
--echo Expect: compaction
let $window = 1000;
let $deletes = 50;
let $file_size = 0;
......@@ -71,9 +71,9 @@ let $primary = 0;
let $no_more_deletes = 1;
--source compact_deletes_test.inc
--exec 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
--exec echo Expect: compaction
--echo Test 5: Do a bunch of secondary key updates and set the compaction sysvar,
--echo and rocksdb_compaction_sequential_deletes_count_sd turned on
--echo Expect: compaction
let $window = 1000;
let $deletes = 50;
let $file_size = 0;
......
......@@ -27,7 +27,7 @@ while ($i<1000)
}
--enable_query_log
set global rocksdb_force_flush_memtable_now=1;
select sleep(1);
--sleep 1
--disable_query_log
let $wait_timeout= 300; # Override default 30 seconds with 300.
......@@ -37,8 +37,35 @@ let $wait_condition = select count(*) = 0
--source include/wait_condition.inc
--enable_query_log
let $MYSQL_SST_DUMP=../storage/rocksdb/sst_dump;
exec bash ../storage/rocksdb/mysql-test/rocksdb/t/sst_count_rows.sh $MYSQLTEST_VARDIR $MYSQL_SST_DUMP $no_more_deletes ;
let NO_MORE_DELETES=$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_file_size= $save_rocksdb_compaction_sequential_deletes_file_size;
......
......@@ -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'
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
#Unixisms (possibly Linuxisms, exec truncate)
--source include/not_windows.inc
call mtr.add_suppression("Column family 'cf1' not found");
call mtr.add_suppression("Column family 'rev:cf2' not found");
--disable_warnings
DROP TABLE IF EXISTS t1;
......@@ -15,7 +15,6 @@ set global rocksdb_compact_cf = 'cf1';
set global rocksdb_compact_cf = 'rev:cf2';
set global rocksdb_signal_drop_index_thread = 1;
--source include/restart_mysqld.inc
--exec truncate --size=0 $MYSQLTEST_VARDIR/log/mysqld.1.err
CREATE TABLE t1 (
a int not null,
......@@ -111,7 +110,45 @@ let $wait_condition = select count(*) = 0
# Get list of all indices needing to be dropped
# Check total compacted-away rows for all indices
# 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
drop table t1;
--source include/have_rocksdb.inc
#Unixisms (--exec truncate, du, grep ,sed)
--source include/not_windows.inc
call mtr.add_suppression("Column family 'cf1' not found");
call mtr.add_suppression("Column family 'rev:cf2' not found");
--disable_warnings
DROP TABLE IF EXISTS t1;
......@@ -16,7 +16,6 @@ set global rocksdb_compact_cf = 'cf1';
set global rocksdb_compact_cf = 'rev:cf2';
set global rocksdb_signal_drop_index_thread = 1;
--source include/restart_mysqld.inc
--exec truncate --size=0 $MYSQLTEST_VARDIR/log/mysqld.1.err
CREATE TABLE t1 (
a int not null,
......@@ -90,9 +89,12 @@ let $max = 1000;
let $table = t5;
--source drop_table_repopulate_table.inc
let $output= $MYSQLTEST_VARDIR/tmp/size_output;
--exec du -c $MYSQLTEST_VARDIR/mysqld.1/data/.rocksdb/*.sst |grep total |sed 's/[\t]total/ before/' > $output
perl;
use autodie qw(open);
$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 t2;
drop table t3;
......@@ -107,7 +109,12 @@ let $wait_condition = select count(*) = 0
--source include/wait_condition.inc
# Check that space is reclaimed
--exec du -c $MYSQLTEST_VARDIR/mysqld.1/data/.rocksdb/*.sst |grep total |sed 's/[\t]total/ after/' >> $output
--exec perl ../storage/rocksdb/mysql-test/rocksdb/t/drop_table2_check.pl $output
perl;
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
#!/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
call mtr.add_suppression("Column family 'cf1' not found");
call mtr.add_suppression("Column family 'rev:cf2' not found");
--disable_warnings
DROP TABLE IF EXISTS t1;
--enable_warnings
......@@ -9,7 +12,6 @@ set global rocksdb_compact_cf = 'cf1';
set global rocksdb_compact_cf = 'rev:cf2';
set global rocksdb_signal_drop_index_thread = 1;
--source include/restart_mysqld.inc
--exec truncate --size=0 $MYSQLTEST_VARDIR/log/mysqld.1.err
CREATE TABLE t1 (
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_log_bin.inc
--enable_connect_log
--source include/restart_mysqld.inc
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
--disable_warnings
drop table if exists r1;
--enable_warnings
connect (con1,localhost,root,,);
connect (con2,localhost,root,,);
......@@ -46,20 +38,19 @@ rollback;
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 GLOBAL default_storage_engine=rocksdb;
--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)
--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
# 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
SET GLOBAL binlog_format=statement;
--exec $MYSQL_DUMP --skip-comments --single-transaction --master-data=2 --print-ordering-key test > /dev/null
......
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;
# run a check script to verify sst files reduced enough during each optimize table
perl;
use autodie qw(open);
$size += -s $_ for (<$ENV{datadir}/.rocksdb/*.sst>);
$file= "$ENV{MYSQL_TMP_DIR}/sst_size.dat";
if (-f $file) {
open(F, '<', $file);
$old = <F>;
close F;
if ($old - $size < 1e6) {
print "sst file reduction was not enough $old -> $size (minimum 1000kb)\n";
} else {
print "sst file reduction ok\n";
}
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;
--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
open(F, '>', $file);
print F $size;
close F;
EOF
......@@ -4,5 +4,78 @@
# 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
order by cf_name, option_type;
# 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};
--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
# 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
......@@ -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_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
--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;
......@@ -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;
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
--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
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;
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
--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_checksums_pct=5;
......@@ -58,9 +52,27 @@ 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 ../storage/rocksdb/mysql-test/rocksdb/t/rocksdb_checksums.pl $MYSQL_TMP_DIR/rocksdb_checksums.log 10000 5
--remove_file $MYSQL_TMP_DIR/rocksdb_checksums.log
perl;
use autodie qw(open);
$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;
--echo #
......
--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 $rdb_ddir = $MYSQL_TMP_DIR/.rocksdb_datadir.test;
let $sql_file = $MYSQL_TMP_DIR/rocksdb_datadir.sql;
--write_file $sql_file
DROP DATABASE IF EXISTS mysqltest;
CREATE DATABASE mysqltest;
USE mysqltest;
CREATE TABLE t1 (a INT PRIMARY KEY);
......@@ -14,6 +11,7 @@ INSERT INTO t1 VALUES(42);
SET GLOBAL rocksdb_force_flush_memtable_now = 1;
SELECT sleep(1);
DROP TABLE t1;
DROP DATABASE mysqltest;
EOF
# Must ensure this directory exists before launching mysqld
......@@ -23,10 +21,13 @@ let $plugin_dir=`select @@plugin_dir`;
# 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;
--echo Check for the number of MANIFEST files
exec ls $rdb_ddir/MANIFEST-0000* | wc -l;
--echo Check for MANIFEST files
--list_files $rdb_ddir MANIFEST-0000*
# Clean up
exec rm -rf $ddir;
remove_files_wildcard $ddir *;
remove_files_wildcard $ddir *;
remove_files_wildcard $rdb_ddir *;
rmdir $ddir;
rmdir $rdb_ddir;
remove_file $sql_file;
......@@ -11,10 +11,13 @@ if ($succeeds)
eval SET GLOBAL ROCKSDB_CREATE_CHECKPOINT = '$checkpoint';
# Check checkpoint
--exec ls $checkpoint/CURRENT | sed s/.*CURRENT/CURRENT/g
--list_files $checkpoint CURRENT
# Cleanup
--exec rm -rf $checkpoint
--remove_files_wildcard $checkpoint *
--rmdir $checkpoint
--disable_abort_on_error
--enable_abort_on_error
}
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,,);
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),
value1 INT, value2 INT, value3 VARCHAR(32),
PRIMARY KEY (id1, id2) ##CF##,
UNIQUE INDEX (id2, id1) ##CF##,
UNIQUE INDEX (id2, id3, id4) ##CF##,
INDEX (id1) ##CF##,
INDEX (id3, id1) ##CF##,
UNIQUE INDEX(id5) ##CF##,
PRIMARY KEY (id1, id2) $CF,
UNIQUE INDEX (id2, id1) $CF,
UNIQUE INDEX (id2, id3, id4) $CF,
INDEX (id1) $CF,
INDEX (id3, id1) $CF,
UNIQUE INDEX(id5) $CF,
INDEX (id2, id5)) ENGINE=ROCKSDB;
--disable_query_log
......
--source include/have_rocksdb.inc
--source include/have_partition.inc
# Unixism, exec sed
--source include/not_windows.inc
let ddl= $MYSQL_TMP_DIR/unique_sec.sql;
--exec sed s/##CF##//g ../storage/rocksdb/mysql-test/rocksdb/t/unique_sec.inc > $ddl
--source $ddl
--let $CF=
--source unique_sec.inc
--echo #
--echo # Issue #88: Creating unique index over column with duplicate values succeeds
......
--source include/have_rocksdb.inc
let ddl= $MYSQL_TMP_DIR/unique_sec_rev_cf.sql;
--exec sed s/##CF##/" COMMENT 'rev:cf'"/g ../storage/rocksdb/mysql-test/rocksdb/t/unique_sec.inc > $ddl
--source $ddl
let $CF=COMMENT 'rev:cf';
--source unique_sec.inc
--source include/have_rocksdb.inc
call mtr.add_suppression("rocksdb");
call mtr.add_suppression("Aborting");
# Issue221
# 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
......@@ -12,9 +15,6 @@
--exec echo "wait" >$_expect_file_name
shutdown_server 10;
# Clear the log
--exec echo "" >$MYSQLTEST_VARDIR/log/mysqld.1.err
# Attempt to restart the server with invalid options
--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
......@@ -26,7 +26,9 @@ shutdown_server 10;
--disable_reconnect
# 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
--let $_server_id= `SELECT @@server_id`
......@@ -34,8 +36,6 @@ shutdown_server 10;
--exec echo "wait" >$_expect_file_name
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
--sleep 0.1
--exec echo "restart:" >$_expect_file_name
......@@ -44,4 +44,5 @@ shutdown_server 10;
--source include/wait_until_connected_again.inc
--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 @@
# it in the log bug still start: --rocksdb_validate_tables=2
#
--disable_warnings
DROP TABLE IF EXISTS t1, t2;
--enable_warnings
call mtr.add_suppression('RocksDB: Schema mismatch');
CREATE TABLE t1 (pk int primary key) ENGINE=ROCKSDB;
CREATE TABLE t2 (pk int primary key) ENGINE=ROCKSDB PARTITION BY KEY(pk) PARTITIONS 4;
......@@ -44,54 +42,48 @@ shutdown_server 10;
--exec echo "wait" >$_expect_file_name
shutdown_server 10;
# Clear the log
--exec echo "" >$MYSQLTEST_VARDIR/log/mysqld.1.err
# Rename the file
--exec mv $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/t1.frm $MYSQLTEST_VARDIR/mysqld.1/data/test/t1.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
--exec echo "restart:--rocksdb_validate_tables=2" >$_expect_file_name
--sleep 5
--enable_reconnect
--source include/wait_until_connected_again.inc
--disable_reconnect
# We should now have an error message
--exec echo "Expect errors that we are missing two .frm files"
--exec grep "Schema mismatch" $MYSQLTEST_VARDIR/log/mysqld.1.err | cut -d] -f2
--echo "Expect errors that we are missing two .frm files"
--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
--exec echo "wait" >$_expect_file_name
shutdown_server 10;
# Clear the log
--exec echo "" >$MYSQLTEST_VARDIR/log/mysqld.1.err
# Rename the file
--exec mv $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
--exec cp $MYSQLTEST_VARDIR/mysqld.1/data/test/t1.frm $MYSQLTEST_VARDIR/mysqld.1/data/test/t1_dummy.frm
--move_file $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/t2.frm.tmp $MYSQLTEST_VARDIR/mysqld.1/data/test/t2.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
--exec echo "restart:--rocksdb_validate_tables=2" >$_expect_file_name
--sleep 5
--enable_reconnect
--source include/wait_until_connected_again.inc
--disable_reconnect
# We should now have an error message for the second case
--exec echo "Expect an error that we have an extra .frm file"
--exec grep "Schema mismatch" $MYSQLTEST_VARDIR/log/mysqld.1.err | cut -d] -f2
--echo "Expect an error that we have an extra .frm file"
--let SEARCH_PATTERN=Schema mismatch
--source include/search_pattern_in_file.inc
# Shut down an clean up
--exec echo "wait" >$_expect_file_name
shutdown_server 10;
--exec echo "" >$MYSQLTEST_VARDIR/log/mysqld.1.err
--exec rm $MYSQLTEST_VARDIR/mysqld.1/data/test/t1_dummy.frm
--remove_file $MYSQLTEST_VARDIR/mysqld.1/data/test/t1_dummy.frm
--exec echo "restart" >$_expect_file_name
--enable_reconnect
--source include/wait_until_connected_again.inc
......
......@@ -6,7 +6,7 @@ SET GLOBAL rocksdb_write_ignore_missing_column_families=true;
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 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';
insert aaa(id, i) values(1,1);
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