[MDEV-17887] MyRocks-Gap-Lock: information about current lock waits Created: 2018-12-02  Updated: 2018-12-10  Resolved: 2018-12-03

Status: Closed
Project: MariaDB Server
Component/s: Storage Engine - RocksDB
Fix Version/s: N/A

Type: Task Priority: Major
Reporter: Sergei Petrunia Assignee: Sergei Petrunia
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
PartOf
is part of MDEV-15603 Gap Lock support in MyRocks Stalled

 Description   

MyRocks has a deadlock detector that one can turn on/off.

TokuDB's Fractal Tree also has one (and there is no way to turn it off currently).

However, some MTR tests that rely on deadlock detection still fail.



 Comments   
Comment by Sergei Petrunia [ 2018-12-02 ]

One of the reasons: information_schema.rocksdb_trx and information_schema.rocksdb_deadlock tables. These expose information about current transactions and last N deadlocks, respectively. The information is not present in range locking mode.

The first thing that is not present (and causes rocksdb.i_s_deadlock to fail) is information_schema.rocksdb_trx.WAITING_KEY field.

Comment by Sergei Petrunia [ 2018-12-02 ]

Regular lock manager (TransactionLockMgr) "notifies" transactions about other transactions that are waiting for it (see stack trace below). This happens even when deadlock detection is OFF.

(gdb) wher
  #0  rocksdb::PessimisticTransaction::SetWaitingTxn (this=0x7fffd800aa20, ids=..., column_family_id=0, key=0x7ffff42d04a0) at /home/psergey/dev-git/mysql-5.6-rangelocking2-rebase1/rocksdb/utilities/transactions/pessimistic_transaction.h:80
  #1  0x0000555556f6e732 in rocksdb::TransactionLockMgr::AcquireWithTimeout (this=0x555558200670, txn=0x7fffd800aa20, lock_map=0x5555581d3f40, stripe=0x5555581d6d10, column_family_id=0, key="\000\000\001\004\200\000\000\001", env=0x555557e77360 <rocksdb::Env::Default()::default_env>, timeout=10000000000, lock_info=...) at /home/psergey/dev-git/mysql-5.6-rangelocking2-rebase1/rocksdb/utilities/transactions/transaction_lock_mgr.cc:442
  #2  0x0000555556f6de94 in rocksdb::TransactionLockMgr::TryLock (this=0x555558200670, txn=0x7fffd800aa20, column_family_id=0, key="\000\000\001\004\200\000\000\001", env=0x555557e77360 <rocksdb::Env::Default()::default_env>, exclusive=true) at /home/psergey/dev-git/mysql-5.6-rangelocking2-rebase1/rocksdb/utilities/transactions/transaction_lock_mgr.cc:315
  #3  0x0000555556f5c741 in rocksdb::PessimisticTransactionDB::TryLock (this=0x5555582005f0, txn=0x7fffd800aa20, cfh_id=0, key="\000\000\001\004\200\000\000\001", exclusive=true) at /home/psergey/dev-git/mysql-5.6-rangelocking2-rebase1/rocksdb/utilities/transactions/pessimistic_transaction_db.cc:389
  #4  0x000055555706c253 in rocksdb::PessimisticTransaction::TryLock (this=0x7fffd800aa20, column_family=0x5555581d3280, key=..., read_only=true, exclusive=true, skip_validate=false) at /home/psergey/dev-git/mysql-5.6-rangelocking2-rebase1/rocksdb/utilities/transactions/pessimistic_transaction.cc:529
  #5  0x0000555557075644 in rocksdb::TransactionBaseImpl::GetForUpdate (this=0x7fffd800aa20, read_options=..., column_family=0x5555581d3280, key=..., pinnable_val=0x7fffd800e838, exclusive=true) at /home/psergey/dev-git/mysql-5.6-rangelocking2-rebase1/rocksdb/utilities/transactions/transaction_base.cc:238
  #6  0x0000555556b3edb4 in myrocks::Rdb_transaction_impl::get_for_update (this=0x7fffd800a810, column_family=0x5555581d3280, key=..., value=0x7fffd800e838, exclusive=true) at /home/psergey/dev-git/mysql-5.6-rangelocking2-rebase1/storage/rocksdb/ha_rocksdb.cc:2942
  #7  0x0000555556b1b907 in myrocks::ha_rocksdb::get_for_update (this=0x7fffd800e300, tx=0x7fffd800a810, column_family=0x5555581d3280, key=..., value=0x7fffd800e838) at /home/psergey/dev-git/mysql-5.6-rangelocking2-rebase1/storage/rocksdb/ha_rocksdb.cc:8659
  #8  0x0000555556b1bee7 in myrocks::ha_rocksdb::get_row_by_rowid (this=0x7fffd800e300, buf=0x7fffd800baf0 "\320\001", rowid=0x7fffd800ddc0 "", rowid_size=8, skip_lookup=false, skip_ttl_check=false) at /home/psergey/dev-git/mysql-5.6-rangelocking2-rebase1/storage/rocksdb/ha_rocksdb.cc:8733
  #9  0x0000555556b384a7 in myrocks::ha_rocksdb::get_row_by_rowid (this=0x7fffd800e300, buf=0x7fffd800baf0 "\320\001", rowid=0x7fffd800ddc0 "", rowid_size=8, skip_lookup=false, skip_ttl_check=false) at /home/psergey/dev-git/mysql-5.6-rangelocking2-rebase1/storage/rocksdb/./ha_rocksdb.h:685
  #10 0x0000555556b1a0eb in myrocks::ha_rocksdb::index_read_map_impl (this=0x7fffd800e300, buf=0x7fffd800baf0 "\320\001", key=0x7fffd80078a8 "\001", keypart_map=1, find_flag=HA_READ_KEY_EXACT, end_key=0x0) at /home/psergey/dev-git/mysql-5.6-rangelocking2-rebase1/storage/rocksdb/ha_rocksdb.cc:8227

Comment by Sergei Petrunia [ 2018-12-02 ]

OK, lock wait should call these methods in rocksdb::PessimisticTransaction

  void SetWaitingTxn(autovector<TransactionID> ids, uint32_t column_family_id,
                     const std::string* key) ;  
void ClearWaitingTxn() ;

Generated at Thu Feb 08 08:39:53 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.