Commit 9f4ee16b authored by Jan Lindström's avatar Jan Lindström

MDEV-7619: Improve long semaphore wait output

Add holder thread_id, file_name and line to output.
parent ba43735c
...@@ -500,16 +500,13 @@ sync_array_cell_print( ...@@ -500,16 +500,13 @@ sync_array_cell_print(
if (mutex) { if (mutex) {
fprintf(file, fprintf(file,
"Mutex at %p created file %s line %lu, lock var %lu\n" "Mutex at %p created file %s line %lu, lock var %lu\n"
#ifdef UNIV_SYNC_DEBUG "Last time reserved by thread %lu in file %s line %lu, "
"Last time reserved in file %s line %lu, "
#endif /* UNIV_SYNC_DEBUG */
"waiters flag %lu\n", "waiters flag %lu\n",
(void*) mutex, innobase_basename(mutex->cfile_name), (void*) mutex, innobase_basename(mutex->cfile_name),
(ulong) mutex->cline, (ulong) mutex->cline,
(ulong) mutex->lock_word, (ulong) mutex->lock_word,
#ifdef UNIV_SYNC_DEBUG mutex->thread_id,
mutex->file_name, (ulong) mutex->line, mutex->file_name, (ulong) mutex->line,
#endif /* UNIV_SYNC_DEBUG */
(ulong) mutex->waiters); (ulong) mutex->waiters);
} }
...@@ -528,8 +525,10 @@ sync_array_cell_print( ...@@ -528,8 +525,10 @@ sync_array_cell_print(
" RW-latch at %p created in file %s line %lu\n", " RW-latch at %p created in file %s line %lu\n",
(void*) rwlock, innobase_basename(rwlock->cfile_name), (void*) rwlock, innobase_basename(rwlock->cfile_name),
(ulong) rwlock->cline); (ulong) rwlock->cline);
writer = rw_lock_get_writer(rwlock); writer = rw_lock_get_writer(rwlock);
if (writer != RW_LOCK_NOT_LOCKED) {
if (writer && writer != RW_LOCK_NOT_LOCKED) {
fprintf(file, fprintf(file,
"a writer (thread id %lu) has" "a writer (thread id %lu) has"
" reserved it in mode %s", " reserved it in mode %s",
...@@ -552,6 +551,11 @@ sync_array_cell_print( ...@@ -552,6 +551,11 @@ sync_array_cell_print(
(ulong) rwlock->last_s_line, (ulong) rwlock->last_s_line,
rwlock->last_x_file_name, rwlock->last_x_file_name,
(ulong) rwlock->last_x_line); (ulong) rwlock->last_x_line);
fprintf(file,
"Holder thread %lu file %s line %lu\n",
rwlock->thread_id, rwlock->file_name, rwlock->line);
} }
} else { } else {
ut_error; ut_error;
......
...@@ -522,15 +522,12 @@ sync_array_cell_print( ...@@ -522,15 +522,12 @@ sync_array_cell_print(
if (mutex) { if (mutex) {
fprintf(file, fprintf(file,
"Mutex at %p '%s', lock var %lu\n" "Mutex at %p '%s', lock var %lu\n"
#ifdef UNIV_SYNC_DEBUG "Last time reserved by thread %lu in file %s line %lu, "
"Last time reserved in file %s line %lu, "
#endif /* UNIV_SYNC_DEBUG */
"waiters flag %lu\n", "waiters flag %lu\n",
(void*) mutex, mutex->cmutex_name, (void*) mutex, mutex->cmutex_name,
(ulong) mutex->lock_word, (ulong) mutex->lock_word,
#ifdef UNIV_SYNC_DEBUG mutex->thread_id,
mutex->file_name, (ulong) mutex->line, mutex->file_name, (ulong) mutex->line,
#endif /* UNIV_SYNC_DEBUG */
(ulong) mutex->waiters); (ulong) mutex->waiters);
} }
...@@ -608,6 +605,10 @@ sync_array_cell_print( ...@@ -608,6 +605,10 @@ sync_array_cell_print(
rwlock->last_x_file_name, rwlock->last_x_file_name,
(ulong) rwlock->last_x_line); (ulong) rwlock->last_x_line);
fprintf(file,
"Holder thread %lu file %s line %lu\n",
rwlock->thread_id, rwlock->file_name, rwlock->line);
/* If stacktrace feature is enabled we will send a SIGUSR2 /* If stacktrace feature is enabled we will send a SIGUSR2
signal to thread that has locked RW-latch with write mode. signal to thread that has locked RW-latch with write mode.
Signal handler will then dump the current stack to error log. */ Signal handler will then dump the current stack to error log. */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment