
-----------------------------------------------------------------------
- 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;
