forked from facebook/mysql-5.6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Issue facebook#44: SELECT ... LOCK IN SHARE MODE
Summary: Add support for read and read write locks in RocksDB's LockTable. The implementation is more concerned with correctness than with concurrency. Differential Revision: https://reviews.facebook.net/D38265 fbshipit-source-id: 374184b65bd
- Loading branch information
Showing
12 changed files
with
938 additions
and
151 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
create table t1 (pk int not null primary key) engine=rocksdb; | ||
insert into t1 values (1),(2),(3); | ||
set autocommit=0; | ||
begin; | ||
select * from t1 where pk=1 for update; | ||
pk | ||
1 | ||
### Connection con1 | ||
set @@rocksdb_lock_wait_timeout=500; | ||
set autocommit=0; | ||
begin; | ||
set session debug= "+d,myrocks_simulate_lock_timeout1"; | ||
select * from t1 where pk=1 for update;; | ||
### Connection default | ||
rollback; | ||
### Connection con1 | ||
ERROR HY000: Lock wait timeout exceeded; try restarting transaction | ||
set session debug= "-d,myrocks_simulate_lock_timeout1"; | ||
set autocommit=1; | ||
drop table t1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# | ||
# MyRocks-specific tests for locking | ||
# | ||
--source include/have_debug.inc | ||
|
||
create table t1 (pk int not null primary key) engine=rocksdb; | ||
|
||
insert into t1 values (1),(2),(3); | ||
|
||
set autocommit=0; | ||
begin; | ||
select * from t1 where pk=1 for update; | ||
|
||
--connect (con1,localhost,root,,) | ||
--connection con1 | ||
--echo ### Connection con1 | ||
let $ID= `select connection_id()`; | ||
set @@rocksdb_lock_wait_timeout=500; | ||
set autocommit=0; | ||
begin; | ||
set session debug= "+d,myrocks_simulate_lock_timeout1"; | ||
--send select * from t1 where pk=1 for update; | ||
|
||
--connection default | ||
--echo ### Connection default | ||
|
||
let $wait_condition= select 1 from INFORMATION_SCHEMA.PROCESSLIST | ||
where ID = $ID and STATE = "Waiting for row lock"; | ||
--source include/wait_condition.inc | ||
## Waiting for row lock | ||
## select connection_id(); | ||
## select state='Waiting for row lock' from information_schema.processlist where id=2; | ||
|
||
rollback; | ||
|
||
--connection con1 | ||
--echo ### Connection con1 | ||
|
||
--error ER_LOCK_WAIT_TIMEOUT | ||
--reap | ||
set session debug= "-d,myrocks_simulate_lock_timeout1"; | ||
|
||
--disconnect con1 | ||
--connection default | ||
|
||
set autocommit=1; | ||
drop table t1; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.