[MDEV-21566] Lock monitor doesn't print a name for RW-latches Created: 2020-01-26  Updated: 2021-07-20  Resolved: 2021-07-20

Status: Closed
Project: MariaDB Server
Component/s: Storage Engine - InnoDB
Affects Version/s: 10.2.30, 10.3.21, 10.4.11
Fix Version/s: N/A

Type: Bug Priority: Major
Reporter: Geoff Montee (Inactive) Assignee: Marko Mäkelä
Resolution: Won't Fix Votes: 1
Labels: None

Issue Links:
Relates
relates to MDEV-22087 Increase buffer size for query in SHO... Open
relates to MDEV-17237 thread IDs are printed in different f... Open
relates to MDEV-17238 Document special thread IDs used in S... Open
relates to MDEV-18391 Print ENGINE INNODB STATUS in machine... Open
relates to MDEV-18429 Consistent non-locking reads do not a... Closed
relates to MDEV-18572 Thread executing DROP TABLE listed tw... Open
relates to MDEV-18582 Port status variables related to SHOW... Closed
relates to MDEV-18698 Show InnoDB's internal background thr... Open
relates to MDEV-21330 Lock monitor doesn't print a semaphor... Closed
relates to MDEV-21390 lock_print_info_summary() should work... Closed

 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.



 Comments   
Comment by Marko Mäkelä [ 2021-07-20 ]

In MDEV-24167 and MDEV-24142, the old rw-lock implementation along with any diagnostic output was removed. The sync array was replaced with a watchdog mechanism for dict_sys.mutex only.

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