Skip to content

Commit 04b29be

Browse files
committed
Range Locking: SELECT ... LOCK IN SHARE MODE should skip snapshot, too.
1 parent 76e1728 commit 04b29be

File tree

4 files changed

+9
-2
lines changed

4 files changed

+9
-2
lines changed

mysql-test/suite/rocksdb/r/range_locking.result

+3
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,9 @@ pk a
317317
select * from t1 where pk=2 for update;
318318
pk a
319319
2 222
320+
select * from t1 where pk=2 lock in share mode;
321+
pk a
322+
2 222
320323
select * from t1 where pk=2;
321324
pk a
322325
2 2

mysql-test/suite/rocksdb/r/range_locking_rev_cf.result

+3
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,9 @@ pk a
317317
select * from t1 where pk=2 for update;
318318
pk a
319319
2 222
320+
select * from t1 where pk=2 lock in share mode;
321+
pk a
322+
2 222
320323
select * from t1 where pk=2;
321324
pk a
322325
2 2

mysql-test/suite/rocksdb/t/range_locking.inc

+1
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,7 @@ update t1 set a=333 where pk=3;
331331
connection con1;
332332
select * from t1 where pk in (2,3);
333333
select * from t1 where pk=2 for update;
334+
select * from t1 where pk=2 lock in share mode;
334335
select * from t1 where pk=2;
335336

336337
commit;

storage/rocksdb/ha_rocksdb.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -12416,7 +12416,7 @@ int ha_rocksdb::external_lock(THD *const thd, int lock_type) {
1241612416
}
1241712417
}
1241812418
tx->m_n_mysql_tables_in_use++;
12419-
rocksdb_register_tx(rocksdb_hton, thd, tx, (lock_type == F_WRLCK));
12419+
rocksdb_register_tx(rocksdb_hton, thd, tx, (m_lock_rows != RDB_LOCK_NONE));
1242012420
tx->io_perf_start(&m_io_perf);
1242112421

1242212422
m_use_range_locking= false;
@@ -12451,7 +12451,7 @@ int ha_rocksdb::start_stmt(THD *const thd,
1245112451

1245212452
Rdb_transaction *const tx = get_or_create_tx(thd);
1245312453
read_thd_vars(thd);
12454-
rocksdb_register_tx(ht, thd, tx, (lock_type == F_WRLCK));
12454+
rocksdb_register_tx(ht, thd, tx, (m_lock_rows != RDB_LOCK_NONE));
1245512455
tx->io_perf_start(&m_io_perf);
1245612456

1245712457
DBUG_RETURN(HA_EXIT_SUCCESS);

0 commit comments

Comments
 (0)