revision-id: 686be2914fb36e6082162684642fbd62c44a00bf (fb-prod8-202009-51-g686be2914fb) parent(s): d3b369d996a1838c7f04a28db6f6c58dafec71db author: Sergei Petrunia committer: Sergei Petrunia timestamp: 2020-11-30 20:59:35 +0300 message: Range Locking: add the testcases missed in the move-to-8.0 commit ... use the correct (adjusted) versions of files. --- .../suite/rocksdb/include/have_range_locking.inc | 2 +- .../suite/rocksdb/r/hermitage-range_locking.result | 4 ++-- mysql-test/suite/rocksdb/r/range_locking.result | 6 ++++-- .../suite/rocksdb/r/range_locking_rev_cf.result | 18 ++++++++++------ .../rocksdb/r/range_locking_seek_for_update.result | 24 ++++++++++++++-------- .../rocksdb/r/range_locking_shared_locks.result | 8 +++++--- mysql-test/suite/rocksdb/t/range_locking.inc | 6 +++--- .../rocksdb/t/range_locking_deadlock_tracking.test | 8 ++++---- .../rocksdb/t/range_locking_seek_for_update.test | 6 +++--- .../rocksdb/t/range_locking_shared_locks.test | 4 ++-- 10 files changed, 52 insertions(+), 34 deletions(-) diff --git a/mysql-test/suite/rocksdb/include/have_range_locking.inc b/mysql-test/suite/rocksdb/include/have_range_locking.inc index bb502d623ac..a8600daea77 100644 --- a/mysql-test/suite/rocksdb/include/have_range_locking.inc +++ b/mysql-test/suite/rocksdb/include/have_range_locking.inc @@ -1,3 +1,3 @@ -if (`select count(*) = 0 from information_schema.session_variables where variable_name = 'rocksdb_use_range_locking' and variable_value = 'ON';`) { +if (`select count(*) = 0 from performance_schema.session_variables where variable_name = 'rocksdb_use_range_locking' and variable_value = 'ON';`) { --skip Test requires range locking } diff --git a/mysql-test/suite/rocksdb/r/hermitage-range_locking.result b/mysql-test/suite/rocksdb/r/hermitage-range_locking.result index af6a0028629..3938fa38b6c 100644 --- a/mysql-test/suite/rocksdb/r/hermitage-range_locking.result +++ b/mysql-test/suite/rocksdb/r/hermitage-range_locking.result @@ -148,7 +148,7 @@ begin; connection con1; update test set value = value + 10; connection con2; -select variable_value into @a from information_schema.global_status where variable_name='rocksdb_snapshot_conflict_errors'; +select variable_value into @a from performance_schema.global_status where variable_name='rocksdb_snapshot_conflict_errors'; select * from test; id value 1 10 @@ -474,7 +474,7 @@ begin; connection con1; update test set value = value + 10; connection con2; -select variable_value into @a from information_schema.global_status where variable_name='rocksdb_snapshot_conflict_errors'; +select variable_value into @a from performance_schema.global_status where variable_name='rocksdb_snapshot_conflict_errors'; select * from test; id value 1 10 diff --git a/mysql-test/suite/rocksdb/r/range_locking.result b/mysql-test/suite/rocksdb/r/range_locking.result index 3641fb1943e..07a01ec13b5 100644 --- a/mysql-test/suite/rocksdb/r/range_locking.result +++ b/mysql-test/suite/rocksdb/r/range_locking.result @@ -448,8 +448,10 @@ select * from t1 where pk1=4 and pk2 between 5 and 8 order by pk1 desc, pk2 desc for update; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range PRIMARY PRIMARY 8 NULL # Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range PRIMARY PRIMARY 8 NULL # 100.00 Using where; Backward index scan +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`pk1` AS `pk1`,`test`.`t1`.`pk2` AS `pk2`,`test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`pk1` = 4) and (`test`.`t1`.`pk2` between 5 and 8)) order by `test`.`t1`.`pk1` desc,`test`.`t1`.`pk2` desc select * from t1 where pk1=4 and pk2 between 5 and 8 order by pk1 desc, pk2 desc diff --git a/mysql-test/suite/rocksdb/r/range_locking_rev_cf.result b/mysql-test/suite/rocksdb/r/range_locking_rev_cf.result index d33d4872fab..3dd1fcfa320 100644 --- a/mysql-test/suite/rocksdb/r/range_locking_rev_cf.result +++ b/mysql-test/suite/rocksdb/r/range_locking_rev_cf.result @@ -182,8 +182,10 @@ connection con1; begin; explain select * from t1 where kp1=2 for update; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref kp1 kp1 4 const # NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref kp1 kp1 4 const # 100.00 NULL +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`kp1` AS `kp1`,`test`.`t1`.`kp2` AS `kp2`,`test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`kp1` = 2) select * from t1 where kp1=2 for update; kp1 kp2 a 2 3 1234 @@ -377,8 +379,10 @@ select * from t1 where pk1=3 order by pk1 desc, pk2 desc for update; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref PRIMARY PRIMARY 4 const # Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref PRIMARY PRIMARY 4 const # 100.00 Backward index scan +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`pk1` AS `pk1`,`test`.`t1`.`pk2` AS `pk2`,`test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`pk1` = 3) order by `test`.`t1`.`pk1` desc,`test`.`t1`.`pk2` desc select * from t1 where pk1=3 order by pk1 desc, pk2 desc @@ -408,8 +412,10 @@ select * from t1 where pk1=4 and pk2 between 5 and 8 order by pk1 desc, pk2 desc for update; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range PRIMARY PRIMARY 8 NULL # Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range PRIMARY PRIMARY 8 NULL # 100.00 Using where; Backward index scan +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`pk1` AS `pk1`,`test`.`t1`.`pk2` AS `pk2`,`test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`pk1` = 4) and (`test`.`t1`.`pk2` between 5 and 8)) order by `test`.`t1`.`pk1` desc,`test`.`t1`.`pk2` desc select * from t1 where pk1=4 and pk2 between 5 and 8 order by pk1 desc, pk2 desc diff --git a/mysql-test/suite/rocksdb/r/range_locking_seek_for_update.result b/mysql-test/suite/rocksdb/r/range_locking_seek_for_update.result index cddf039bc4f..a19331b81c4 100644 --- a/mysql-test/suite/rocksdb/r/range_locking_seek_for_update.result +++ b/mysql-test/suite/rocksdb/r/range_locking_seek_for_update.result @@ -34,8 +34,10 @@ $cf_id $trx_id 00${indexnr}8000000b X # explain select * from t1 where pk>=500 order by pk limit 3 for update; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL # Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range PRIMARY PRIMARY 4 NULL # 100.00 Using where +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`pk` AS `pk`,`test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`pk` >= 500) order by `test`.`t1`.`pk` limit 3 select * from t1 where pk>=500 order by pk limit 3 for update; pk a 500 500 @@ -52,8 +54,10 @@ pk a 11 11 explain select * from t1 order by pk limit 3 for update; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL PRIMARY 4 NULL 3 NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL PRIMARY 4 NULL 3 100.00 NULL +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`pk` AS `pk`,`test`.`t1`.`a` AS `a` from `test`.`t1` order by `test`.`t1`.`pk` limit 3 select * from t1 order by pk limit 3 for update; pk a 0 0 @@ -104,8 +108,10 @@ pk a # right before the range we are about to lock (nothing) explain select * from t1 where pk >=5 order by pk limit 3 for update; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL # Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range PRIMARY PRIMARY 4 NULL # 100.00 Using where +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`pk` AS `pk`,`test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`pk` >= 5) order by `test`.`t1`.`pk` limit 3 begin; set debug_sync='rocksdb.locking_iter_scan SIGNAL about_to_lock_range WAIT_FOR spoiler_inserted'; select * from t1 where pk >=5 order by pk limit 3 for update; @@ -126,8 +132,10 @@ delete from t1 where pk=3; # the range we are locking explain select * from t1 where pk >=5 order by pk limit 1 for update; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL # Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range PRIMARY PRIMARY 4 NULL # 100.00 Using where +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`pk` AS `pk`,`test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`pk` >= 5) order by `test`.`t1`.`pk` limit 1 begin; set debug_sync='rocksdb.locking_iter_scan SIGNAL about_to_lock_range WAIT_FOR spoiler_inserted'; select * from t1 where pk >=5 order by pk limit 1 for update; diff --git a/mysql-test/suite/rocksdb/r/range_locking_shared_locks.result b/mysql-test/suite/rocksdb/r/range_locking_shared_locks.result index b50e383fd82..722889e6721 100644 --- a/mysql-test/suite/rocksdb/r/range_locking_shared_locks.result +++ b/mysql-test/suite/rocksdb/r/range_locking_shared_locks.result @@ -104,8 +104,10 @@ connection default; begin; explain select * from t1 where a between 2 and 5 lock in share mode; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 4 NULL # Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range a a 4 NULL # 100.00 Using where; Using index +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`pk` AS `pk`,`test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` between 2 and 5) select * from t1 where a between 2 and 5 lock in share mode; pk a 2 2 @@ -212,7 +214,7 @@ set @save_mlm= @@rocksdb_max_lock_memory; set @cur_mem_usage= (select variable_value from -information_schema.GLOBAL_STATUS +performance_schema.global_status where variable_name='rocksdb_locktree_current_lock_memory'); set global rocksdb_max_lock_memory = cast(@cur_mem_usage+4 as SIGNED); diff --git a/mysql-test/suite/rocksdb/t/range_locking.inc b/mysql-test/suite/rocksdb/t/range_locking.inc index c676ccb66db..4f1db4399cb 100644 --- a/mysql-test/suite/rocksdb/t/range_locking.inc +++ b/mysql-test/suite/rocksdb/t/range_locking.inc @@ -204,7 +204,7 @@ insert into t1 select 3, a, 1234 from t0; connect (con1,localhost,root,,); connection con1; begin; ---replace_column 9 # +--replace_column 10 # explain select * from t1 where kp1=2 for update; select * from t1 where kp1=2 for update; @@ -458,7 +458,7 @@ insert into t1 values (0x1112222,0x1112222,0); connection default; begin; --echo # Should use ref access w/o filesort: ---replace_column 9 # +--replace_column 10 # explain select * from t1 where pk1=3 @@ -480,7 +480,7 @@ rollback; begin; --echo # Should use range access with 2 keyparts and w/o filesort: ---replace_column 9 # +--replace_column 10 # explain select * from t1 where pk1=4 and pk2 between 5 and 8 diff --git a/mysql-test/suite/rocksdb/t/range_locking_deadlock_tracking.test b/mysql-test/suite/rocksdb/t/range_locking_deadlock_tracking.test index a1fdafa4613..93a449289ec 100644 --- a/mysql-test/suite/rocksdb/t/range_locking_deadlock_tracking.test +++ b/mysql-test/suite/rocksdb/t/range_locking_deadlock_tracking.test @@ -85,10 +85,10 @@ let $wait_condition = select count(*) = 1 from information_schema.rocksdb_trx where thread_id = $con2 and waiting_key != ""; --source include/wait_condition.inc -select variable_value into @a from information_schema.global_status where variable_name='rocksdb_row_lock_deadlocks'; +select variable_value into @a from performance_schema.global_status where variable_name='rocksdb_row_lock_deadlocks'; --error ER_LOCK_DEADLOCK select * from t where i=1 for update; -select case when variable_value-@a = 1 then 'true' else 'false' end as deadlocks from information_schema.global_status where variable_name='rocksdb_row_lock_deadlocks'; +select case when variable_value-@a = 1 then 'true' else 'false' end as deadlocks from performance_schema.global_status where variable_name='rocksdb_row_lock_deadlocks'; rollback; connection con2; @@ -104,7 +104,7 @@ set global rocksdb_max_latest_deadlocks = 5; --replace_regex /[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}/TIMESTAMP/ /WAITING KEY: [0-9a-f]{16}/KEY/ /TRANSACTION ID: [0-9]*/TXN_ID/ /TIMESTAMP: [0-9]*/TSTAMP/ show engine rocksdb transaction status; ---disable_parsing +--disable_testcase BUG#0000 echo Deadlock #5; connection con1; begin; @@ -146,7 +146,7 @@ rollback; connection default; --replace_regex /[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}/TIMESTAMP/ /WAITING KEY: [0-9a-f]{16}/KEY/ /TRANSACTION ID: [0-9]*/TXN_ID/ /TIMESTAMP: [0-9]*/TSTAMP/ show engine rocksdb transaction status; ---enable_parsing +--enable_testcase echo Deadlock #6; connection con1; create table t1 (id int primary key, value int) engine=rocksdb; diff --git a/mysql-test/suite/rocksdb/t/range_locking_seek_for_update.test b/mysql-test/suite/rocksdb/t/range_locking_seek_for_update.test index 32590af1799..c1f0fe312e0 100644 --- a/mysql-test/suite/rocksdb/t/range_locking_seek_for_update.test +++ b/mysql-test/suite/rocksdb/t/range_locking_seek_for_update.test @@ -40,7 +40,7 @@ let $select_from_is_rowlocks_current_trx_only=1; --echo # --echo # SeekForUpdate Test #1: A query with type=range (without upper bound) and LIMIT --echo # ---replace_column 9 # +--replace_column 10 # explain select * from t1 where pk>=500 order by pk limit 3 for update; select * from t1 where pk>=500 order by pk limit 3 for update; @@ -92,7 +92,7 @@ select * from t1 where pk<10; --echo # Test what happens when another transaction commits a row --echo # right before the range we are about to lock (nothing) ---replace_column 9 # +--replace_column 10 # explain select * from t1 where pk >=5 order by pk limit 3 for update; @@ -117,7 +117,7 @@ delete from t1 where pk=3; --echo # Now, repeat the test but let the other transaction insert the row into --echo # the range we are locking ---replace_column 9 # +--replace_column 10 # explain select * from t1 where pk >=5 order by pk limit 1 for update; diff --git a/mysql-test/suite/rocksdb/t/range_locking_shared_locks.test b/mysql-test/suite/rocksdb/t/range_locking_shared_locks.test index d569a21ebec..c6e4e457897 100644 --- a/mysql-test/suite/rocksdb/t/range_locking_shared_locks.test +++ b/mysql-test/suite/rocksdb/t/range_locking_shared_locks.test @@ -104,7 +104,7 @@ let $TRX2_ID=`select transaction_id from information_schema.rocksdb_trx where th connection default; begin; ---replace_column 9 # +--replace_column 10 # explain select * from t1 where a between 2 and 5 lock in share mode; select * from t1 where a between 2 and 5 lock in share mode; @@ -177,7 +177,7 @@ set @save_mlm= @@rocksdb_max_lock_memory; set @cur_mem_usage= (select variable_value from - information_schema.GLOBAL_STATUS + performance_schema.global_status where variable_name='rocksdb_locktree_current_lock_memory');