[MDEV-17237] thread IDs are printed in different formats in different sections of SHOW ENGINE INNODB STATUS output Created: 2018-09-18  Updated: 2023-04-27

Status: Open
Project: MariaDB Server
Component/s: Storage Engine - InnoDB
Affects Version/s: 10.0.36, 10.1.36, 10.2.17
Fix Version/s: 10.4

Type: Bug Priority: Major
Reporter: Geoff Montee (Inactive) Assignee: Vladislav Lesin
Resolution: Unresolved Votes: 3
Labels: None

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

 Description   

SHOW ENGINE INNODB STATUS uses different formats to print thread IDs in different sections of the output.

For example, the thread IDs are in decimal in the SEMAPHORES section:

----------
SEMAPHORES
----------
OS WAIT ARRAY INFO: reservation count 518859705
--Thread 140189784869632 has waited at lock0lock.cc line 5636 for 0.0000 seconds the semaphore:
Mutex at 0x7f8859c88068 '&lock_sys->mutex', lock var 1
Last time reserved by thread 139857189899008 in file not yet reserved line 0, waiters flag 0
wait has ended

We can see that this semaphore is held by a thread with ID 139857189899008. To find that thread in the TRANSACTIONS section, we have to convert it to hex. This value in hex is 7F330A1F8B00. This conversion allows us to find the relevant transaction:

---TRANSACTION 2284134567, ACTIVE 724 sec unlock_row
mysql tables in use 2, locked 1
2649 lock struct(s), heap size 407080, 1 row lock(s)
MySQL thread id 207695, OS thread handle 0x7f330a1f8b00, query id 41767441 10.1.1.31 appuser Sending data
UPDATE ...

The main thread ID is also in decimal:

Main thread process no. 13593, id 140188351182592, state: sleeping

It might be worthwhile to change the output to be more consistent, so that users don't have to do decimal to hex conversions, and vice-versa. If not, then we should at least document this inconsistency.

https://mariadb.com/kb/en/library/show-engine-innodb-status/



 Comments   
Comment by Geoff Montee (Inactive) [ 2020-08-10 ]

hholzgra pointed out that the format used for these thread IDs should also be consistent with thread IDs printed outside of SHOW ENGINE INNODB STATUS as well. For example, in Galera's "BF lock wait long" messages, it currently seems to print the "OS thread handle" value in decimal:

2020-08-06  0:29:04 0 [Note] InnoDB: WSREP: BF lock wait long for trx:0xdf2d1f469 query: ...
TRANSACTION 59908420713, ACTIVE 1229 sec starting index read
mysql tables in use 1, locked 1
LOCK WAIT 2 lock struct(s), heap size 1128, 1 row lock(s)
MySQL thread id 109, OS thread handle 139618489706240, query id 14973726334 Update_rows_log_event::find_row(28013568636)
...
2020-08-06  0:29:04 109 [Note] InnoDB: WSREP: BF lock wait long for trx:0xdf2d1f469 query: ...
TRANSACTION 59908420713, ACTIVE 1229 sec starting index read
mysql tables in use 1, locked 1
2 lock struct(s), heap size 1128, 1 row lock(s)
MySQL thread id 109, OS thread handle 139618489706240, query id 14973726334 Update_rows_log_event::find_row(28013568636)
...

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