diff options
Diffstat (limited to 'storage/xtradb/sync/sync0arr.c')
-rw-r--r-- | storage/xtradb/sync/sync0arr.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/storage/xtradb/sync/sync0arr.c b/storage/xtradb/sync/sync0arr.c index db50304a70b..fb5829fb732 100644 --- a/storage/xtradb/sync/sync0arr.c +++ b/storage/xtradb/sync/sync0arr.c @@ -483,6 +483,15 @@ sync_array_cell_print( innobase_basename(cell->file), (ulong) cell->line, difftime(time(NULL), cell->reservation_time)); + /* If stacktrace feature is enabled we will send a SIGUSR2 + signal to thread waiting for the semaphore. Signal handler + will then dump the current stack to error log. */ + if (srv_use_stacktrace) { +#ifdef __linux__ + pthread_kill(cell->thread, SIGUSR2); +#endif + } + if (type == SYNC_MUTEX) { /* We use old_wait_mutex in case the cell has already been freed meanwhile */ @@ -537,6 +546,16 @@ sync_array_cell_print( (ulong) rwlock->last_s_line, rwlock->last_x_file_name, (ulong) rwlock->last_x_line); + + /* If stacktrace feature is enabled we will send a SIGUSR2 + signal to thread that has locked RW-latch with write mode. + Signal handler will then dump the current stack to error log. */ + if (writer != RW_LOCK_NOT_LOCKED && srv_use_stacktrace) { +#ifdef __linux__ + pthread_kill(rwlock->writer_thread, SIGUSR2); +#endif + } + } else { ut_error; } |