diff options
| author | Vladislav Vaintroub <wlad@mariadb.com> | 2018-09-26 19:33:27 +0100 |
|---|---|---|
| committer | Vladislav Vaintroub <wlad@mariadb.com> | 2018-09-26 19:36:56 +0100 |
| commit | 07094220fe3e07297255598804738817bfba6255 (patch) | |
| tree | d5d83f34c41df4a5f219aa7265476fb7ca43baa8 | |
| parent | 9905949b414740cdb15d5048b3289e4c5bb54f93 (diff) | |
| download | mariadb-git-bb-5.5-wlad-MDEV-17190.tar.gz | |
MDEV-17190 : custom build, adding instrumentation ofbb-5.5-wlad-MDEV-17190
innodb mutexes and rwlocks
Add locker thread id to mutexes.
Add last shared locker thread id to rwlocks.
| -rw-r--r-- | storage/xtradb/include/sync0rw.h | 1 | ||||
| -rw-r--r-- | storage/xtradb/include/sync0rw.ic | 2 | ||||
| -rw-r--r-- | storage/xtradb/include/sync0sync.h | 9 | ||||
| -rw-r--r-- | storage/xtradb/sync/sync0arr.c | 10 | ||||
| -rw-r--r-- | storage/xtradb/sync/sync0rw.c | 1 | ||||
| -rw-r--r-- | storage/xtradb/sync/sync0sync.c | 15 |
6 files changed, 20 insertions, 18 deletions
diff --git a/storage/xtradb/include/sync0rw.h b/storage/xtradb/include/sync0rw.h index d666131f3be..47593e77e4d 100644 --- a/storage/xtradb/include/sync0rw.h +++ b/storage/xtradb/include/sync0rw.h @@ -628,6 +628,7 @@ struct rw_lock_struct { /* last s-lock file/line is not guaranteed to be correct */ const char* last_s_file_name;/*!< File name where last s-locked */ const char* last_x_file_name;/*!< File name where last x-locked */ + os_thread_id_t last_s_thread_id;/* <! Last s-locker's thread id */ ibool writer_is_wait_ex; /*!< This is TRUE if the writer field is RW_LOCK_WAIT_EX; this field is located far diff --git a/storage/xtradb/include/sync0rw.ic b/storage/xtradb/include/sync0rw.ic index 031c57aff0d..174a831d7a9 100644 --- a/storage/xtradb/include/sync0rw.ic +++ b/storage/xtradb/include/sync0rw.ic @@ -321,7 +321,7 @@ rw_lock_s_lock_low( or even refer to a line that is invalid for the file name. */ lock->last_s_file_name = file_name; lock->last_s_line = line; - + lock->last_s_thread_id = os_thread_get_curr_id(); return(TRUE); /* locking succeeded */ } diff --git a/storage/xtradb/include/sync0sync.h b/storage/xtradb/include/sync0sync.h index 7568690770d..3a99577c48e 100644 --- a/storage/xtradb/include/sync0sync.h +++ b/storage/xtradb/include/sync0sync.h @@ -721,16 +721,15 @@ struct mutex_struct { Otherwise, this is 0. */ UT_LIST_NODE_T(mutex_t) list; /*!< All allocated mutexes are put into a list. Pointers to the next and prev. */ -#ifdef UNIV_SYNC_DEBUG + const char* file_name; /*!< File where the mutex was locked */ ulint line; /*!< Line where the mutex was locked */ - ulint level; /*!< Level in the global latching order */ -#endif /* UNIV_SYNC_DEBUG */ + os_thread_id_t thread_id; /*!< The thread id of the thread + which locked the mutex. */ #ifdef UNIV_DEBUG const char* cfile_name;/*!< File name where mutex created */ ulint cline; /*!< Line where created */ - os_thread_id_t thread_id; /*!< The thread id of the thread - which locked the mutex. */ + ulint level; /*!< Level in the global latching order */ ulint magic_n; /*!< MUTEX_MAGIC_N */ /** Value of mutex_struct::magic_n */ # define MUTEX_MAGIC_N (ulint)979585 diff --git a/storage/xtradb/sync/sync0arr.c b/storage/xtradb/sync/sync0arr.c index 3bf53696148..a200646ec7a 100644 --- a/storage/xtradb/sync/sync0arr.c +++ b/storage/xtradb/sync/sync0arr.c @@ -494,15 +494,12 @@ sync_array_cell_print( if (mutex) { fprintf(file, "Mutex at %p '%s', lock var %lu\n" -#ifdef UNIV_SYNC_DEBUG - "Last time reserved in file %s line %lu, " -#endif /* UNIV_SYNC_DEBUG */ + "Last time reserved in file %s line %lu by thread %lu, " "waiters flag %lu\n", (void*) mutex, mutex->cmutex_name, (ulong) mutex->lock_word, -#ifdef UNIV_SYNC_DEBUG mutex->file_name, (ulong) mutex->line, -#endif /* UNIV_SYNC_DEBUG */ + (ulong) mutex->thread_id, (ulong) mutex->waiters); } @@ -547,13 +544,14 @@ sync_array_cell_print( fprintf(file, "number of readers %lu, waiters flag %lu, " "lock_word: %lx\n" - "Last time read locked in file %s line %lu\n" + "Last time read locked in file %s line %lu by thread %lu\n" "Last time write locked in file %s line %lu\n", (ulong) rw_lock_get_reader_count(rwlock), (ulong) rwlock->waiters, rwlock->lock_word, innobase_basename(rwlock->last_s_file_name), (ulong) rwlock->last_s_line, + (ulong) rwlock->last_s_thread_id, rwlock->last_x_file_name, (ulong) rwlock->last_x_line); diff --git a/storage/xtradb/sync/sync0rw.c b/storage/xtradb/sync/sync0rw.c index 156c3fd9ad5..85a3f3d0027 100644 --- a/storage/xtradb/sync/sync0rw.c +++ b/storage/xtradb/sync/sync0rw.c @@ -287,6 +287,7 @@ rw_lock_create_func( lock->last_x_file_name = "not yet reserved"; lock->last_s_line = 0; lock->last_x_line = 0; + lock->last_s_thread_id = 0; lock->event = os_event_create(NULL); lock->wait_ex_event = os_event_create(NULL); diff --git a/storage/xtradb/sync/sync0sync.c b/storage/xtradb/sync/sync0sync.c index 21d2f49dce0..659805d41d5 100644 --- a/storage/xtradb/sync/sync0sync.c +++ b/storage/xtradb/sync/sync0sync.c @@ -290,9 +290,10 @@ mutex_create_func( #ifdef UNIV_DEBUG mutex->magic_n = MUTEX_MAGIC_N; #endif /* UNIV_DEBUG */ -#ifdef UNIV_SYNC_DEBUG mutex->line = 0; mutex->file_name = "not yet reserved"; + mutex->thread_id = 0; +#ifdef UNIV_SYNC_DEBUG mutex->level = level; #endif /* UNIV_SYNC_DEBUG */ #ifdef UNIV_DEBUG @@ -556,10 +557,9 @@ spin_loop: if (mutex_test_and_set(mutex) == 0) { /* Succeeded! */ - ut_d(mutex->thread_id = os_thread_get_curr_id()); -#ifdef UNIV_SYNC_DEBUG - mutex_set_debug_info(mutex, file_name, line); -#endif + mutex->thread_id = os_thread_get_curr_id(); + mutex->file_name = file_name; + mutex->line = line; goto finish_timing; } @@ -600,7 +600,10 @@ spin_loop: sync_array_free_cell(sync_primary_wait_array, index); - ut_d(mutex->thread_id = os_thread_get_curr_id()); + mutex->thread_id = os_thread_get_curr_id(); + mutex->file_name = file_name; + mutex->line = line; + #ifdef UNIV_SYNC_DEBUG mutex_set_debug_info(mutex, file_name, line); #endif |
