diff options
Diffstat (limited to 'innobase/sync')
-rw-r--r-- | innobase/sync/sync0arr.c | 33 | ||||
-rw-r--r-- | innobase/sync/sync0rw.c | 33 | ||||
-rw-r--r-- | innobase/sync/sync0sync.c | 47 |
3 files changed, 76 insertions, 37 deletions
diff --git a/innobase/sync/sync0arr.c b/innobase/sync/sync0arr.c index 78d1a36fcf3..426d7ff9f92 100644 --- a/innobase/sync/sync0arr.c +++ b/innobase/sync/sync0arr.c @@ -456,8 +456,9 @@ sync_array_cell_print( fprintf(file, "--Thread %lu has waited at %s line %lu for %.2f seconds the semaphore:\n", - os_thread_pf(cell->thread), cell->file, cell->line, - difftime(time(NULL), cell->reservation_time)); + (ulong) os_thread_pf(cell->thread), cell->file, + (ulong) cell->line, + difftime(time(NULL), cell->reservation_time)); if (type == SYNC_MUTEX) { /* We use old_wait_mutex in case the cell has already @@ -470,12 +471,12 @@ sync_array_cell_print( "Last time reserved in file %s line %lu, " #endif /* UNIV_SYNC_DEBUG */ "waiters flag %lu\n", - mutex, mutex->cfile_name, mutex->cline, - mutex->lock_word, + mutex, mutex->cfile_name, (ulong) mutex->cline, + (ulong) mutex->lock_word, #ifdef UNIV_SYNC_DEBUG - mutex->file_name, mutex->line, + mutex->file_name, (ulong) mutex->line, #endif /* UNIV_SYNC_DEBUG */ - mutex->waiters); + (ulong) mutex->waiters); } else if (type == RW_LOCK_EX || type == RW_LOCK_SHARED) { @@ -485,11 +486,12 @@ sync_array_cell_print( fprintf(file, " RW-latch at %p created in file %s line %lu\n", - rwlock, rwlock->cfile_name, rwlock->cline); + rwlock, rwlock->cfile_name, + (ulong) rwlock->cline); if (rwlock->writer != RW_LOCK_NOT_LOCKED) { fprintf(file, "a writer (thread id %lu) has reserved it in mode %s", - os_thread_pf(rwlock->writer_thread), + (ulong) os_thread_pf(rwlock->writer_thread), rwlock->writer == RW_LOCK_EX ? " exclusive\n" : " wait exclusive\n"); @@ -499,9 +501,12 @@ sync_array_cell_print( "number of readers %lu, waiters flag %lu\n" "Last time read locked in file %s line %lu\n" "Last time write locked in file %s line %lu\n", - rwlock->reader_count, rwlock->waiters, - rwlock->last_s_file_name, rwlock->last_s_line, - rwlock->last_x_file_name, rwlock->last_x_line); + (ulong) rwlock->reader_count, + (ulong) rwlock->waiters, + rwlock->last_s_file_name, + (ulong) rwlock->last_s_line, + rwlock->last_x_file_name, + (ulong) rwlock->last_x_line); } else { ut_error; } @@ -648,8 +653,8 @@ sync_array_detect_deadlock( if (ret) { fprintf(stderr, "Mutex %p owned by thread %lu file %s line %lu\n", - mutex, os_thread_pf(mutex->thread_id), - mutex->file_name, mutex->line); + mutex, (ulong) os_thread_pf(mutex->thread_id), + mutex->file_name, (ulong) mutex->line); sync_array_cell_print(stderr, cell); return(TRUE); @@ -968,7 +973,7 @@ sync_array_output_info( fprintf(file, "OS WAIT ARRAY INFO: reservation count %ld, signal count %ld\n", - arr->res_count, arr->sg_count); + (long) arr->res_count, (long) arr->sg_count); i = 0; count = 0; diff --git a/innobase/sync/sync0rw.c b/innobase/sync/sync0rw.c index 9dd5148e27a..43f8d646eaa 100644 --- a/innobase/sync/sync0rw.c +++ b/innobase/sync/sync0rw.c @@ -125,6 +125,11 @@ rw_lock_create_func( lock->last_x_line = 0; mutex_enter(&rw_lock_list_mutex); + + if (UT_LIST_GET_LEN(rw_lock_list) > 0) { + ut_a(UT_LIST_GET_FIRST(rw_lock_list)->magic_n + == RW_LOCK_MAGIC_N); + } UT_LIST_ADD_FIRST(list, rw_lock_list, lock); @@ -141,7 +146,9 @@ rw_lock_free( /*=========*/ rw_lock_t* lock) /* in: rw-lock */ { - ut_ad(rw_lock_validate(lock)); +#ifdef UNIV_DEBUG + ut_a(rw_lock_validate(lock)); +#endif /* UNIV_DEBUG */ ut_a(rw_lock_get_writer(lock) == RW_LOCK_NOT_LOCKED); ut_a(rw_lock_get_waiters(lock) == 0); ut_a(rw_lock_get_reader_count(lock) == 0); @@ -152,6 +159,13 @@ rw_lock_free( mutex_enter(&rw_lock_list_mutex); + if (UT_LIST_GET_PREV(list, lock)) { + ut_a(UT_LIST_GET_PREV(list, lock)->magic_n == RW_LOCK_MAGIC_N); + } + if (UT_LIST_GET_NEXT(list, lock)) { + ut_a(UT_LIST_GET_NEXT(list, lock)->magic_n == RW_LOCK_MAGIC_N); + } + UT_LIST_REMOVE(list, rw_lock_list, lock); mutex_exit(&rw_lock_list_mutex); @@ -229,8 +243,8 @@ lock_loop: if (srv_print_latch_waits) { fprintf(stderr, "Thread %lu spin wait rw-s-lock at %p cfile %s cline %lu rnds %lu\n", - os_thread_pf(os_thread_get_curr_id()), lock, - lock->cfile_name, lock->cline, i); + (ulong) os_thread_pf(os_thread_get_curr_id()), lock, + lock->cfile_name, (ulong) lock->cline, (ulong) i); } mutex_enter(rw_lock_get_mutex(lock)); @@ -259,8 +273,8 @@ lock_loop: if (srv_print_latch_waits) { fprintf(stderr, "Thread %lu OS wait rw-s-lock at %p cfile %s cline %lu\n", - os_thread_pf(os_thread_get_curr_id()), lock, - lock->cfile_name, lock->cline); + os_thread_pf(os_thread_get_curr_id()), + lock, lock->cfile_name, (ulong) lock->cline); } rw_s_system_call_count++; @@ -479,7 +493,7 @@ lock_loop: fprintf(stderr, "Thread %lu spin wait rw-x-lock at %p cfile %s cline %lu rnds %lu\n", os_thread_pf(os_thread_get_curr_id()), lock, - lock->cfile_name, lock->cline, i); + lock->cfile_name, (ulong) lock->cline, (ulong) i); } rw_x_spin_wait_count++; @@ -512,7 +526,7 @@ lock_loop: fprintf(stderr, "Thread %lu OS wait for rw-x-lock at %p cfile %s cline %lu\n", os_thread_pf(os_thread_get_curr_id()), lock, - lock->cfile_name, lock->cline); + lock->cfile_name, (ulong) lock->cline); } rw_x_system_call_count++; @@ -839,7 +853,8 @@ rw_lock_debug_print( rwt = info->lock_type; fprintf(stderr, "Locked: thread %ld file %s line %ld ", - os_thread_pf(info->thread_id), info->file_name, info->line); + (ulong) os_thread_pf(info->thread_id), info->file_name, + (ulong) info->line); if (rwt == RW_LOCK_SHARED) { fputs("S-LOCK", stderr); } else if (rwt == RW_LOCK_EX) { @@ -850,7 +865,7 @@ rw_lock_debug_print( ut_error; } if (info->pass != 0) { - fprintf(stderr, " pass value %lu", info->pass); + fprintf(stderr, " pass value %lu", (ulong) info->pass); } putc('\n', stderr); } diff --git a/innobase/sync/sync0sync.c b/innobase/sync/sync0sync.c index 0897cc72a4f..c1fb31bc966 100644 --- a/innobase/sync/sync0sync.c +++ b/innobase/sync/sync0sync.c @@ -232,6 +232,10 @@ mutex_create_func( mutex_enter(&mutex_list_mutex); + if (UT_LIST_GET_LEN(mutex_list) > 0) { + ut_a(UT_LIST_GET_FIRST(mutex_list)->magic_n == MUTEX_MAGIC_N); + } + UT_LIST_ADD_FIRST(list, mutex_list, mutex); mutex_exit(&mutex_list_mutex); @@ -247,7 +251,9 @@ mutex_free( /*=======*/ mutex_t* mutex) /* in: mutex */ { - ut_ad(mutex_validate(mutex)); +#ifdef UNIV_DEBUG + ut_a(mutex_validate(mutex)); +#endif /* UNIV_DEBUG */ ut_a(mutex_get_lock_word(mutex) == 0); ut_a(mutex_get_waiters(mutex) == 0); @@ -255,6 +261,15 @@ mutex_free( mutex_enter(&mutex_list_mutex); + if (UT_LIST_GET_PREV(list, mutex)) { + ut_a(UT_LIST_GET_PREV(list, mutex)->magic_n + == MUTEX_MAGIC_N); + } + if (UT_LIST_GET_NEXT(list, mutex)) { + ut_a(UT_LIST_GET_NEXT(list, mutex)->magic_n + == MUTEX_MAGIC_N); + } + UT_LIST_REMOVE(list, mutex_list, mutex); mutex_exit(&mutex_list_mutex); @@ -380,8 +395,8 @@ spin_loop: if (srv_print_latch_waits) { fprintf(stderr, "Thread %lu spin wait mutex at %p cfile %s cline %lu rnds %lu\n", - os_thread_pf(os_thread_get_curr_id()), mutex, - mutex->cfile_name, mutex->cline, i); + (ulong) os_thread_pf(os_thread_get_curr_id()), mutex, + mutex->cfile_name, (ulong) mutex->cline, (ulong) i); } mutex_spin_round_count += i; @@ -441,7 +456,8 @@ spin_loop: fprintf(stderr, "Thread %lu spin wait succeeds at 2:" " mutex at %p\n", - os_thread_pf(os_thread_get_curr_id()), mutex); + (ulong) os_thread_pf(os_thread_get_curr_id()), + mutex); } return; @@ -459,8 +475,8 @@ spin_loop: if (srv_print_latch_waits) { fprintf(stderr, "Thread %lu OS wait mutex at %p cfile %s cline %lu rnds %lu\n", - os_thread_pf(os_thread_get_curr_id()), mutex, - mutex->cfile_name, mutex->cline, i); + (ulong) os_thread_pf(os_thread_get_curr_id()), mutex, + mutex->cfile_name, (ulong) mutex->cline, (ulong) i); } mutex_system_call_count++; @@ -762,13 +778,13 @@ sync_thread_levels_g( fprintf(stderr, "InnoDB error: sync levels should be > %lu but a level is %lu\n", - limit, slot->level); + (ulong) limit, (ulong) slot->level); if (mutex->magic_n == MUTEX_MAGIC_N) { fprintf(stderr, "Mutex created at %s %lu\n", mutex->cfile_name, - mutex->cline); + (ulong) mutex->cline); if (mutex_get_lock_word(mutex) != 0) { #ifdef UNIV_SYNC_DEBUG @@ -781,7 +797,7 @@ sync_thread_levels_g( fprintf(stderr, "InnoDB: Locked mutex: addr %p thread %ld file %s line %ld\n", - mutex, os_thread_pf(thread_id), file_name, line); + mutex, os_thread_pf(thread_id), file_name, (ulong) line); #else /* UNIV_SYNC_DEBUG */ fprintf(stderr, "InnoDB: Locked mutex: addr %p\n", mutex); @@ -958,7 +974,7 @@ sync_thread_add_level( } array = thread_slot->levels; - + /* NOTE that there is a problem with _NODE and _LEAF levels: if the B-tree height changes, then a leaf can change to an internal node or the other way around. We do not know at present if this can cause @@ -1245,10 +1261,13 @@ sync_print_wait_info( fprintf(file, "Mutex spin waits %lu, rounds %lu, OS waits %lu\n" "RW-shared spins %lu, OS waits %lu; RW-excl spins %lu, OS waits %lu\n", - mutex_spin_wait_count, mutex_spin_round_count, - mutex_os_wait_count, - rw_s_spin_wait_count, rw_s_os_wait_count, - rw_x_spin_wait_count, rw_x_os_wait_count); + (ulong) mutex_spin_wait_count, + (ulong) mutex_spin_round_count, + (ulong) mutex_os_wait_count, + (ulong) rw_s_spin_wait_count, + (ulong) rw_s_os_wait_count, + (ulong) rw_x_spin_wait_count, + (ulong) rw_x_os_wait_count); } /*********************************************************************** |