revision-id: 2527cd79440e2145eca25c7f8735ad1c8b8c4f3b (fb-prod201903-173-g2527cd79440) parent(s): 24860d7505161c15a1d4b3b76519dbcfa0298c2c author: Sergei Petrunia committer: Sergei Petrunia timestamp: 2019-10-21 23:05:47 +0300 message: Issue #790, MyRocks/MRR: add test coverage for previous cset --- mysql-test/suite/rocksdb/r/rocksdb_mrr2.result | 39 ++++++++++++++++++++ mysql-test/suite/rocksdb/t/rocksdb_mrr2-master.opt | 1 + mysql-test/suite/rocksdb/t/rocksdb_mrr2.test | 41 ++++++++++++++++++++++ 3 files changed, 81 insertions(+) diff --git a/mysql-test/suite/rocksdb/r/rocksdb_mrr2.result b/mysql-test/suite/rocksdb/r/rocksdb_mrr2.result new file mode 100644 index 00000000000..5628f1bf06d --- /dev/null +++ b/mysql-test/suite/rocksdb/r/rocksdb_mrr2.result @@ -0,0 +1,39 @@ +drop table if exists t0,t1,t2; +show variables like 'rocksdb_block_cache_size%'; +Variable_name Value +rocksdb_block_cache_size 1024 +create table t0(a int); +insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +create table t1(a int); +insert into t1 select A.a + B.a* 10 + C.a * 100 from t0 A, t0 B, t0 C; +create table t2 ( +pk int primary key, +col1 int, +blob1 text, +blob2 text +) engine=rocksdb; +insert into t2 select a,a,repeat(a,100), repeat(a,200) from t1; +set global rocksdb_force_flush_memtable_now=1; +set @save_optimizer_switch=@@optimizer_switch; +set optimizer_switch='mrr=on,mrr_cost_based=off,batched_key_access=on'; +explain +select pk, col1 from t2,t0 +where t2.pk=t0.a*90 and md5(blob1)=md5(repeat(t2.pk,100)) and md5(blob2)=md5(repeat(t2.pk,200)); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t0 ALL NULL NULL NULL NULL 10 NULL +1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 func 1 Using where; Using join buffer (Batched Key Access) +select pk, col1 from t2,t0 +where t2.pk=t0.a*90 and md5(blob1)=md5(repeat(t2.pk,100)) and md5(blob2)=md5(repeat(t2.pk,200)); +pk col1 +0 0 +90 90 +180 180 +270 270 +360 360 +450 450 +540 540 +630 630 +720 720 +810 810 +set optimizer_switch=@save_optimizer_switch; +drop table t0,t1,t2; diff --git a/mysql-test/suite/rocksdb/t/rocksdb_mrr2-master.opt b/mysql-test/suite/rocksdb/t/rocksdb_mrr2-master.opt new file mode 100644 index 00000000000..08fa393d3c3 --- /dev/null +++ b/mysql-test/suite/rocksdb/t/rocksdb_mrr2-master.opt @@ -0,0 +1 @@ +--rocksdb-block-cache-size=1024 diff --git a/mysql-test/suite/rocksdb/t/rocksdb_mrr2.test b/mysql-test/suite/rocksdb/t/rocksdb_mrr2.test new file mode 100644 index 00000000000..f9ec2fe518e --- /dev/null +++ b/mysql-test/suite/rocksdb/t/rocksdb_mrr2.test @@ -0,0 +1,41 @@ +# +# Test if MyRocks/MRR correctly releases PinnableSlice objects with value data +# (if it doesn't, this test will produce valgrind errors: invalid memory reads +# inside my_md5_hash) +# +--source include/have_rocksdb.inc + +--disable_warnings +drop table if exists t0,t1,t2; +--enable_warnings + +show variables like 'rocksdb_block_cache_size%'; +create table t0(a int); +insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); + +create table t1(a int); +insert into t1 select A.a + B.a* 10 + C.a * 100 from t0 A, t0 B, t0 C; + +create table t2 ( + pk int primary key, + col1 int, + blob1 text, + blob2 text +) engine=rocksdb; + +insert into t2 select a,a,repeat(a,100), repeat(a,200) from t1; + +set global rocksdb_force_flush_memtable_now=1; + +set @save_optimizer_switch=@@optimizer_switch; +set optimizer_switch='mrr=on,mrr_cost_based=off,batched_key_access=on'; + +explain +select pk, col1 from t2,t0 +where t2.pk=t0.a*90 and md5(blob1)=md5(repeat(t2.pk,100)) and md5(blob2)=md5(repeat(t2.pk,200)); + +select pk, col1 from t2,t0 +where t2.pk=t0.a*90 and md5(blob1)=md5(repeat(t2.pk,100)) and md5(blob2)=md5(repeat(t2.pk,200)); +set optimizer_switch=@save_optimizer_switch; + +drop table t0,t1,t2;