[MDEV-17873] MyRocks-Gap-Lock: lock wait doesn't set correct STATE Created: 2018-11-29  Updated: 2021-02-15

Status: Open
Project: MariaDB Server
Component/s: OTHER
Affects Version/s: N/A
Fix Version/s: 10.2

Type: Bug Priority: Major
Reporter: Sergei Petrunia Assignee: Sergei Petrunia
Resolution: Unresolved Votes: 0
Labels: None

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

 Description   

When a query is waiting for row lock, it does not have waiting for row lock status in I_S.PROCESSLIST.

This is a property of TokuDB, as well. Example of a TokuDB query waiting for a row lock:

             ID: 8
           USER: root
           HOST: localhost
             DB: test
        COMMAND: Query
           TIME: 3
          STATE: Statistics
           INFO: select * from t1 where pk=1 for update
        TIME_MS: 3683.455
          STAGE: 0
      MAX_STAGE: 0
       PROGRESS: 0.000
    MEMORY_USED: 78480
MAX_MEMORY_USED: 80488
  EXAMINED_ROWS: 0
       QUERY_ID: 20
    INFO_BINARY: select * from t1 where pk=1 for update
            TID: 30172



 Comments   
Comment by Sergei Petrunia [ 2018-11-29 ]

It's the same in Percona Server

mysql> select * from information_schema.processlist\G
*************************** 1. row ***************************
           ID: 3
         USER: root
         HOST: localhost
           DB: test
      COMMAND: Query
         TIME: 6
        STATE: statistics
         INFO: select * from t10 where pk=2 for update
      TIME_MS: 6724
    ROWS_SENT: 0
ROWS_EXAMINED: 0

Comment by Sergei Petrunia [ 2019-01-03 ]

Well, one can observe TokuDB lock waits with tokudb_lock_waits table:

MariaDB [j1]> select * from information_schema.TokuDB_lock_waits\G
*************************** 1. row ***************************
               requesting_trx_id: 95
                 blocking_trx_id: 93
                lock_waits_dname: ./j1/t10-main
             lock_waits_key_left: ff01000000
            lock_waits_key_right: 0101000000
           lock_waits_start_time: 1546543046850
         lock_waits_table_schema: j1
           lock_waits_table_name: t10
lock_waits_table_dictionary_name: main

There is also TokuDB_trx table which maps Toku's transaction id to mysql connection id:

MariaDB [j1]> select * from information_schema.TokuDB_trx\G
*************************** 1. row ***************************
             trx_id: 93
trx_mysql_thread_id: 10
           trx_time: 435
*************************** 2. row ***************************
             trx_id: 95
trx_mysql_thread_id: 11
           trx_time: 314
2 rows in set (0.002 sec)

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