blob: fdd4d8fcacab2da2c398dc57fe70d89930aaedd8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
-----------------------------------------------------------------------
- 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;
|