Description:
Hi team:
show engine innodb status SEMAPHORES use the function sync_ array print info info low (8041) to output, like this
for (i = 0; count < arr->n_reserved; ++i)
The arr ->n_reserve variable increases by 1 during sync_array_get_and_reserve_cell call and decreases by 1 during sync_array_free_cell call, but the cell allocation method may appear to have some "holes",
so arr ->next_free_slot may be much larger than arr ->n_reserve, indicating a "high water level".
The status at a certain moment when I debugged version 8023 is as follows:
387 if (arr->next_free_slot > arr->n_cells / 2 && arr->n_reserved == 0) {
(gdb) p ((sync_array_t *) 0x7fffdc00c320)[0].cells[0]
$32 = {latch = {lock = 0x0, mutex = 0x0, bpmutex = 0x0}, request_type = 1, file = 0x686dc28 "/newdata/mysql-8.0.23/storage/innobase/handler/ha_innodb.cc", line = 18446744073709551615,
thread_id = 140736821151488, waiting = false, signal_count = 0, reservation_time = 36331}
(gdb) p ((sync_array_t *) 0x7fffdc00c320)[0].cells[1]
$33 = {latch = {lock = 0x7e37ce0 <srv_monitor_file_mutex>, mutex = 0x7e37ce0 <srv_monitor_file_mutex>, bpmutex = 0x7e37ce0 <srv_monitor_file_mutex>}, request_type = 1,
file = 0x686dc28 "/newdata/mysql-8.0.23/storage/innobase/handler/ha_innodb.cc", line = 18271, thread_id = 140736820086528, waiting = true, signal_count = 3, reservation_time = 36518}
(gdb) p ((sync_array_t *) 0x7fffdc00c320)[0].cells[2]
$34 = {latch = {lock = 0x0, mutex = 0x0, bpmutex = 0x0}, request_type = 1, file = 0x686dc28 "/newdata/mysql-8.0.23/storage/innobase/handler/ha_innodb.cc", line = 0, thread_id = 140736819554048,
waiting = false, signal_count = 0, reservation_time = 36533}
(gdb) p ((sync_array_t *) 0x7fffdc00c320)[0].cells[3]
$35 = {latch = {lock = 0x0, mutex = 0x0, bpmutex = 0x0}, request_type = 0, file = 0x0, line = 0, thread_id = 0, waiting = false, signal_count = 0, reservation_time = 0}
(gdb) p *((ulint *) 0x7fffdc00c320)
$36 = 1
(gdb) p *((ulint *) 0x7fffdc00c3d8)
$37 = 3
*((ulint *) 0x7fffdc00c320) is arr->n_reserved
*((ulint *) 0x7fffdc00c3d8) is arr->next_free_slot
This time , count < arr->n_reserved is count < 1 ,so only arr->cells[0] output but cell [1] will not be output. It looks lost.
Tanks.
How to repeat:
see code