Details
-
Task
-
Status: Open (View Workflow)
-
Major
-
Resolution: Unresolved
-
None
Description
This is to support "Seek For Update" functionality in Range Locking feature for RocksDB.
Initial input
SeekForUpdate(prefix_X) -> should try to lock range from prefix_X to X
|
|
Prototype with
|
Seek(prefix_X) -> X;
|
TryRangeLock(prefix_X, X);
|
Update snapshot (by destroying/recreating iterator?)
|
Z = Seek(X) (optimizations, only look through memtable);
|
if (Z > Y)
|
return SeekForUpdate(X);
|
else
|
return Z;
|
The code
MyRocks part: https://github.com/spetrunia/mysql-5.6/tree/range-locking-fb-mysql-5.6.35-seekforupdate
RocksDB part: https://github.com/spetrunia/rocksdb/tree/spetrunia-rocksdb-range-locking-seekforupdate
Questions
- criteria when to use SeekForUpdate
- do we need to support shared locks in the first milestone? (TODO: check they will "happen to work"?)
Attachments
Issue Links
- is part of
-
MDEV-15603 Gap Lock support in MyRocks
-
- Stalled
-
- relates to
-
MDEV-11481 MariaRocks port: rocksdb.select_for_update_skip_locked_nowait (DISABLED)
-
- Open
-
-
MDEV-13115 Implement SELECT [FOR UPDATE|LOCK IN SHARED MODE] SKIP LOCKED
-
- Closed
-
-
MDEV-25338 add SKIP LOCKED to UPDATE syntax
-
- Open
-
The API
Class Transaction has a new member function w/o implementation
...
PessimisticTransaction implements it :
...
Iterator* GetLockingIterator() override;
GetLockingIterator returns an object that will implement all iterator methods (not all methods are implemented yet):
//
// LockingIterator is an iterator that locks the rows before returning, as well
// as the gaps between the returned rows.
//
// Example:
// lock_iter= trx->GetLockingIterator();
// lock_iter->Seek('abc');
// lock_iter->Valid()==true && lock_iter->key() == 'bcd';
//
// After the above, the returned record 'bcd' is locked by transaction trx.
// Also, the range between ['abc'..'bcd'] is guaranteed to have no records
// and be locked by trx.
//
// lock_iter->Next();
// lock_iter->Valid()==true && lock_iter->key() == 'efg'
//
// Now, the range ['bcd'.. 'efg'] (bounds incluive) is also locked, and the
// only records in it are 'bcd' and 'efg'.
//
...
};