[Commits] 0a80ecf45ff: Range Locking: small fixes

Sergei Petrunia psergey at askmonty.org
Mon Apr 29 18:46:43 EEST 2019


revision-id: 0a80ecf45ff5973d4a01fb63e1f6fcdaf1ecf7e9 (fb-prod201801-228-g0a80ecf45ff)
parent(s): c523d5bd0e776a88495405dc9ba305da9fe17600
author: Sergei Petrunia
committer: Sergei Petrunia
timestamp: 2019-04-29 18:46:43 +0300
message:

Range Locking: small fixes

- Update rocksdb ( Range Locking : minor fixes)
- Remove rocksdb.range_locking dependencies from indexnr, transaction nr,
  cf_id and other transient numbers.

---
 .../rocksdb/include/select_from_is_rowlocks.inc    | 16 +++++++++++++
 mysql-test/suite/rocksdb/r/range_locking.result    | 26 +++++++++++-----------
 .../suite/rocksdb/r/range_locking_rev_cf.result    | 26 +++++++++++-----------
 mysql-test/suite/rocksdb/t/range_locking.inc       | 13 +++++------
 rocksdb                                            |  2 +-
 5 files changed, 49 insertions(+), 34 deletions(-)

diff --git a/mysql-test/suite/rocksdb/include/select_from_is_rowlocks.inc b/mysql-test/suite/rocksdb/include/select_from_is_rowlocks.inc
new file mode 100644
index 00000000000..307b1e53552
--- /dev/null
+++ b/mysql-test/suite/rocksdb/include/select_from_is_rowlocks.inc
@@ -0,0 +1,16 @@
+--echo # select * from information_schema.rocksdb_locks; # With replacements by select_from_is_rowlocks.inc
+--disable_query_log
+set @cf_id=(select column_family from information_schema.rocksdb_ddl
+            where table_name='t1' and index_name='PRIMARY');
+set @rtrx_id=(select transaction_id from information_schema.rocksdb_trx
+              where thread_id=connection_id());
+set @indexnr= (select lpad(hex(index_number),6,'0') from information_schema.rocksdb_ddl
+               where table_name='t1' and index_name='PRIMARY');
+
+select 
+  replace(column_family_id, @cf_id, "$cf_id") as COLUMN_FAMILY_ID,
+  replace(transaction_id, @rtrx_id, "$trx_id")as TRANSACTION_ID,
+  replace(`key`, @indexnr, '${indexnr}') as `KEY`,
+  mode
+from information_schema.rocksdb_locks;
+--enable_query_log
diff --git a/mysql-test/suite/rocksdb/r/range_locking.result b/mysql-test/suite/rocksdb/r/range_locking.result
index 0518260f53a..5ab797b30d4 100644
--- a/mysql-test/suite/rocksdb/r/range_locking.result
+++ b/mysql-test/suite/rocksdb/r/range_locking.result
@@ -23,7 +23,6 @@ ERROR HY000: Lock wait timeout exceeded; try restarting transaction: Timeout on
 connection con1;
 rollback;
 ## Test: check that range lock inhibits another range lock
-##  (It should not, but currently it does)
 connection con1;
 begin;
 select * from t1 where pk between 5 and 25 for update;
@@ -53,7 +52,8 @@ pk	a
 rollback;
 connection con1;
 rollback;
-## Test that locks are not released when a statement in the transaction
+## Test that locks are not released when a statement inside 
+## a transaction is rolled back
 create table t2 (
 pk int,
 a int,
@@ -91,24 +91,24 @@ begin;
 select * from t1 where pk=10 for update;
 pk	a
 10	10
-select * from information_schema.rocksdb_locks;
-COLUMN_FAMILY_ID	TRANSACTION_ID	KEY	MODE
-0	15	00000001078000000a	X
+# select * from information_schema.rocksdb_locks; # With replacements by select_from_is_rowlocks.inc
+COLUMN_FAMILY_ID	TRANSACTION_ID	KEY	mode
+$cf_id	$trx_id	0000${indexnr}8000000a	X
 delete from t1 where pk between 25 and 40;
-select * from information_schema.rocksdb_locks;
-COLUMN_FAMILY_ID	TRANSACTION_ID	KEY	MODE
-0	15	000000010780000019 - 010000010780000028	X
-0	15	00000001078000000a	X
+# select * from information_schema.rocksdb_locks; # With replacements by select_from_is_rowlocks.inc
+COLUMN_FAMILY_ID	TRANSACTION_ID	KEY	mode
+$cf_id	$trx_id	0000${indexnr}80000019 - 0100${indexnr}80000028	X
+$cf_id	$trx_id	0000${indexnr}8000000a	X
 rollback;
 begin;
 # The following will show a range lock on 2-9 and also a point lock on 10.
 # This is how things currently work.
 select * from t1 where pk between 2 and 9 for update;
 pk	a
-select * from information_schema.rocksdb_locks;
-COLUMN_FAMILY_ID	TRANSACTION_ID	KEY	MODE
-0	16	00000001078000000a	X
-0	16	000000010780000002 - 010000010780000009	X
+# select * from information_schema.rocksdb_locks; # With replacements by select_from_is_rowlocks.inc
+COLUMN_FAMILY_ID	TRANSACTION_ID	KEY	mode
+$cf_id	$trx_id	0000${indexnr}8000000a	X
+$cf_id	$trx_id	0000${indexnr}80000002 - 0100${indexnr}80000009	X
 rollback;
 drop table t1;
 #
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 c2f8064c6b7..073ebd3afa8 100644
--- a/mysql-test/suite/rocksdb/r/range_locking_rev_cf.result
+++ b/mysql-test/suite/rocksdb/r/range_locking_rev_cf.result
@@ -23,7 +23,6 @@ ERROR HY000: Lock wait timeout exceeded; try restarting transaction: Timeout on
 connection con1;
 rollback;
 ## Test: check that range lock inhibits another range lock
-##  (It should not, but currently it does)
 connection con1;
 begin;
 select * from t1 where pk between 5 and 25 for update;
@@ -53,7 +52,8 @@ pk	a
 rollback;
 connection con1;
 rollback;
-## Test that locks are not released when a statement in the transaction
+## Test that locks are not released when a statement inside 
+## a transaction is rolled back
 create table t2 (
 pk int,
 a int,
@@ -91,24 +91,24 @@ begin;
 select * from t1 where pk=10 for update;
 pk	a
 10	10
-select * from information_schema.rocksdb_locks;
-COLUMN_FAMILY_ID	TRANSACTION_ID	KEY	MODE
-0	15	00000001078000000a	X
+# select * from information_schema.rocksdb_locks; # With replacements by select_from_is_rowlocks.inc
+COLUMN_FAMILY_ID	TRANSACTION_ID	KEY	mode
+0	$trx_id	0000${indexnr}8000000a	X
 delete from t1 where pk between 25 and 40;
-select * from information_schema.rocksdb_locks;
-COLUMN_FAMILY_ID	TRANSACTION_ID	KEY	MODE
-0	15	00000001078000000a	X
-0	15	000000010780000028 - 010000010780000019	X
+# select * from information_schema.rocksdb_locks; # With replacements by select_from_is_rowlocks.inc
+COLUMN_FAMILY_ID	TRANSACTION_ID	KEY	mode
+0	$trx_id	0000${indexnr}8000000a	X
+0	$trx_id	0000${indexnr}80000028 - 0100${indexnr}80000019	X
 rollback;
 begin;
 # The following will show a range lock on 2-9 and also a point lock on 10.
 # This is how things currently work.
 select * from t1 where pk between 2 and 9 for update;
 pk	a
-select * from information_schema.rocksdb_locks;
-COLUMN_FAMILY_ID	TRANSACTION_ID	KEY	MODE
-0	16	000000010780000009 - 010000010780000002	X
-0	16	00000001078000000a	X
+# select * from information_schema.rocksdb_locks; # With replacements by select_from_is_rowlocks.inc
+COLUMN_FAMILY_ID	TRANSACTION_ID	KEY	mode
+0	$trx_id	0000${indexnr}80000009 - 0100${indexnr}80000002	X
+0	$trx_id	0000${indexnr}8000000a	X
 rollback;
 drop table t1;
 #
diff --git a/mysql-test/suite/rocksdb/t/range_locking.inc b/mysql-test/suite/rocksdb/t/range_locking.inc
index 9c826811695..db71f91c3b0 100644
--- a/mysql-test/suite/rocksdb/t/range_locking.inc
+++ b/mysql-test/suite/rocksdb/t/range_locking.inc
@@ -10,8 +10,6 @@
 
 show variables like 'rocksdb_use_range_locking';
 
-# Test 1: see that ranges are indeed lockied.
-
 eval create table t1 (
   pk int,
   a int,
@@ -37,7 +35,6 @@ connection con1;
 rollback;
 
 --echo ## Test: check that range lock inhibits another range lock
---echo ##  (It should not, but currently it does)
 connection con1;
 begin;
 select * from t1 where pk between 5 and 25 for update;
@@ -65,7 +62,8 @@ rollback;
 connection con1;
 rollback;
 
---echo ## Test that locks are not released when a statement in the transaction
+--echo ## Test that locks are not released when a statement inside 
+--echo ## a transaction is rolled back
 eval
 create table t2 (
   pk int,
@@ -114,17 +112,18 @@ insert into t1 values
 begin;
 select * from t1 where pk=10 for update;
 
-select * from information_schema.rocksdb_locks;
+--source suite/rocksdb/include/select_from_is_rowlocks.inc
 
 delete from t1 where pk between 25 and 40;
-select * from information_schema.rocksdb_locks;
+
+--source suite/rocksdb/include/select_from_is_rowlocks.inc
 
 rollback;
 begin;
 --echo # The following will show a range lock on 2-9 and also a point lock on 10.
 --echo # This is how things currently work.
 select * from t1 where pk between 2 and 9 for update;
-select * from information_schema.rocksdb_locks;
+--source suite/rocksdb/include/select_from_is_rowlocks.inc
 rollback;
 
 drop table t1;
diff --git a/rocksdb b/rocksdb
index d334cf12818..293d6902411 160000
--- a/rocksdb
+++ b/rocksdb
@@ -1 +1 @@
-Subproject commit d334cf12818bfd2d44dc06c7bbe78c3a18bca543
+Subproject commit 293d6902411748728fb48bf63e63ba121a963788


More information about the commits mailing list