Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-21566

Lock monitor doesn't print a name for RW-latches

    XMLWordPrintable

    Details

      Description

      When a semaphore wait is in progress, InnoDB prints information about the wait in sync_array_cell_print():

      https://github.com/MariaDB/server/blob/mariadb-10.2.30/storage/innobase/sync/sync0arr.cc#L478

      For mutexes, the function does print the mutex's name. For example, here is a log message for trx_sys->mutex which is identified by TRX_SYS:

      2019-10-31  0:25:00 140385734620928 [Warning] InnoDB: A long semaphore wait:
      --Thread 140377401067264 has waited at read0read.cc line 579 for 241.00 seconds the semaphore:
      Mutex at 0x138221ac0, Mutex TRX_SYS created trx0sys.cc:552, lock var 2
      

      However, for RW-latches, the function does not print the RW-latch's name. For example:

      2019-10-31  0:25:00 140385734620928 [Warning] InnoDB: A long semaphore wait:
      --Thread 140379826886400 has waited at btr0cur.cc line 1151 for 241.00 seconds the semaphore:
      S-lock on RW-latch at 0x138245380 created in file ibuf0ibuf.cc line 563
      a writer (thread id 140379818493696) has reserved it in mode  exclusive
      number of readers 0, waiters flag 1, lock_word: fffffffff0000000
      Last time read locked in file btr0cur.cc line 1151
      Last time write locked in file ibuf0ibuf.cc line 399
      

      You can still determine the RW-latch's name by looking for strings like created in file ibuf0ibuf.cc line 563. This specific output was taken from MariaDB 10.2.21, so we would need to look at that specific file for that specific version. Let's take a look:

      https://github.com/MariaDB/server/blob/mariadb-10.2.21/storage/innobase/ibuf/ibuf0ibuf.cc#L562

      We can see that this specific RW-latch is ibuf->index->lock.

      I suspect that users could also determine what the specific RW-latch is by looking for strings like at 0x138245380 and using debugging tools like gdb to inspect the memory address.

      However, these kinds of tedious analytical methods should not be required. The lock monitor should print an easily identifiable name for the RW-latch, just like it already does for mutexes, so that users do not need to do tedious things to determine what the specific RW-latch is called.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              marko Marko Mäkelä
              Reporter:
              GeoffMontee Geoff Montee
              Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Git Integration