Commit 1688a226 authored by Sergei Petrunia's avatar Sergei Petrunia

MDEV-18384: rocksdb.index_merge_rocksdb2 test fails

Merge the changes to include/index_merge*inc from the upstream. The changes
add this command in many places:

 +if ($engine_type == RocksDB)
 +{
 +    set global rocksdb_force_flush_memtable_now=1;
 +}

also add it in one more place to make the test truly stable.
parent 5e9b3419
......@@ -58,6 +58,10 @@ while ($1)
eval set @d=@d*2;
dec $1;
}
if ($engine_type == RocksDB)
{
set global rocksdb_force_flush_memtable_now=1;
}
--enable_query_log
analyze table t0;
......@@ -329,6 +333,10 @@ alter table t2 add index i321(key3, key2, key1);
-- disable_query_log
-- disable_result_log
analyze table t2;
if ($engine_type == RocksDB)
{
set global rocksdb_force_flush_memtable_now=1;
}
-- enable_result_log
-- enable_query_log
......@@ -371,6 +379,10 @@ insert into t4 select key1,key1,key1 div 10, key1 % 10, key1 % 10, key1 from t0;
-- disable_query_log
-- disable_result_log
if ($engine_type == RocksDB)
{
set global rocksdb_force_flush_memtable_now=1;
}
analyze table t4;
-- enable_result_log
-- enable_query_log
......@@ -397,6 +409,10 @@ insert into t1 select * from t0;
-- disable_query_log
-- disable_result_log
if ($engine_type == RocksDB)
{
set global rocksdb_force_flush_memtable_now=1;
}
analyze table t1;
-- enable_result_log
-- enable_query_log
......@@ -463,6 +479,10 @@ update t3 set key9=key1,keyA=key1,keyB=key1,keyC=key1;
-- disable_query_log
-- disable_result_log
if ($engine_type == RocksDB)
{
set global rocksdb_force_flush_memtable_now=1;
}
analyze table t3;
-- enable_result_log
-- enable_query_log
......@@ -486,6 +506,10 @@ update t0 set key8=123 where key1 < 3 or key2 < 4;
-- disable_query_log
-- disable_result_log
if ($engine_type == RocksDB)
{
set global rocksdb_force_flush_memtable_now=1;
}
analyze table t0;
-- enable_result_log
-- enable_query_log
......@@ -496,6 +520,10 @@ select * from t0 where key1 < 3 or key2 < 4;
delete from t0 where key1 < 3 or key2 < 4;
-- disable_query_log
-- disable_result_log
if ($engine_type == RocksDB)
{
set global rocksdb_force_flush_memtable_now=1;
}
analyze table t0;
-- enable_result_log
-- enable_query_log
......@@ -509,6 +537,10 @@ create table t4 (a int);
insert into t4 values (1),(4),(3);
-- disable_query_log
-- disable_result_log
if ($engine_type == RocksDB)
{
set global rocksdb_force_flush_memtable_now=1;
}
analyze table t4;
-- enable_result_log
-- enable_query_log
......@@ -533,6 +565,10 @@ select max(A.key1 + B.key1 + A.key2 + B.key2 + A.key3 + B.key3 + A.key4 + B.key4
update t0 set key1=1;
-- disable_query_log
-- disable_result_log
if ($engine_type == RocksDB)
{
set global rocksdb_force_flush_memtable_now=1;
}
analyze table t0;
-- enable_result_log
-- enable_query_log
......@@ -556,6 +592,10 @@ update t0 set key2=1, key3=1, key4=1, key5=1,key6=1,key7=1 where key7 < 500;
-- disable_query_log
-- disable_result_log
if ($engine_type == RocksDB)
{
set global rocksdb_force_flush_memtable_now=1;
}
analyze table t0;
-- enable_result_log
-- enable_query_log
......@@ -612,6 +652,10 @@ select count(*) from t1;
-- disable_query_log
-- disable_result_log
if ($engine_type == RocksDB)
{
set global rocksdb_force_flush_memtable_now=1;
}
analyze table t1;
-- enable_result_log
-- enable_query_log
......@@ -652,6 +696,10 @@ create table t3 (
-- disable_query_log
-- disable_result_log
if ($engine_type == RocksDB)
{
set global rocksdb_force_flush_memtable_now=1;
}
analyze table t0;
analyze table t1;
analyze table t2;
......@@ -733,6 +781,10 @@ insert into t2 select * from t1;
-- disable_query_log
-- disable_result_log
if ($engine_type == RocksDB)
{
set global rocksdb_force_flush_memtable_now=1;
}
analyze table t1;
analyze table t2;
-- enable_result_log
......@@ -787,6 +839,10 @@ insert into t3 values (1,1,'data');
-- disable_query_log
-- disable_result_log
if ($engine_type == RocksDB)
{
set global rocksdb_force_flush_memtable_now=1;
}
analyze table t0;
analyze table t1;
analyze table t2;
......@@ -822,6 +878,10 @@ INSERT INTO t1 SELECT * FROM t1;
INSERT INTO t1 SELECT * FROM t1;
-- disable_query_log
-- disable_result_log
if ($engine_type == RocksDB)
{
set global rocksdb_force_flush_memtable_now=1;
}
analyze table t1;
-- enable_result_log
-- enable_query_log
......
......@@ -43,6 +43,10 @@ while ($1)
-- disable_query_log
-- disable_result_log
if ($engine_type == RocksDB)
{
set global rocksdb_force_flush_memtable_now=1;
}
analyze table t1;
-- enable_result_log
-- enable_query_log
......@@ -68,6 +72,10 @@ alter table t1 add primary key (str1, zeroval, str2, str3);
-- disable_query_log
-- disable_result_log
if ($engine_type == RocksDB)
{
set global rocksdb_force_flush_memtable_now=1;
}
analyze table t1;
-- enable_result_log
-- enable_query_log
......@@ -101,6 +109,10 @@ while ($1)
-- disable_query_log
-- disable_result_log
if ($engine_type == RocksDB)
{
set global rocksdb_force_flush_memtable_now=1;
}
analyze table t1;
-- enable_result_log
-- enable_query_log
......@@ -143,6 +155,10 @@ select count(*) from t1;
-- disable_query_log
-- disable_result_log
if ($engine_type == RocksDB)
{
set global rocksdb_force_flush_memtable_now=1;
}
analyze table t2;
-- enable_result_log
-- enable_query_log
......@@ -379,6 +395,10 @@ update t1 set key2=key1,key3=key1;
-- disable_query_log
-- disable_result_log
if ($engine_type == RocksDB)
{
set global rocksdb_force_flush_memtable_now=1;
}
analyze table t1;
-- enable_result_log
-- enable_query_log
......@@ -417,6 +437,10 @@ INSERT INTO t1 VALUES
-- disable_query_log
-- disable_result_log
if ($engine_type == RocksDB)
{
set global rocksdb_force_flush_memtable_now=1;
}
analyze table t1;
-- enable_result_log
-- enable_query_log
......@@ -472,6 +496,10 @@ INSERT INTO t1 VALUES (1,1,'a'), (2,2,'b');
-- disable_query_log
-- disable_result_log
if ($engine_type == RocksDB)
{
set global rocksdb_force_flush_memtable_now=1;
}
analyze table t1;
-- enable_result_log
-- enable_query_log
......
......@@ -119,6 +119,10 @@ select count(*) from t1;
-- disable_query_log
-- disable_result_log
if ($engine_type == RocksDB)
{
set global rocksdb_force_flush_memtable_now=1;
}
analyze table t0;
analyze table t1;
-- enable_result_log
......@@ -141,6 +145,10 @@ insert into t1 (key1, key2, key3, key4, filler1) values (-1, -1, 100, 100, 'key4
-- disable_query_log
-- disable_result_log
if ($engine_type == RocksDB)
{
set global rocksdb_force_flush_memtable_now=1;
}
analyze table t1;
-- enable_result_log
-- enable_query_log
......@@ -193,6 +201,10 @@ update t1 set key1=200,key2=200 where key1=100 and key2=100;
delete from t1 where key1=200 and key2=200;
-- disable_query_log
-- disable_result_log
if ($engine_type == RocksDB)
{
set global rocksdb_force_flush_memtable_now=1;
}
analyze table t1;
-- enable_result_log
-- enable_query_log
......@@ -210,6 +222,10 @@ delete from t1 where key3=100 and key4=100;
-- disable_query_log
-- disable_result_log
if ($engine_type == RocksDB)
{
set global rocksdb_force_flush_memtable_now=1;
}
analyze table t1;
-- enable_result_log
-- enable_query_log
......@@ -236,6 +252,10 @@ insert into t1 (key1, key2, key3, key4, filler1) values (100, 100, 200, 200,'key
-- disable_query_log
-- disable_result_log
if ($engine_type == RocksDB)
{
set global rocksdb_force_flush_memtable_now=1;
}
analyze table t1;
-- enable_result_log
-- enable_query_log
......@@ -250,6 +270,10 @@ insert into t1 (key1, key2, key3, key4, filler1) values (-1, -1, -1, 200,'key4')
-- disable_query_log
-- disable_result_log
if ($engine_type == RocksDB)
{
set global rocksdb_force_flush_memtable_now=1;
}
analyze table t1;
-- enable_result_log
-- enable_query_log
......@@ -264,6 +288,10 @@ insert into t1 (key1, key2, key3, key4, filler1) values (-1, -1, 200, -1,'key3')
-- disable_query_log
-- disable_result_log
if ($engine_type == RocksDB)
{
set global rocksdb_force_flush_memtable_now=1;
}
analyze table t1;
-- enable_result_log
-- enable_query_log
......@@ -392,6 +420,10 @@ select count(a) from t2 where b='BBBBBBBB';
-- disable_query_log
-- disable_result_log
if ($engine_type == RocksDB)
{
set global rocksdb_force_flush_memtable_now=1;
}
analyze table t2;
-- enable_result_log
-- enable_query_log
......@@ -405,6 +437,10 @@ select count(a) from t2 ignore index(a,b) where a='AAAAAAAA' and b='AAAAAAAA';
insert into t2 values ('ab', 'ab', 'uh', 'oh');
-- disable_query_log
-- disable_result_log
if ($engine_type == RocksDB)
{
set global rocksdb_force_flush_memtable_now=1;
}
analyze table t2;
-- enable_result_log
-- enable_query_log
......
......@@ -68,6 +68,10 @@ set autocommit=1;
-- disable_query_log
-- disable_result_log
if ($engine_type == RocksDB)
{
set global rocksdb_force_flush_memtable_now=1;
}
analyze table t1;
-- enable_result_log
-- enable_query_log
......@@ -159,6 +163,10 @@ WHERE (SELECT COUNT(*) FROM t2 WHERE t2.f3 = 'h' AND t2.f2 = t1.f1) = 0 AND t1.f
-- disable_query_log
-- disable_result_log
if ($engine_type == RocksDB)
{
set global rocksdb_force_flush_memtable_now=1;
}
analyze table t1;
analyze table t2;
-- enable_result_log
......
......@@ -26,7 +26,7 @@ Table Op Msg_type Msg_text
test.t0 analyze status OK
explain select * from t0 where key1 < 3 or key1 > 1020;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t0 range i1 i1 4 NULL 2 Using index condition; Using where
1 SIMPLE t0 range i1 i1 4 NULL 4 Using index condition; Using where
explain
select * from t0 where key1 < 3 or key2 > 1020;
id select_type table type possible_keys key key_len ref rows Extra
......@@ -267,12 +267,12 @@ select * from t0,t1 where (t0.key1=t1.key1) and
(t0.key1=3 or t0.key2<4) and t1.key1=2;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t0 ref i1,i2 i1 4 const 2 Using where
1 SIMPLE t1 ref i1 i1 4 const 1
1 SIMPLE t1 ref i1 i1 4 const 2
explain select * from t0,t1 where t0.key1 = 5 and
(t1.key1 = t0.key1 or t1.key8 = t0.key1);
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t0 ref i1 i1 4 const 1
1 SIMPLE t1 index_merge i1,i8 i1,i8 4,4 NULL 2 Using union(i1,i8); Using where; Using join buffer (flat, BNL join)
1 SIMPLE t0 ref i1 i1 4 const 2
1 SIMPLE t1 index_merge i1,i8 i1,i8 4,4 NULL 4 Using union(i1,i8); Using where; Using join buffer (flat, BNL join)
explain select * from t0,t1 where t0.key1 < 3 and
(t1.key1 = t0.key1 or t1.key8 = t0.key1);
id select_type table type possible_keys key key_len ref rows Extra
......@@ -286,7 +286,7 @@ id select_type table type possible_keys key key_len ref rows Extra
NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL
explain select * from (select * from t1 where key1 = 3 or key2 =3) as Z where key8 >5;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index_merge i1,i2,i8 i1,i2 4,4 NULL 2 Using union(i1,i2); Using where
1 SIMPLE t1 range i1,i2,i8 i8 4 NULL 2 Using index condition; Using where
create table t3 like t0;
insert into t3 select * from t0;
alter table t3 add key9 int not null, add index i9(key9);
......@@ -392,10 +392,10 @@ count(*)
8704
explain select * from t1 WHERE cola = 'foo' AND colb = 'bar';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index_merge cola,colb cola,colb 3,3 NULL # Using intersect(cola,colb); Using where
1 SIMPLE t1 ref cola,colb cola 3 const # Using index condition; Using where
explain select * from t1 force index(cola,colb) WHERE cola = 'foo' AND colb = 'bar';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index_merge cola,colb cola,colb 3,3 NULL # Using intersect(cola,colb); Using where
1 SIMPLE t1 ref cola,colb cola 3 const # Using index condition; Using where
drop table t1;
CREATE TABLE t1(a INT);
INSERT INTO t1 VALUES(1);
......@@ -603,7 +603,7 @@ count(*)
64801
explain select key1,key2 from t1 where key1=100 and key2=100;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index_merge key1,key2 key2,key1 5,5 NULL # Using intersect(key2,key1); Using where; Using index
1 SIMPLE t1 index_merge key1,key2 key1,key2 5,5 NULL # Using intersect(key1,key2); Using where; Using index
select key1,key2 from t1 where key1=100 and key2=100;
key1 key2
100 100
......@@ -789,7 +789,7 @@ show warnings;
Level Code Message
explain select pk from t1 where key1 = 1 and key2 = 1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref key1,key2 key1 5 const 2 Using where
1 SIMPLE t1 index_merge key1,key2 key2,key1 4,5 NULL 1 Using intersect(key2,key1); Using where; Using index
select pk from t1 where key2 = 1 and key1 = 1;
pk
26
......@@ -1057,7 +1057,7 @@ SELECT a
FROM t1
WHERE c = 1 AND b = 1 AND d = 1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref c,bd c 5 const 2 Using where
1 SIMPLE t1 index_merge c,bd c,bd 5,10 NULL 1 Using intersect(c,bd); Using where; Using index
CREATE TABLE t2 ( a INT )
SELECT a
FROM t1
......@@ -1288,7 +1288,7 @@ primary key (pk1, pk2)
);
explain select * from t1 where pk1 = 1 and pk2 < 80 and key1=0;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range PRIMARY,key1 key1 12 NULL ROWS Using index condition
1 SIMPLE t1 range PRIMARY,key1 PRIMARY 8 NULL ROWS Using where
select * from t1 where pk1 = 1 and pk2 < 80 and key1=0;
pk1 pk2 key1 key2 pktail1ok pktail2ok pktail3bad pktail4bad pktail5bad pk2copy badkey filler1 filler2
1 10 0 0 0 0 0 0 0 10 0 filler-data-10 filler2
......@@ -1321,13 +1321,13 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref key1 key1 4 const ROWS Using where
explain select * from t1 where pk1 < 7500 and key1 = 10;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range PRIMARY,key1 key1 8 NULL ROWS Using index condition
1 SIMPLE t1 range PRIMARY,key1 PRIMARY 4 NULL ROWS Using where
explain select * from t1 where pktail1ok=1 and key1=10;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index_merge key1,pktail1ok key1,pktail1ok 4,4 NULL 1 Using intersect(key1,pktail1ok); Using where
1 SIMPLE t1 ref key1,pktail1ok key1 4 const 2 Using where
explain select * from t1 where pktail2ok=1 and key1=10;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index_merge key1,pktail2ok key1,pktail2ok 4,4 NULL 1 Using intersect(key1,pktail2ok); Using where
1 SIMPLE t1 ref key1,pktail2ok key1 4 const 2 Using where
explain select * from t1 where (pktail2ok=1 and pk1< 50000) or key1=10;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index_merge PRIMARY,key1,pktail2ok PRIMARY,key1 4,4 NULL ROWS Using union(PRIMARY,key1); Using where
......@@ -1393,7 +1393,7 @@ EXPLAIN SELECT t1.f1 FROM t1
WHERE (SELECT COUNT(*) FROM t2 WHERE t2.f3 = 'h' AND t2.f2 = t1.f1) = 0 AND t1.f1 = 2;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 const PRIMARY PRIMARY 4 const 1 Using index
2 SUBQUERY t2 ref f2,f3 f2 5 const 1 Using where
2 SUBQUERY t2 index_merge f2,f3 f3,f2 2,5 NULL 1 Using intersect(f3,f2); Using where; Using index
DROP TABLE t1,t2;
set global rocksdb_force_flush_memtable_now=1;
#
......@@ -1412,5 +1412,5 @@ INSERT INTO t1 SELECT id + 8, id2 + 8, id3 +8 FROM t1;
INSERT INTO t1 SELECT id + 16, 7, 0 FROM t1;
EXPLAIN SELECT SQL_NO_CACHE count(*) FROM t1 WHERE id2=7 AND id3=0;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref id2,id3,covering_index covering_index 8 const,const 1 Using index
1 SIMPLE t1 ref id2,id3,covering_index covering_index 8 const,const 2 Using index
DROP TABLE t1;
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