Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
76a94a03
Commit
76a94a03
authored
May 16, 2019
by
Sergey Vojtovich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-19090 - Split rocksdb.locking_issues
This test takes ~6 minutes, split it for better parallelism.
parent
a24dffdb
Changes
42
Show whitespace changes
Inline
Side-by-side
Showing
42 changed files
with
764 additions
and
739 deletions
+764
-739
storage/rocksdb/mysql-test/rocksdb/r/locking_issues.result
storage/rocksdb/mysql-test/rocksdb/r/locking_issues.result
+1
-674
storage/rocksdb/mysql-test/rocksdb/r/locking_issues_case1_1_rc.result
...sdb/mysql-test/rocksdb/r/locking_issues_case1_1_rc.result
+30
-0
storage/rocksdb/mysql-test/rocksdb/r/locking_issues_case1_1_rr.result
...sdb/mysql-test/rocksdb/r/locking_issues_case1_1_rr.result
+30
-0
storage/rocksdb/mysql-test/rocksdb/r/locking_issues_case1_2_rc.result
...sdb/mysql-test/rocksdb/r/locking_issues_case1_2_rc.result
+30
-0
storage/rocksdb/mysql-test/rocksdb/r/locking_issues_case1_2_rr.result
...sdb/mysql-test/rocksdb/r/locking_issues_case1_2_rr.result
+30
-0
storage/rocksdb/mysql-test/rocksdb/r/locking_issues_case2_rc.result
...cksdb/mysql-test/rocksdb/r/locking_issues_case2_rc.result
+50
-0
storage/rocksdb/mysql-test/rocksdb/r/locking_issues_case2_rc_lsr.result
...b/mysql-test/rocksdb/r/locking_issues_case2_rc_lsr.result
+37
-0
storage/rocksdb/mysql-test/rocksdb/r/locking_issues_case2_rr.result
...cksdb/mysql-test/rocksdb/r/locking_issues_case2_rr.result
+50
-0
storage/rocksdb/mysql-test/rocksdb/r/locking_issues_case2_rr_lsr.result
...b/mysql-test/rocksdb/r/locking_issues_case2_rr_lsr.result
+37
-0
storage/rocksdb/mysql-test/rocksdb/r/locking_issues_case3_rc.result
...cksdb/mysql-test/rocksdb/r/locking_issues_case3_rc.result
+25
-0
storage/rocksdb/mysql-test/rocksdb/r/locking_issues_case3_rr.result
...cksdb/mysql-test/rocksdb/r/locking_issues_case3_rr.result
+23
-0
storage/rocksdb/mysql-test/rocksdb/r/locking_issues_case4_rc.result
...cksdb/mysql-test/rocksdb/r/locking_issues_case4_rc.result
+23
-0
storage/rocksdb/mysql-test/rocksdb/r/locking_issues_case4_rr.result
...cksdb/mysql-test/rocksdb/r/locking_issues_case4_rr.result
+23
-0
storage/rocksdb/mysql-test/rocksdb/r/locking_issues_case5_rc.result
...cksdb/mysql-test/rocksdb/r/locking_issues_case5_rc.result
+29
-0
storage/rocksdb/mysql-test/rocksdb/r/locking_issues_case5_rr.result
...cksdb/mysql-test/rocksdb/r/locking_issues_case5_rr.result
+28
-0
storage/rocksdb/mysql-test/rocksdb/r/locking_issues_case6_rc.result
...cksdb/mysql-test/rocksdb/r/locking_issues_case6_rc.result
+29
-0
storage/rocksdb/mysql-test/rocksdb/r/locking_issues_case6_rr.result
...cksdb/mysql-test/rocksdb/r/locking_issues_case6_rr.result
+28
-0
storage/rocksdb/mysql-test/rocksdb/r/locking_issues_case7_rc.result
...cksdb/mysql-test/rocksdb/r/locking_issues_case7_rc.result
+41
-0
storage/rocksdb/mysql-test/rocksdb/r/locking_issues_case7_rc_lsr.result
...b/mysql-test/rocksdb/r/locking_issues_case7_rc_lsr.result
+45
-0
storage/rocksdb/mysql-test/rocksdb/r/locking_issues_case7_rr.result
...cksdb/mysql-test/rocksdb/r/locking_issues_case7_rr.result
+41
-0
storage/rocksdb/mysql-test/rocksdb/r/locking_issues_case7_rr_lsr.result
...b/mysql-test/rocksdb/r/locking_issues_case7_rr_lsr.result
+45
-0
storage/rocksdb/mysql-test/rocksdb/t/locking_issues.test
storage/rocksdb/mysql-test/rocksdb/t/locking_issues.test
+1
-65
storage/rocksdb/mysql-test/rocksdb/t/locking_issues_case1_1_rc.test
...cksdb/mysql-test/rocksdb/t/locking_issues_case1_1_rc.test
+4
-0
storage/rocksdb/mysql-test/rocksdb/t/locking_issues_case1_1_rr.test
...cksdb/mysql-test/rocksdb/t/locking_issues_case1_1_rr.test
+4
-0
storage/rocksdb/mysql-test/rocksdb/t/locking_issues_case1_2_rc.test
...cksdb/mysql-test/rocksdb/t/locking_issues_case1_2_rc.test
+4
-0
storage/rocksdb/mysql-test/rocksdb/t/locking_issues_case1_2_rr.test
...cksdb/mysql-test/rocksdb/t/locking_issues_case1_2_rr.test
+4
-0
storage/rocksdb/mysql-test/rocksdb/t/locking_issues_case2_rc.test
...rocksdb/mysql-test/rocksdb/t/locking_issues_case2_rc.test
+5
-0
storage/rocksdb/mysql-test/rocksdb/t/locking_issues_case2_rc_lsr.test
...sdb/mysql-test/rocksdb/t/locking_issues_case2_rc_lsr.test
+5
-0
storage/rocksdb/mysql-test/rocksdb/t/locking_issues_case2_rr.test
...rocksdb/mysql-test/rocksdb/t/locking_issues_case2_rr.test
+5
-0
storage/rocksdb/mysql-test/rocksdb/t/locking_issues_case2_rr_lsr.test
...sdb/mysql-test/rocksdb/t/locking_issues_case2_rr_lsr.test
+5
-0
storage/rocksdb/mysql-test/rocksdb/t/locking_issues_case3_rc.test
...rocksdb/mysql-test/rocksdb/t/locking_issues_case3_rc.test
+4
-0
storage/rocksdb/mysql-test/rocksdb/t/locking_issues_case3_rr.test
...rocksdb/mysql-test/rocksdb/t/locking_issues_case3_rr.test
+4
-0
storage/rocksdb/mysql-test/rocksdb/t/locking_issues_case4_rc.test
...rocksdb/mysql-test/rocksdb/t/locking_issues_case4_rc.test
+4
-0
storage/rocksdb/mysql-test/rocksdb/t/locking_issues_case4_rr.test
...rocksdb/mysql-test/rocksdb/t/locking_issues_case4_rr.test
+4
-0
storage/rocksdb/mysql-test/rocksdb/t/locking_issues_case5_rc.test
...rocksdb/mysql-test/rocksdb/t/locking_issues_case5_rc.test
+4
-0
storage/rocksdb/mysql-test/rocksdb/t/locking_issues_case5_rr.test
...rocksdb/mysql-test/rocksdb/t/locking_issues_case5_rr.test
+4
-0
storage/rocksdb/mysql-test/rocksdb/t/locking_issues_case6_rc.test
...rocksdb/mysql-test/rocksdb/t/locking_issues_case6_rc.test
+4
-0
storage/rocksdb/mysql-test/rocksdb/t/locking_issues_case6_rr.test
...rocksdb/mysql-test/rocksdb/t/locking_issues_case6_rr.test
+4
-0
storage/rocksdb/mysql-test/rocksdb/t/locking_issues_case7_rc.test
...rocksdb/mysql-test/rocksdb/t/locking_issues_case7_rc.test
+5
-0
storage/rocksdb/mysql-test/rocksdb/t/locking_issues_case7_rc_lsr.test
...sdb/mysql-test/rocksdb/t/locking_issues_case7_rc_lsr.test
+5
-0
storage/rocksdb/mysql-test/rocksdb/t/locking_issues_case7_rr.test
...rocksdb/mysql-test/rocksdb/t/locking_issues_case7_rr.test
+5
-0
storage/rocksdb/mysql-test/rocksdb/t/locking_issues_case7_rr_lsr.test
...sdb/mysql-test/rocksdb/t/locking_issues_case7_rr_lsr.test
+5
-0
No files found.
storage/rocksdb/mysql-test/rocksdb/r/locking_issues.result
View file @
76a94a03
-----------------------------------------------------------------------
- Locking issues case 1.1:
- Locking rows that do not exist when using all primary key columns in
- a WHERE clause
- using REPEATABLE READ transaction isolation level
-----------------------------------------------------------------------
DROP TABLE IF EXISTS t0;
CREATE TABLE t0(id1 INT, id2 INT, value INT, PRIMARY KEY(id1, id2));
INSERT INTO t0 VALUES (1,1,0), (3,3,0), (4,4,0), (6,6,0);
connect con1,localhost,root,,;
connect con2,localhost,root,,;
connection con1;
SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
BEGIN;
SELECT * FROM t0 WHERE id1=1 AND id2=5 FOR UPDATE;
id1 id2 value
connection con2;
SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
BEGIN;
INSERT INTO t0 VALUES (1,5,0);
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
SELECT * FROM t0 WHERE id1=1 AND id2=5 FOR UPDATE;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
connection con1;
COMMIT;
connection default;
disconnect con1;
disconnect con2;
DROP TABLE t0;
-----------------------------------------------------------------------
- Locking issues case 1.1:
- Locking rows that do not exist when using all primary key columns in
- a WHERE clause
- using READ COMMITTED transaction isolation level
-----------------------------------------------------------------------
DROP TABLE IF EXISTS t0;
CREATE TABLE t0(id1 INT, id2 INT, value INT, PRIMARY KEY(id1, id2));
INSERT INTO t0 VALUES (1,1,0), (3,3,0), (4,4,0), (6,6,0);
connect con1,localhost,root,,;
connect con2,localhost,root,,;
connection con1;
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
BEGIN;
SELECT * FROM t0 WHERE id1=1 AND id2=5 FOR UPDATE;
id1 id2 value
connection con2;
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
BEGIN;
INSERT INTO t0 VALUES (1,5,0);
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
SELECT * FROM t0 WHERE id1=1 AND id2=5 FOR UPDATE;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
connection con1;
COMMIT;
connection default;
disconnect con1;
disconnect con2;
DROP TABLE t0;
-----------------------------------------------------------------------
- Locking issues case 1.2:
- Locking rows that do not exist without using all primary key
- columns in a WHERE clause
- using REPEATABLE READ transaction isolation level
-----------------------------------------------------------------------
DROP TABLE IF EXISTS t0;
CREATE TABLE t0(id1 INT, id2 INT, value INT, PRIMARY KEY(id1, id2));
INSERT INTO t0 VALUES (1,1,0), (3,3,0), (4,4,0), (6,6,0);
connect con1,localhost,root,,;
connect con2,localhost,root,,;
connection con1;
SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
BEGIN;
SELECT * FROM t0 WHERE id1=1 FOR UPDATE;
id1 id2 value
1 1 0
connection con2;
SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
BEGIN;
SELECT * FROM t0 WHERE id1=1 AND id2=4 FOR UPDATE;
id1 id2 value
INSERT INTO t0 VALUES (1,5,0);
connection con1;
COMMIT;
connection default;
disconnect con1;
disconnect con2;
DROP TABLE t0;
-----------------------------------------------------------------------
- Locking issues case 1.2:
- Locking rows that do not exist without using all primary key
- columns in a WHERE clause
- using READ COMMITTED transaction isolation level
-----------------------------------------------------------------------
DROP TABLE IF EXISTS t0;
CREATE TABLE t0(id1 INT, id2 INT, value INT, PRIMARY KEY(id1, id2));
INSERT INTO t0 VALUES (1,1,0), (3,3,0), (4,4,0), (6,6,0);
connect con1,localhost,root,,;
connect con2,localhost,root,,;
connection con1;
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
BEGIN;
SELECT * FROM t0 WHERE id1=1 FOR UPDATE;
id1 id2 value
1 1 0
connection con2;
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
BEGIN;
SELECT * FROM t0 WHERE id1=1 AND id2=4 FOR UPDATE;
id1 id2 value
INSERT INTO t0 VALUES (1,5,0);
connection con1;
COMMIT;
connection default;
disconnect con1;
disconnect con2;
DROP TABLE t0;
-----------------------------------------------------------------------
- Locking issues case 2:
- Rows that are scanned but do not match the WHERE are not locked
- using REPEATABLE READ transaction isolation level unless
- rocksdb_lock_scanned_rows is on
-----------------------------------------------------------------------
DROP TABLE IF EXISTS t0;
SELECT @@global.rocksdb_lock_scanned_rows;
@@global.rocksdb_lock_scanned_rows
0
CREATE TABLE t0(id INT PRIMARY KEY, value INT);
INSERT INTO t0 VALUES (1,0), (2,1), (3,0), (4,0), (5,1);
connect con1,localhost,root,,;
connect con2,localhost,root,,;
connection con1;
SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
BEGIN;
connection con2;
SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
BEGIN;
connection con1;
SELECT * FROM t0 WHERE value > 0 FOR UPDATE;
id value
2 1
5 1
connection con2;
UPDATE t0 SET VALUE=10 WHERE id=1;
UPDATE t0 SET VALUE=10 WHERE id=5;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
connection con1;
UPDATE t0 SET value=100 WHERE id in (4,5) and value>0;
connection con2;
SELECT * FROM t0 WHERE id=4 FOR UPDATE;
id value
4 0
COMMIT;
SELECT * FROM t0;
id value
1 10
2 1
3 0
4 0
5 1
connection con1;
COMMIT;
connection default;
disconnect con1;
disconnect con2;
DROP TABLE t0;
-----------------------------------------------------------------------
- Locking issues case 2:
- Rows that are scanned but do not match the WHERE are not locked
- using READ COMMITTED transaction isolation level unless
- rocksdb_lock_scanned_rows is on
-----------------------------------------------------------------------
DROP TABLE IF EXISTS t0;
SELECT @@global.rocksdb_lock_scanned_rows;
@@global.rocksdb_lock_scanned_rows
0
CREATE TABLE t0(id INT PRIMARY KEY, value INT);
INSERT INTO t0 VALUES (1,0), (2,1), (3,0), (4,0), (5,1);
connect con1,localhost,root,,;
connect con2,localhost,root,,;
connection con1;
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
BEGIN;
connection con2;
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
BEGIN;
connection con1;
SELECT * FROM t0 WHERE value > 0 FOR UPDATE;
id value
2 1
5 1
connection con2;
UPDATE t0 SET VALUE=10 WHERE id=1;
UPDATE t0 SET VALUE=10 WHERE id=5;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
connection con1;
UPDATE t0 SET value=100 WHERE id in (4,5) and value>0;
connection con2;
SELECT * FROM t0 WHERE id=4 FOR UPDATE;
id value
4 0
COMMIT;
SELECT * FROM t0;
id value
1 10
2 1
3 0
4 0
5 1
connection con1;
COMMIT;
connection default;
disconnect con1;
disconnect con2;
DROP TABLE t0;
-----------------------------------------------------------------------
- Locking issues case 2:
- Rows that are scanned but do not match the WHERE are not locked
- using REPEATABLE READ transaction isolation level unless
- rocksdb_lock_scanned_rows is on
-----------------------------------------------------------------------
DROP TABLE IF EXISTS t0;
SELECT @@global.rocksdb_lock_scanned_rows;
@@global.rocksdb_lock_scanned_rows
0
SET GLOBAL rocksdb_lock_scanned_rows=ON;
CREATE TABLE t0(id INT PRIMARY KEY, value INT);
INSERT INTO t0 VALUES (1,0), (2,1), (3,0), (4,0), (5,1);
connect con1,localhost,root,,;
connect con2,localhost,root,,;
connection con1;
SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
BEGIN;
connection con2;
SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
BEGIN;
connection con1;
SELECT * FROM t0 WHERE value > 0 FOR UPDATE;
id value
2 1
5 1
connection con2;
UPDATE t0 SET VALUE=10 WHERE id=1;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
connection con1;
COMMIT;
connection default;
disconnect con1;
disconnect con2;
DROP TABLE t0;
SET GLOBAL rocksdb_lock_scanned_rows=0;
-----------------------------------------------------------------------
- Locking issues case 2:
- Rows that are scanned but do not match the WHERE are not locked
- using READ COMMITTED transaction isolation level unless
- rocksdb_lock_scanned_rows is on
-----------------------------------------------------------------------
DROP TABLE IF EXISTS t0;
SELECT @@global.rocksdb_lock_scanned_rows;
@@global.rocksdb_lock_scanned_rows
0
SET GLOBAL rocksdb_lock_scanned_rows=ON;
CREATE TABLE t0(id INT PRIMARY KEY, value INT);
INSERT INTO t0 VALUES (1,0), (2,1), (3,0), (4,0), (5,1);
connect con1,localhost,root,,;
connect con2,localhost,root,,;
connection con1;
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
BEGIN;
connection con2;
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
BEGIN;
connection con1;
SELECT * FROM t0 WHERE value > 0 FOR UPDATE;
id value
2 1
5 1
connection con2;
UPDATE t0 SET VALUE=10 WHERE id=1;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
connection con1;
COMMIT;
connection default;
disconnect con1;
disconnect con2;
DROP TABLE t0;
SET GLOBAL rocksdb_lock_scanned_rows=0;
-----------------------------------------------------------------------
- Locking issues case 3:
- After creating a snapshot, other clients updating rows
- using REPEATABLE READ transaction isolation level
-----------------------------------------------------------------------
DROP TABLE IF EXISTS t0;
CREATE TABLE t0(id INT AUTO_INCREMENT PRIMARY KEY, value INT);
Inserting 200,000 rows
connect con1,localhost,root,,;
connect con2,localhost,root,,;
connection con1;
SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
SELECT * FROM t0 WHERE value > 0 FOR UPDATE;
connection con2;
SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
UPDATE t0 SET VALUE=VALUE+1 WHERE id=190000;
connection con1;
ERROR: 1213
connection default;
disconnect con1;
disconnect con2;
DROP TABLE t0;
-----------------------------------------------------------------------
- Locking issues case 3:
- After creating a snapshot, other clients updating rows
- using READ COMMITTED transaction isolation level
-----------------------------------------------------------------------
DROP TABLE IF EXISTS t0;
CREATE TABLE t0(id INT AUTO_INCREMENT PRIMARY KEY, value INT);
Inserting 200,000 rows
connect con1,localhost,root,,;
connect con2,localhost,root,,;
connection con1;
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
SELECT * FROM t0 WHERE value > 0 FOR UPDATE;
connection con2;
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
UPDATE t0 SET VALUE=VALUE+1 WHERE id=190000;
connection con1;
id value
190000 1
ERROR: 0
connection default;
disconnect con1;
disconnect con2;
DROP TABLE t0;
-----------------------------------------------------------------------
- Locking issues case 4:
- Phantom rows
- using REPEATABLE READ transaction isolation level
-----------------------------------------------------------------------
DROP TABLE IF EXISTS t0;
CREATE TABLE t0(id INT AUTO_INCREMENT PRIMARY KEY, value INT);
Inserting 200,000 rows
connect con1,localhost,root,,;
connect con2,localhost,root,,;
connection con1;
SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
SELECT * FROM t0 WHERE value > 0 FOR UPDATE;
connection con2;
SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
INSERT INTO t0 VALUES(200001,1), (-1,1);
connection con1;
id value
connection default;
disconnect con1;
disconnect con2;
DROP TABLE t0;
-----------------------------------------------------------------------
- Locking issues case 4:
- Phantom rows
- using READ COMMITTED transaction isolation level
-----------------------------------------------------------------------
DROP TABLE IF EXISTS t0;
CREATE TABLE t0(id INT AUTO_INCREMENT PRIMARY KEY, value INT);
Inserting 200,000 rows
connect con1,localhost,root,,;
connect con2,localhost,root,,;
connection con1;
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
SELECT * FROM t0 WHERE value > 0 FOR UPDATE;
connection con2;
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
INSERT INTO t0 VALUES(200001,1), (-1,1);
connection con1;
id value
connection default;
disconnect con1;
disconnect con2;
DROP TABLE t0;
-----------------------------------------------------------------------
- Locking issues case 5:
- Deleting primary key
- using REPEATABLE READ transaction isolation level
-----------------------------------------------------------------------
DROP TABLE IF EXISTS t0;
CREATE TABLE t0(id INT AUTO_INCREMENT PRIMARY KEY, value INT);
Inserting 200,000 rows
UPDATE t0 SET value=100 WHERE id=190000;
connect con1,localhost,root,,;
connect con2,localhost,root,,;
connection con1;
SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
BEGIN;
SELECT * FROM t0 WHERE value > 0 FOR UPDATE;
connection con2;
SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
BEGIN;
DELETE FROM t0 WHERE id=190000;
COMMIT;
connection con1;
ERROR: 1213
COMMIT;
connection default;
disconnect con1;
disconnect con2;
DROP TABLE t0;
-----------------------------------------------------------------------
- Locking issues case 5:
- Deleting primary key
- using READ COMMITTED transaction isolation level
-----------------------------------------------------------------------
DROP TABLE IF EXISTS t0;
CREATE TABLE t0(id INT AUTO_INCREMENT PRIMARY KEY, value INT);
Inserting 200,000 rows
UPDATE t0 SET value=100 WHERE id=190000;
connect con1,localhost,root,,;
connect con2,localhost,root,,;
connection con1;
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
BEGIN;
SELECT * FROM t0 WHERE value > 0 FOR UPDATE;
connection con2;
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
BEGIN;
DELETE FROM t0 WHERE id=190000;
COMMIT;
connection con1;
id value
ERROR: 0
COMMIT;
connection default;
disconnect con1;
disconnect con2;
DROP TABLE t0;
-----------------------------------------------------------------------
- Locking issues case 6:
- Changing primary key
- using REPEATABLE READ transaction isolation level
-----------------------------------------------------------------------
DROP TABLE IF EXISTS t0;
CREATE TABLE t0(id INT AUTO_INCREMENT PRIMARY KEY, value INT);
Inserting 200,000 rows
UPDATE t0 SET value=100 WHERE id=190000;
connect con1,localhost,root,,;
connect con2,localhost,root,,;
connection con1;
SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
BEGIN;
SELECT * FROM t0 WHERE value > 0 FOR UPDATE;
connection con2;
SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
BEGIN;
UPDATE t0 SET id=200001 WHERE id=190000;
COMMIT;
connection con1;
ERROR: 1213
COMMIT;
connection default;
disconnect con1;
disconnect con2;
DROP TABLE t0;
-----------------------------------------------------------------------
- Locking issues case 6:
- Changing primary key
- using READ COMMITTED transaction isolation level
-----------------------------------------------------------------------
DROP TABLE IF EXISTS t0;
CREATE TABLE t0(id INT AUTO_INCREMENT PRIMARY KEY, value INT);
Inserting 200,000 rows
UPDATE t0 SET value=100 WHERE id=190000;
connect con1,localhost,root,,;
connect con2,localhost,root,,;
connection con1;
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
BEGIN;
SELECT * FROM t0 WHERE value > 0 FOR UPDATE;
connection con2;
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
BEGIN;
UPDATE t0 SET id=200001 WHERE id=190000;
COMMIT;
connection con1;
id value
ERROR: 0
COMMIT;
connection default;
disconnect con1;
disconnect con2;
DROP TABLE t0;
-----------------------------------------------------------------------
- Locking issues case 7:
- Rows that are scanned as part of a query but not in the table being
- updated should not be locked unless rocksdb_lock_scanned_rows is on
-----------------------------------------------------------------------
DROP TABLE IF EXISTS t1, t2;
SELECT @@global.rocksdb_lock_scanned_rows;
@@global.rocksdb_lock_scanned_rows
0
CREATE TABLE t1(id INT PRIMARY KEY, value INT);
CREATE TABLE t2(id INT PRIMARY KEY, value INT);
INSERT INTO t1 VALUES (1,1), (2,2), (3,3);
INSERT INTO t2 VALUES (1,1), (2,2), (3,3), (4,4), (5,5);
connect con1,localhost,root,,;
connect con2,localhost,root,,;
connection con1;
SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
BEGIN;
connection con2;
SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
BEGIN;
lock_scanned_rows is 0
connection con1;
UPDATE t1 JOIN t2 ON t1.id = t2.id SET t1.value=t1.value+100 WHERE t2.id=3;
connection con2;
UPDATE t2 SET value=value+100;
SELECT * FROM t2;
id value
1 101
2 102
3 103
4 104
5 105
connection con1;
COMMIT;
connection default;
disconnect con1;
disconnect con2;
DROP TABLE t1;
DROP TABLE t2;
-----------------------------------------------------------------------
- Locking issues case 7:
- Rows that are scanned as part of a query but not in the table being
- updated should not be locked unless rocksdb_lock_scanned_rows is on
-----------------------------------------------------------------------
DROP TABLE IF EXISTS t1, t2;
SELECT @@global.rocksdb_lock_scanned_rows;
@@global.rocksdb_lock_scanned_rows
0
CREATE TABLE t1(id INT PRIMARY KEY, value INT);
CREATE TABLE t2(id INT PRIMARY KEY, value INT);
INSERT INTO t1 VALUES (1,1), (2,2), (3,3);
INSERT INTO t2 VALUES (1,1), (2,2), (3,3), (4,4), (5,5);
connect con1,localhost,root,,;
connect con2,localhost,root,,;
connection con1;
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
BEGIN;
connection con2;
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
BEGIN;
lock_scanned_rows is 0
connection con1;
UPDATE t1 JOIN t2 ON t1.id = t2.id SET t1.value=t1.value+100 WHERE t2.id=3;
connection con2;
UPDATE t2 SET value=value+100;
SELECT * FROM t2;
id value
1 101
2 102
3 103
4 104
5 105
connection con1;
COMMIT;
connection default;
disconnect con1;
disconnect con2;
DROP TABLE t1;
DROP TABLE t2;
-----------------------------------------------------------------------
- Locking issues case 7:
- Rows that are scanned as part of a query but not in the table being
- updated should not be locked unless rocksdb_lock_scanned_rows is on
-----------------------------------------------------------------------
DROP TABLE IF EXISTS t1, t2;
SELECT @@global.rocksdb_lock_scanned_rows;
@@global.rocksdb_lock_scanned_rows
0
SET GLOBAL rocksdb_lock_scanned_rows=ON;
CREATE TABLE t1(id INT PRIMARY KEY, value INT);
CREATE TABLE t2(id INT PRIMARY KEY, value INT);
INSERT INTO t1 VALUES (1,1), (2,2), (3,3);
INSERT INTO t2 VALUES (1,1), (2,2), (3,3), (4,4), (5,5);
connect con1,localhost,root,,;
connect con2,localhost,root,,;
connection con1;
SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
BEGIN;
connection con2;
SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
BEGIN;
lock_scanned_rows is 1
connection con1;
UPDATE t1 JOIN t2 ON t1.id = t2.id SET t1.value=t1.value+100 WHERE t2.id=3;
connection con2;
UPDATE t2 SET value=value+100 WHERE id=3;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
UPDATE t2 SET value=value+100 WHERE id IN (1,2,4,5);
SELECT * FROM t2;
id value
1 101
2 102
3 3
4 104
5 105
connection con1;
COMMIT;
connection default;
disconnect con1;
disconnect con2;
DROP TABLE t1;
DROP TABLE t2;
SET GLOBAL rocksdb_lock_scanned_rows=0;
-----------------------------------------------------------------------
- Locking issues case 7:
- Rows that are scanned as part of a query but not in the table being
- updated should not be locked unless rocksdb_lock_scanned_rows is on
-----------------------------------------------------------------------
DROP TABLE IF EXISTS t1, t2;
SELECT @@global.rocksdb_lock_scanned_rows;
@@global.rocksdb_lock_scanned_rows
0
SET GLOBAL rocksdb_lock_scanned_rows=ON;
CREATE TABLE t1(id INT PRIMARY KEY, value INT);
CREATE TABLE t2(id INT PRIMARY KEY, value INT);
INSERT INTO t1 VALUES (1,1), (2,2), (3,3);
INSERT INTO t2 VALUES (1,1), (2,2), (3,3), (4,4), (5,5);
connect con1,localhost,root,,;
connect con2,localhost,root,,;
connection con1;
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
BEGIN;
connection con2;
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
BEGIN;
lock_scanned_rows is 1
connection con1;
UPDATE t1 JOIN t2 ON t1.id = t2.id SET t1.value=t1.value+100 WHERE t2.id=3;
connection con2;
UPDATE t2 SET value=value+100 WHERE id=3;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
UPDATE t2 SET value=value+100 WHERE id IN (1,2,4,5);
SELECT * FROM t2;
id value
1 101
2 102
3 3
4 104
5 105
connection con1;
COMMIT;
connection default;
disconnect con1;
disconnect con2;
DROP TABLE t1;
DROP TABLE t2;
SET GLOBAL rocksdb_lock_scanned_rows=0;
tests moved to rocksdb.locking_issues_case*
storage/rocksdb/mysql-test/rocksdb/r/locking_issues_case1_1_rc.result
0 → 100644
View file @
76a94a03
-----------------------------------------------------------------------
- Locking issues case 1.1:
- Locking rows that do not exist when using all primary key columns in
- a WHERE clause
- using READ COMMITTED transaction isolation level
-----------------------------------------------------------------------
DROP TABLE IF EXISTS t0;
CREATE TABLE t0(id1 INT, id2 INT, value INT, PRIMARY KEY(id1, id2));
INSERT INTO t0 VALUES (1,1,0), (3,3,0), (4,4,0), (6,6,0);
connect con1,localhost,root,,;
connect con2,localhost,root,,;
connection con1;
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
BEGIN;
SELECT * FROM t0 WHERE id1=1 AND id2=5 FOR UPDATE;
id1 id2 value
connection con2;
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
BEGIN;
INSERT INTO t0 VALUES (1,5,0);
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
SELECT * FROM t0 WHERE id1=1 AND id2=5 FOR UPDATE;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
connection con1;
COMMIT;
connection default;
disconnect con1;
disconnect con2;
DROP TABLE t0;
storage/rocksdb/mysql-test/rocksdb/r/locking_issues_case1_1_rr.result
0 → 100644
View file @
76a94a03
-----------------------------------------------------------------------
- Locking issues case 1.1:
- Locking rows that do not exist when using all primary key columns in
- a WHERE clause
- using REPEATABLE READ transaction isolation level
-----------------------------------------------------------------------
DROP TABLE IF EXISTS t0;
CREATE TABLE t0(id1 INT, id2 INT, value INT, PRIMARY KEY(id1, id2));
INSERT INTO t0 VALUES (1,1,0), (3,3,0), (4,4,0), (6,6,0);
connect con1,localhost,root,,;
connect con2,localhost,root,,;
connection con1;
SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
BEGIN;
SELECT * FROM t0 WHERE id1=1 AND id2=5 FOR UPDATE;
id1 id2 value
connection con2;
SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
BEGIN;
INSERT INTO t0 VALUES (1,5,0);
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
SELECT * FROM t0 WHERE id1=1 AND id2=5 FOR UPDATE;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
connection con1;
COMMIT;
connection default;
disconnect con1;
disconnect con2;
DROP TABLE t0;
storage/rocksdb/mysql-test/rocksdb/r/locking_issues_case1_2_rc.result
0 → 100644
View file @
76a94a03
-----------------------------------------------------------------------
- Locking issues case 1.2:
- Locking rows that do not exist without using all primary key
- columns in a WHERE clause
- using READ COMMITTED transaction isolation level
-----------------------------------------------------------------------
DROP TABLE IF EXISTS t0;
CREATE TABLE t0(id1 INT, id2 INT, value INT, PRIMARY KEY(id1, id2));
INSERT INTO t0 VALUES (1,1,0), (3,3,0), (4,4,0), (6,6,0);
connect con1,localhost,root,,;
connect con2,localhost,root,,;
connection con1;
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
BEGIN;
SELECT * FROM t0 WHERE id1=1 FOR UPDATE;
id1 id2 value
1 1 0
connection con2;
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
BEGIN;
SELECT * FROM t0 WHERE id1=1 AND id2=4 FOR UPDATE;
id1 id2 value
INSERT INTO t0 VALUES (1,5,0);
connection con1;
COMMIT;
connection default;
disconnect con1;
disconnect con2;
DROP TABLE t0;
storage/rocksdb/mysql-test/rocksdb/r/locking_issues_case1_2_rr.result
0 → 100644
View file @
76a94a03
-----------------------------------------------------------------------
- Locking issues case 1.2:
- Locking rows that do not exist without using all primary key
- columns in a WHERE clause
- using REPEATABLE READ transaction isolation level
-----------------------------------------------------------------------
DROP TABLE IF EXISTS t0;
CREATE TABLE t0(id1 INT, id2 INT, value INT, PRIMARY KEY(id1, id2));
INSERT INTO t0 VALUES (1,1,0), (3,3,0), (4,4,0), (6,6,0);
connect con1,localhost,root,,;
connect con2,localhost,root,,;
connection con1;
SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
BEGIN;
SELECT * FROM t0 WHERE id1=1 FOR UPDATE;
id1 id2 value
1 1 0
connection con2;
SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
BEGIN;
SELECT * FROM t0 WHERE id1=1 AND id2=4 FOR UPDATE;
id1 id2 value
INSERT INTO t0 VALUES (1,5,0);
connection con1;
COMMIT;
connection default;
disconnect con1;
disconnect con2;
DROP TABLE t0;
storage/rocksdb/mysql-test/rocksdb/r/locking_issues_case2_rc.result
0 → 100644
View file @
76a94a03
-----------------------------------------------------------------------
- Locking issues case 2:
- Rows that are scanned but do not match the WHERE are not locked
- using READ COMMITTED transaction isolation level unless
- rocksdb_lock_scanned_rows is on
-----------------------------------------------------------------------
DROP TABLE IF EXISTS t0;
SELECT @@global.rocksdb_lock_scanned_rows;
@@global.rocksdb_lock_scanned_rows
0
CREATE TABLE t0(id INT PRIMARY KEY, value INT);
INSERT INTO t0 VALUES (1,0), (2,1), (3,0), (4,0), (5,1);
connect con1,localhost,root,,;
connect con2,localhost,root,,;
connection con1;
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
BEGIN;
connection con2;
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
BEGIN;
connection con1;
SELECT * FROM t0 WHERE value > 0 FOR UPDATE;
id value
2 1
5 1
connection con2;
UPDATE t0 SET VALUE=10 WHERE id=1;
UPDATE t0 SET VALUE=10 WHERE id=5;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
connection con1;
UPDATE t0 SET value=100 WHERE id in (4,5) and value>0;
connection con2;
SELECT * FROM t0 WHERE id=4 FOR UPDATE;
id value
4 0
COMMIT;
SELECT * FROM t0;
id value
1 10
2 1
3 0
4 0
5 1
connection con1;
COMMIT;
connection default;
disconnect con1;
disconnect con2;
DROP TABLE t0;
storage/rocksdb/mysql-test/rocksdb/r/locking_issues_case2_rc_lsr.result
0 → 100644
View file @
76a94a03
-----------------------------------------------------------------------
- Locking issues case 2:
- Rows that are scanned but do not match the WHERE are not locked
- using READ COMMITTED transaction isolation level unless
- rocksdb_lock_scanned_rows is on
-----------------------------------------------------------------------
DROP TABLE IF EXISTS t0;
SELECT @@global.rocksdb_lock_scanned_rows;
@@global.rocksdb_lock_scanned_rows
0
SET GLOBAL rocksdb_lock_scanned_rows=ON;
CREATE TABLE t0(id INT PRIMARY KEY, value INT);
INSERT INTO t0 VALUES (1,0), (2,1), (3,0), (4,0), (5,1);
connect con1,localhost,root,,;
connect con2,localhost,root,,;
connection con1;
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
BEGIN;
connection con2;
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
BEGIN;
connection con1;
SELECT * FROM t0 WHERE value > 0 FOR UPDATE;
id value
2 1
5 1
connection con2;
UPDATE t0 SET VALUE=10 WHERE id=1;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
connection con1;
COMMIT;
connection default;
disconnect con1;
disconnect con2;
DROP TABLE t0;
SET GLOBAL rocksdb_lock_scanned_rows=0;
storage/rocksdb/mysql-test/rocksdb/r/locking_issues_case2_rr.result
0 → 100644
View file @
76a94a03
-----------------------------------------------------------------------
- Locking issues case 2:
- Rows that are scanned but do not match the WHERE are not locked
- using REPEATABLE READ transaction isolation level unless
- rocksdb_lock_scanned_rows is on
-----------------------------------------------------------------------
DROP TABLE IF EXISTS t0;
SELECT @@global.rocksdb_lock_scanned_rows;
@@global.rocksdb_lock_scanned_rows
0
CREATE TABLE t0(id INT PRIMARY KEY, value INT);
INSERT INTO t0 VALUES (1,0), (2,1), (3,0), (4,0), (5,1);
connect con1,localhost,root,,;
connect con2,localhost,root,,;
connection con1;
SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
BEGIN;
connection con2;
SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
BEGIN;
connection con1;
SELECT * FROM t0 WHERE value > 0 FOR UPDATE;
id value
2 1
5 1
connection con2;
UPDATE t0 SET VALUE=10 WHERE id=1;
UPDATE t0 SET VALUE=10 WHERE id=5;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
connection con1;
UPDATE t0 SET value=100 WHERE id in (4,5) and value>0;
connection con2;
SELECT * FROM t0 WHERE id=4 FOR UPDATE;
id value
4 0
COMMIT;
SELECT * FROM t0;
id value
1 10
2 1
3 0
4 0
5 1
connection con1;
COMMIT;
connection default;
disconnect con1;
disconnect con2;
DROP TABLE t0;
storage/rocksdb/mysql-test/rocksdb/r/locking_issues_case2_rr_lsr.result
0 → 100644
View file @
76a94a03
-----------------------------------------------------------------------
- Locking issues case 2:
- Rows that are scanned but do not match the WHERE are not locked
- using REPEATABLE READ transaction isolation level unless
- rocksdb_lock_scanned_rows is on
-----------------------------------------------------------------------
DROP TABLE IF EXISTS t0;
SELECT @@global.rocksdb_lock_scanned_rows;
@@global.rocksdb_lock_scanned_rows
0
SET GLOBAL rocksdb_lock_scanned_rows=ON;
CREATE TABLE t0(id INT PRIMARY KEY, value INT);
INSERT INTO t0 VALUES (1,0), (2,1), (3,0), (4,0), (5,1);
connect con1,localhost,root,,;
connect con2,localhost,root,,;
connection con1;
SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
BEGIN;
connection con2;
SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
BEGIN;
connection con1;
SELECT * FROM t0 WHERE value > 0 FOR UPDATE;
id value
2 1
5 1
connection con2;
UPDATE t0 SET VALUE=10 WHERE id=1;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
connection con1;
COMMIT;
connection default;
disconnect con1;
disconnect con2;
DROP TABLE t0;
SET GLOBAL rocksdb_lock_scanned_rows=0;
storage/rocksdb/mysql-test/rocksdb/r/locking_issues_case3_rc.result
0 → 100644
View file @
76a94a03
-----------------------------------------------------------------------
- Locking issues case 3:
- After creating a snapshot, other clients updating rows
- using READ COMMITTED transaction isolation level
-----------------------------------------------------------------------
DROP TABLE IF EXISTS t0;
CREATE TABLE t0(id INT AUTO_INCREMENT PRIMARY KEY, value INT);
Inserting 200,000 rows
connect con1,localhost,root,,;
connect con2,localhost,root,,;
connection con1;
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
SELECT * FROM t0 WHERE value > 0 FOR UPDATE;
connection con2;
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
UPDATE t0 SET VALUE=VALUE+1 WHERE id=190000;
connection con1;
id value
190000 1
ERROR: 0
connection default;
disconnect con1;
disconnect con2;
DROP TABLE t0;
storage/rocksdb/mysql-test/rocksdb/r/locking_issues_case3_rr.result
0 → 100644
View file @
76a94a03
-----------------------------------------------------------------------
- Locking issues case 3:
- After creating a snapshot, other clients updating rows
- using REPEATABLE READ transaction isolation level
-----------------------------------------------------------------------
DROP TABLE IF EXISTS t0;
CREATE TABLE t0(id INT AUTO_INCREMENT PRIMARY KEY, value INT);
Inserting 200,000 rows
connect con1,localhost,root,,;
connect con2,localhost,root,,;
connection con1;
SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
SELECT * FROM t0 WHERE value > 0 FOR UPDATE;
connection con2;
SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
UPDATE t0 SET VALUE=VALUE+1 WHERE id=190000;
connection con1;
ERROR: 1213
connection default;
disconnect con1;
disconnect con2;
DROP TABLE t0;
storage/rocksdb/mysql-test/rocksdb/r/locking_issues_case4_rc.result
0 → 100644
View file @
76a94a03
-----------------------------------------------------------------------
- Locking issues case 4:
- Phantom rows
- using READ COMMITTED transaction isolation level
-----------------------------------------------------------------------
DROP TABLE IF EXISTS t0;
CREATE TABLE t0(id INT AUTO_INCREMENT PRIMARY KEY, value INT);
Inserting 200,000 rows
connect con1,localhost,root,,;
connect con2,localhost,root,,;
connection con1;
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
SELECT * FROM t0 WHERE value > 0 FOR UPDATE;
connection con2;
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
INSERT INTO t0 VALUES(200001,1), (-1,1);
connection con1;
id value
connection default;
disconnect con1;
disconnect con2;
DROP TABLE t0;
storage/rocksdb/mysql-test/rocksdb/r/locking_issues_case4_rr.result
0 → 100644
View file @
76a94a03
-----------------------------------------------------------------------
- Locking issues case 4:
- Phantom rows
- using REPEATABLE READ transaction isolation level
-----------------------------------------------------------------------
DROP TABLE IF EXISTS t0;
CREATE TABLE t0(id INT AUTO_INCREMENT PRIMARY KEY, value INT);
Inserting 200,000 rows
connect con1,localhost,root,,;
connect con2,localhost,root,,;
connection con1;
SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
SELECT * FROM t0 WHERE value > 0 FOR UPDATE;
connection con2;
SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
INSERT INTO t0 VALUES(200001,1), (-1,1);
connection con1;
id value
connection default;
disconnect con1;
disconnect con2;
DROP TABLE t0;
storage/rocksdb/mysql-test/rocksdb/r/locking_issues_case5_rc.result
0 → 100644
View file @
76a94a03
-----------------------------------------------------------------------
- Locking issues case 5:
- Deleting primary key
- using READ COMMITTED transaction isolation level
-----------------------------------------------------------------------
DROP TABLE IF EXISTS t0;
CREATE TABLE t0(id INT AUTO_INCREMENT PRIMARY KEY, value INT);
Inserting 200,000 rows
UPDATE t0 SET value=100 WHERE id=190000;
connect con1,localhost,root,,;
connect con2,localhost,root,,;
connection con1;
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
BEGIN;
SELECT * FROM t0 WHERE value > 0 FOR UPDATE;
connection con2;
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
BEGIN;
DELETE FROM t0 WHERE id=190000;
COMMIT;
connection con1;
id value
ERROR: 0
COMMIT;
connection default;
disconnect con1;
disconnect con2;
DROP TABLE t0;
storage/rocksdb/mysql-test/rocksdb/r/locking_issues_case5_rr.result
0 → 100644
View file @
76a94a03
-----------------------------------------------------------------------
- Locking issues case 5:
- Deleting primary key
- using REPEATABLE READ transaction isolation level
-----------------------------------------------------------------------
DROP TABLE IF EXISTS t0;
CREATE TABLE t0(id INT AUTO_INCREMENT PRIMARY KEY, value INT);
Inserting 200,000 rows
UPDATE t0 SET value=100 WHERE id=190000;
connect con1,localhost,root,,;
connect con2,localhost,root,,;
connection con1;
SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
BEGIN;
SELECT * FROM t0 WHERE value > 0 FOR UPDATE;
connection con2;
SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
BEGIN;
DELETE FROM t0 WHERE id=190000;
COMMIT;
connection con1;
ERROR: 1213
COMMIT;
connection default;
disconnect con1;
disconnect con2;
DROP TABLE t0;
storage/rocksdb/mysql-test/rocksdb/r/locking_issues_case6_rc.result
0 → 100644
View file @
76a94a03
-----------------------------------------------------------------------
- Locking issues case 6:
- Changing primary key
- using READ COMMITTED transaction isolation level
-----------------------------------------------------------------------
DROP TABLE IF EXISTS t0;
CREATE TABLE t0(id INT AUTO_INCREMENT PRIMARY KEY, value INT);
Inserting 200,000 rows
UPDATE t0 SET value=100 WHERE id=190000;
connect con1,localhost,root,,;
connect con2,localhost,root,,;
connection con1;
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
BEGIN;
SELECT * FROM t0 WHERE value > 0 FOR UPDATE;
connection con2;
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
BEGIN;
UPDATE t0 SET id=200001 WHERE id=190000;
COMMIT;
connection con1;
id value
ERROR: 0
COMMIT;
connection default;
disconnect con1;
disconnect con2;
DROP TABLE t0;
storage/rocksdb/mysql-test/rocksdb/r/locking_issues_case6_rr.result
0 → 100644
View file @
76a94a03
-----------------------------------------------------------------------
- Locking issues case 6:
- Changing primary key
- using REPEATABLE READ transaction isolation level
-----------------------------------------------------------------------
DROP TABLE IF EXISTS t0;
CREATE TABLE t0(id INT AUTO_INCREMENT PRIMARY KEY, value INT);
Inserting 200,000 rows
UPDATE t0 SET value=100 WHERE id=190000;
connect con1,localhost,root,,;
connect con2,localhost,root,,;
connection con1;
SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
BEGIN;
SELECT * FROM t0 WHERE value > 0 FOR UPDATE;
connection con2;
SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
BEGIN;
UPDATE t0 SET id=200001 WHERE id=190000;
COMMIT;
connection con1;
ERROR: 1213
COMMIT;
connection default;
disconnect con1;
disconnect con2;
DROP TABLE t0;
storage/rocksdb/mysql-test/rocksdb/r/locking_issues_case7_rc.result
0 → 100644
View file @
76a94a03
-----------------------------------------------------------------------
- Locking issues case 7:
- Rows that are scanned as part of a query but not in the table being
- updated should not be locked unless rocksdb_lock_scanned_rows is on
-----------------------------------------------------------------------
DROP TABLE IF EXISTS t1, t2;
SELECT @@global.rocksdb_lock_scanned_rows;
@@global.rocksdb_lock_scanned_rows
0
CREATE TABLE t1(id INT PRIMARY KEY, value INT);
CREATE TABLE t2(id INT PRIMARY KEY, value INT);
INSERT INTO t1 VALUES (1,1), (2,2), (3,3);
INSERT INTO t2 VALUES (1,1), (2,2), (3,3), (4,4), (5,5);
connect con1,localhost,root,,;
connect con2,localhost,root,,;
connection con1;
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
BEGIN;
connection con2;
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
BEGIN;
lock_scanned_rows is 0
connection con1;
UPDATE t1 JOIN t2 ON t1.id = t2.id SET t1.value=t1.value+100 WHERE t2.id=3;
connection con2;
UPDATE t2 SET value=value+100;
SELECT * FROM t2;
id value
1 101
2 102
3 103
4 104
5 105
connection con1;
COMMIT;
connection default;
disconnect con1;
disconnect con2;
DROP TABLE t1;
DROP TABLE t2;
storage/rocksdb/mysql-test/rocksdb/r/locking_issues_case7_rc_lsr.result
0 → 100644
View file @
76a94a03
-----------------------------------------------------------------------
- Locking issues case 7:
- Rows that are scanned as part of a query but not in the table being
- updated should not be locked unless rocksdb_lock_scanned_rows is on
-----------------------------------------------------------------------
DROP TABLE IF EXISTS t1, t2;
SELECT @@global.rocksdb_lock_scanned_rows;
@@global.rocksdb_lock_scanned_rows
0
SET GLOBAL rocksdb_lock_scanned_rows=ON;
CREATE TABLE t1(id INT PRIMARY KEY, value INT);
CREATE TABLE t2(id INT PRIMARY KEY, value INT);
INSERT INTO t1 VALUES (1,1), (2,2), (3,3);
INSERT INTO t2 VALUES (1,1), (2,2), (3,3), (4,4), (5,5);
connect con1,localhost,root,,;
connect con2,localhost,root,,;
connection con1;
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
BEGIN;
connection con2;
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
BEGIN;
lock_scanned_rows is 1
connection con1;
UPDATE t1 JOIN t2 ON t1.id = t2.id SET t1.value=t1.value+100 WHERE t2.id=3;
connection con2;
UPDATE t2 SET value=value+100 WHERE id=3;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
UPDATE t2 SET value=value+100 WHERE id IN (1,2,4,5);
SELECT * FROM t2;
id value
1 101
2 102
3 3
4 104
5 105
connection con1;
COMMIT;
connection default;
disconnect con1;
disconnect con2;
DROP TABLE t1;
DROP TABLE t2;
SET GLOBAL rocksdb_lock_scanned_rows=0;
storage/rocksdb/mysql-test/rocksdb/r/locking_issues_case7_rr.result
0 → 100644
View file @
76a94a03
-----------------------------------------------------------------------
- Locking issues case 7:
- Rows that are scanned as part of a query but not in the table being
- updated should not be locked unless rocksdb_lock_scanned_rows is on
-----------------------------------------------------------------------
DROP TABLE IF EXISTS t1, t2;
SELECT @@global.rocksdb_lock_scanned_rows;
@@global.rocksdb_lock_scanned_rows
0
CREATE TABLE t1(id INT PRIMARY KEY, value INT);
CREATE TABLE t2(id INT PRIMARY KEY, value INT);
INSERT INTO t1 VALUES (1,1), (2,2), (3,3);
INSERT INTO t2 VALUES (1,1), (2,2), (3,3), (4,4), (5,5);
connect con1,localhost,root,,;
connect con2,localhost,root,,;
connection con1;
SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
BEGIN;
connection con2;
SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
BEGIN;
lock_scanned_rows is 0
connection con1;
UPDATE t1 JOIN t2 ON t1.id = t2.id SET t1.value=t1.value+100 WHERE t2.id=3;
connection con2;
UPDATE t2 SET value=value+100;
SELECT * FROM t2;
id value
1 101
2 102
3 103
4 104
5 105
connection con1;
COMMIT;
connection default;
disconnect con1;
disconnect con2;
DROP TABLE t1;
DROP TABLE t2;
storage/rocksdb/mysql-test/rocksdb/r/locking_issues_case7_rr_lsr.result
0 → 100644
View file @
76a94a03
-----------------------------------------------------------------------
- Locking issues case 7:
- Rows that are scanned as part of a query but not in the table being
- updated should not be locked unless rocksdb_lock_scanned_rows is on
-----------------------------------------------------------------------
DROP TABLE IF EXISTS t1, t2;
SELECT @@global.rocksdb_lock_scanned_rows;
@@global.rocksdb_lock_scanned_rows
0
SET GLOBAL rocksdb_lock_scanned_rows=ON;
CREATE TABLE t1(id INT PRIMARY KEY, value INT);
CREATE TABLE t2(id INT PRIMARY KEY, value INT);
INSERT INTO t1 VALUES (1,1), (2,2), (3,3);
INSERT INTO t2 VALUES (1,1), (2,2), (3,3), (4,4), (5,5);
connect con1,localhost,root,,;
connect con2,localhost,root,,;
connection con1;
SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
BEGIN;
connection con2;
SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
BEGIN;
lock_scanned_rows is 1
connection con1;
UPDATE t1 JOIN t2 ON t1.id = t2.id SET t1.value=t1.value+100 WHERE t2.id=3;
connection con2;
UPDATE t2 SET value=value+100 WHERE id=3;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
UPDATE t2 SET value=value+100 WHERE id IN (1,2,4,5);
SELECT * FROM t2;
id value
1 101
2 102
3 3
4 104
5 105
connection con1;
COMMIT;
connection default;
disconnect con1;
disconnect con2;
DROP TABLE t1;
DROP TABLE t2;
SET GLOBAL rocksdb_lock_scanned_rows=0;
storage/rocksdb/mysql-test/rocksdb/t/locking_issues.test
View file @
76a94a03
--
source
include
/
have_rocksdb
.
inc
let
$isolation_level
=
REPEATABLE
READ
;
--
source
include
/
locking_issues_case1_1
.
inc
let
$isolation_level
=
READ
COMMITTED
;
--
source
include
/
locking_issues_case1_1
.
inc
let
$isolation_level
=
REPEATABLE
READ
;
--
source
include
/
locking_issues_case1_2
.
inc
let
$isolation_level
=
READ
COMMITTED
;
--
source
include
/
locking_issues_case1_2
.
inc
let
$lock_scanned_rows
=
0
;
let
$isolation_level
=
REPEATABLE
READ
;
--
source
include
/
locking_issues_case2
.
inc
let
$isolation_level
=
READ
COMMITTED
;
--
source
include
/
locking_issues_case2
.
inc
# Rerun the case2 tests with rocksdb_lock_scanned_rows on
let
$lock_scanned_rows
=
1
;
let
$isolation_level
=
REPEATABLE
READ
;
--
source
include
/
locking_issues_case2
.
inc
let
$isolation_level
=
READ
COMMITTED
;
--
source
include
/
locking_issues_case2
.
inc
let
$isolation_level
=
REPEATABLE
READ
;
--
source
include
/
locking_issues_case3
.
inc
let
$isolation_level
=
READ
COMMITTED
;
--
source
include
/
locking_issues_case3
.
inc
let
$isolation_level
=
REPEATABLE
READ
;
--
source
include
/
locking_issues_case4
.
inc
let
$isolation_level
=
READ
COMMITTED
;
--
source
include
/
locking_issues_case4
.
inc
let
$isolation_level
=
REPEATABLE
READ
;
--
source
include
/
locking_issues_case5
.
inc
let
$isolation_level
=
READ
COMMITTED
;
--
source
include
/
locking_issues_case5
.
inc
let
$isolation_level
=
REPEATABLE
READ
;
--
source
include
/
locking_issues_case6
.
inc
let
$isolation_level
=
READ
COMMITTED
;
--
source
include
/
locking_issues_case6
.
inc
let
$lock_scanned_rows
=
0
;
let
$isolation_level
=
REPEATABLE
READ
;
--
source
include
/
locking_issues_case7
.
inc
let
$isolation_level
=
READ
COMMITTED
;
--
source
include
/
locking_issues_case7
.
inc
# Rerun the case7 tests with rocksdb_lock_scanned_rows on
let
$lock_scanned_rows
=
1
;
let
$isolation_level
=
REPEATABLE
READ
;
--
source
include
/
locking_issues_case7
.
inc
let
$isolation_level
=
READ
COMMITTED
;
--
source
include
/
locking_issues_case7
.
inc
--
echo
tests
moved
to
rocksdb
.
locking_issues_case
*
storage/rocksdb/mysql-test/rocksdb/t/locking_issues_case1_1_rc.test
0 → 100644
View file @
76a94a03
--
source
include
/
have_rocksdb
.
inc
let
$isolation_level
=
READ
COMMITTED
;
--
source
include
/
locking_issues_case1_1
.
inc
storage/rocksdb/mysql-test/rocksdb/t/locking_issues_case1_1_rr.test
0 → 100644
View file @
76a94a03
--
source
include
/
have_rocksdb
.
inc
let
$isolation_level
=
REPEATABLE
READ
;
--
source
include
/
locking_issues_case1_1
.
inc
storage/rocksdb/mysql-test/rocksdb/t/locking_issues_case1_2_rc.test
0 → 100644
View file @
76a94a03
--
source
include
/
have_rocksdb
.
inc
let
$isolation_level
=
READ
COMMITTED
;
--
source
include
/
locking_issues_case1_2
.
inc
storage/rocksdb/mysql-test/rocksdb/t/locking_issues_case1_2_rr.test
0 → 100644
View file @
76a94a03
--
source
include
/
have_rocksdb
.
inc
let
$isolation_level
=
REPEATABLE
READ
;
--
source
include
/
locking_issues_case1_2
.
inc
storage/rocksdb/mysql-test/rocksdb/t/locking_issues_case2_rc.test
0 → 100644
View file @
76a94a03
--
source
include
/
have_rocksdb
.
inc
let
$lock_scanned_rows
=
0
;
let
$isolation_level
=
READ
COMMITTED
;
--
source
include
/
locking_issues_case2
.
inc
storage/rocksdb/mysql-test/rocksdb/t/locking_issues_case2_rc_lsr.test
0 → 100644
View file @
76a94a03
--
source
include
/
have_rocksdb
.
inc
let
$lock_scanned_rows
=
1
;
let
$isolation_level
=
READ
COMMITTED
;
--
source
include
/
locking_issues_case2
.
inc
storage/rocksdb/mysql-test/rocksdb/t/locking_issues_case2_rr.test
0 → 100644
View file @
76a94a03
--
source
include
/
have_rocksdb
.
inc
let
$lock_scanned_rows
=
0
;
let
$isolation_level
=
REPEATABLE
READ
;
--
source
include
/
locking_issues_case2
.
inc
storage/rocksdb/mysql-test/rocksdb/t/locking_issues_case2_rr_lsr.test
0 → 100644
View file @
76a94a03
--
source
include
/
have_rocksdb
.
inc
let
$lock_scanned_rows
=
1
;
let
$isolation_level
=
REPEATABLE
READ
;
--
source
include
/
locking_issues_case2
.
inc
storage/rocksdb/mysql-test/rocksdb/t/locking_issues_case3_rc.test
0 → 100644
View file @
76a94a03
--
source
include
/
have_rocksdb
.
inc
let
$isolation_level
=
READ
COMMITTED
;
--
source
include
/
locking_issues_case3
.
inc
storage/rocksdb/mysql-test/rocksdb/t/locking_issues_case3_rr.test
0 → 100644
View file @
76a94a03
--
source
include
/
have_rocksdb
.
inc
let
$isolation_level
=
REPEATABLE
READ
;
--
source
include
/
locking_issues_case3
.
inc
storage/rocksdb/mysql-test/rocksdb/t/locking_issues_case4_rc.test
0 → 100644
View file @
76a94a03
--
source
include
/
have_rocksdb
.
inc
let
$isolation_level
=
READ
COMMITTED
;
--
source
include
/
locking_issues_case4
.
inc
storage/rocksdb/mysql-test/rocksdb/t/locking_issues_case4_rr.test
0 → 100644
View file @
76a94a03
--
source
include
/
have_rocksdb
.
inc
let
$isolation_level
=
REPEATABLE
READ
;
--
source
include
/
locking_issues_case4
.
inc
storage/rocksdb/mysql-test/rocksdb/t/locking_issues_case5_rc.test
0 → 100644
View file @
76a94a03
--
source
include
/
have_rocksdb
.
inc
let
$isolation_level
=
READ
COMMITTED
;
--
source
include
/
locking_issues_case5
.
inc
storage/rocksdb/mysql-test/rocksdb/t/locking_issues_case5_rr.test
0 → 100644
View file @
76a94a03
--
source
include
/
have_rocksdb
.
inc
let
$isolation_level
=
REPEATABLE
READ
;
--
source
include
/
locking_issues_case5
.
inc
storage/rocksdb/mysql-test/rocksdb/t/locking_issues_case6_rc.test
0 → 100644
View file @
76a94a03
--
source
include
/
have_rocksdb
.
inc
let
$isolation_level
=
READ
COMMITTED
;
--
source
include
/
locking_issues_case6
.
inc
storage/rocksdb/mysql-test/rocksdb/t/locking_issues_case6_rr.test
0 → 100644
View file @
76a94a03
--
source
include
/
have_rocksdb
.
inc
let
$isolation_level
=
REPEATABLE
READ
;
--
source
include
/
locking_issues_case6
.
inc
storage/rocksdb/mysql-test/rocksdb/t/locking_issues_case7_rc.test
0 → 100644
View file @
76a94a03
--
source
include
/
have_rocksdb
.
inc
let
$lock_scanned_rows
=
0
;
let
$isolation_level
=
READ
COMMITTED
;
--
source
include
/
locking_issues_case7
.
inc
storage/rocksdb/mysql-test/rocksdb/t/locking_issues_case7_rc_lsr.test
0 → 100644
View file @
76a94a03
--
source
include
/
have_rocksdb
.
inc
let
$lock_scanned_rows
=
1
;
let
$isolation_level
=
READ
COMMITTED
;
--
source
include
/
locking_issues_case7
.
inc
storage/rocksdb/mysql-test/rocksdb/t/locking_issues_case7_rr.test
0 → 100644
View file @
76a94a03
--
source
include
/
have_rocksdb
.
inc
let
$lock_scanned_rows
=
0
;
let
$isolation_level
=
REPEATABLE
READ
;
--
source
include
/
locking_issues_case7
.
inc
storage/rocksdb/mysql-test/rocksdb/t/locking_issues_case7_rr_lsr.test
0 → 100644
View file @
76a94a03
--
source
include
/
have_rocksdb
.
inc
let
$lock_scanned_rows
=
1
;
let
$isolation_level
=
REPEATABLE
READ
;
--
source
include
/
locking_issues_case7
.
inc
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment