diff options
Diffstat (limited to 'innobase/sync')
-rw-r--r-- | innobase/sync/sync0arr.c | 35 | ||||
-rw-r--r-- | innobase/sync/sync0rw.c | 35 | ||||
-rw-r--r-- | innobase/sync/sync0sync.c | 47 |
3 files changed, 76 insertions, 41 deletions
diff --git a/innobase/sync/sync0arr.c b/innobase/sync/sync0arr.c index 4854b40409e..9bcee34a7d1 100644 --- a/innobase/sync/sync0arr.c +++ b/innobase/sync/sync0arr.c @@ -454,8 +454,9 @@ sync_array_cell_print( buf += sprintf(buf, "--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 @@ -464,11 +465,12 @@ sync_array_cell_print( buf += sprintf(buf, "Mutex at %lx created file %s line %lu, lock var %lu\n", - (ulint)mutex, mutex->cfile_name, mutex->cline, - mutex->lock_word); + (ulong) mutex, mutex->cfile_name, + (ulong) mutex->cline, (ulong) mutex->lock_word); buf += sprintf(buf, "Last time reserved in file %s line %lu, waiters flag %lu\n", - mutex->file_name, mutex->line, mutex->waiters); + mutex->file_name, (ulong) mutex->line, + (ulong) mutex->waiters); } else if (type == RW_LOCK_EX || type == RW_LOCK_SHARED) { @@ -482,11 +484,12 @@ sync_array_cell_print( buf += sprintf(buf, " RW-latch at %lx created in file %s line %lu\n", - (ulint)rwlock, rwlock->cfile_name, rwlock->cline); + (ulong) rwlock, rwlock->cfile_name, + (ulong) rwlock->cline); if (rwlock->writer != RW_LOCK_NOT_LOCKED) { buf += sprintf(buf, "a writer (thread id %lu) has reserved it in mode", - os_thread_pf(rwlock->writer_thread)); + (ulong) os_thread_pf(rwlock->writer_thread)); if (rwlock->writer == RW_LOCK_EX) { buf += sprintf(buf, " exclusive\n"); } else { @@ -496,14 +499,16 @@ sync_array_cell_print( buf += sprintf(buf, "number of readers %lu, waiters flag %lu\n", - rwlock->reader_count, rwlock->waiters); + (ulong) rwlock->reader_count, + (ulong) rwlock->waiters); buf += sprintf(buf, "Last time read locked in file %s line %lu\n", - rwlock->last_s_file_name, rwlock->last_s_line); + rwlock->last_s_file_name, + (ulong) rwlock->last_s_line); buf += sprintf(buf, "Last time write locked in file %s line %lu\n", - rwlock->last_x_file_name, rwlock->last_x_line); + rwlock->last_x_file_name, (ulong) rwlock->last_x_line); } else { ut_error; } @@ -651,8 +656,8 @@ sync_array_detect_deadlock( sync_array_cell_print(buf, cell); printf( "Mutex %lx owned by thread %lu file %s line %lu\n%s", - (ulint)mutex, os_thread_pf(mutex->thread_id), - mutex->file_name, mutex->line, buf); + (ulong) mutex, (ulong) os_thread_pf(mutex->thread_id), + mutex->file_name, (ulong) mutex->line, buf); return(TRUE); } @@ -686,7 +691,7 @@ sync_array_detect_deadlock( depth); if (ret) { sync_array_cell_print(buf, cell); - printf("rw-lock %lx %s ", (ulint) lock, buf); + printf("rw-lock %lx %s ", (ulong) lock, buf); rw_lock_debug_print(debug); return(TRUE); @@ -719,7 +724,7 @@ sync_array_detect_deadlock( depth); if (ret) { sync_array_cell_print(buf, cell); - printf("rw-lock %lx %s ", (ulint) lock, buf); + printf("rw-lock %lx %s ", (ulong) lock, buf); rw_lock_debug_print(debug); return(TRUE); @@ -972,7 +977,7 @@ sync_array_output_info( buf += sprintf(buf, "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 fd52d5aac2e..e6da03c53fa 100644 --- a/innobase/sync/sync0rw.c +++ b/innobase/sync/sync0rw.c @@ -121,6 +121,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); @@ -137,7 +142,7 @@ rw_lock_free( /*=========*/ rw_lock_t* lock) /* in: rw-lock */ { - ut_ad(rw_lock_validate(lock)); + ut_a(rw_lock_validate(lock)); 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); @@ -148,6 +153,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); @@ -223,8 +235,8 @@ lock_loop: if (srv_print_latch_waits) { printf( "Thread %lu spin wait rw-s-lock at %lx cfile %s cline %lu rnds %lu\n", - os_thread_pf(os_thread_get_curr_id()), (ulint)lock, - lock->cfile_name, lock->cline, i); + (ulong) os_thread_pf(os_thread_get_curr_id()), (ulong) lock, + lock->cfile_name, (ulong) lock->cline, (ulong) i); } mutex_enter(rw_lock_get_mutex(lock)); @@ -253,8 +265,8 @@ lock_loop: if (srv_print_latch_waits) { printf( "Thread %lu OS wait rw-s-lock at %lx cfile %s cline %lu\n", - os_thread_pf(os_thread_get_curr_id()), (ulint)lock, - lock->cfile_name, lock->cline); + (ulong) os_thread_pf(os_thread_get_curr_id()), + (ulong) lock, lock->cfile_name, (ulong) lock->cline); } rw_s_system_call_count++; @@ -471,8 +483,8 @@ lock_loop: if (srv_print_latch_waits) { printf( "Thread %lu spin wait rw-x-lock at %lx cfile %s cline %lu rnds %lu\n", - os_thread_pf(os_thread_get_curr_id()), (ulint)lock, - lock->cfile_name, lock->cline, i); + (ulong) os_thread_pf(os_thread_get_curr_id()), (ulong) lock, + lock->cfile_name, (ulong) lock->cline, (ulong) i); } rw_x_spin_wait_count++; @@ -504,8 +516,8 @@ lock_loop: if (srv_print_latch_waits) { printf( "Thread %lu OS wait for rw-x-lock at %lx cfile %s cline %lu\n", - os_thread_pf(os_thread_get_curr_id()), (ulint)lock, - lock->cfile_name, lock->cline); + (ulong) os_thread_pf(os_thread_get_curr_id()), (ulong) lock, + lock->cfile_name, (ulong) lock->cline); } rw_x_system_call_count++; @@ -838,7 +850,8 @@ rw_lock_debug_print( rwt = info->lock_type; printf("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) { printf("S-LOCK"); } else if (rwt == RW_LOCK_EX) { @@ -849,7 +862,7 @@ rw_lock_debug_print( ut_error; } if (info->pass != 0) { - printf(" pass value %lu", info->pass); + printf(" pass value %lu", (ulong) info->pass); } printf("\n"); } diff --git a/innobase/sync/sync0sync.c b/innobase/sync/sync0sync.c index 7b387946d82..d5a6fff47bf 100644 --- a/innobase/sync/sync0sync.c +++ b/innobase/sync/sync0sync.c @@ -246,6 +246,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); @@ -261,7 +265,7 @@ mutex_free( /*=======*/ mutex_t* mutex) /* in: mutex */ { - ut_ad(mutex_validate(mutex)); + ut_a(mutex_validate(mutex)); ut_a(mutex_get_lock_word(mutex) == 0); ut_a(mutex_get_waiters(mutex) == 0); @@ -269,6 +273,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); @@ -393,8 +406,8 @@ spin_loop: if (srv_print_latch_waits) { printf( "Thread %lu spin wait mutex at %lx cfile %s cline %lu rnds %lu\n", - os_thread_pf(os_thread_get_curr_id()), (ulint)mutex, - mutex->cfile_name, mutex->cline, i); + (ulong) os_thread_pf(os_thread_get_curr_id()), (ulong) mutex, + mutex->cfile_name, (ulong) mutex->cline, (ulong) i); } mutex_spin_round_count += i; @@ -459,7 +472,8 @@ spin_loop: if (srv_print_latch_waits) { printf( "Thread %lu spin wait succeeds at 2: mutex at %lx\n", - os_thread_pf(os_thread_get_curr_id()), (ulint)mutex); + (ulong) os_thread_pf(os_thread_get_curr_id()), + (ulong) mutex); } return; @@ -477,8 +491,8 @@ spin_loop: if (srv_print_latch_waits) { printf( "Thread %lu OS wait mutex at %lx cfile %s cline %lu rnds %lu\n", - os_thread_pf(os_thread_get_curr_id()), (ulint)mutex, - mutex->cfile_name, mutex->cline, i); + (ulong) os_thread_pf(os_thread_get_curr_id()), (ulong) mutex, + mutex->cfile_name, (ulong) mutex->cline, (ulong) i); } mutex_system_call_count++; @@ -800,11 +814,11 @@ sync_thread_levels_g( printf( "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) { printf("Mutex created at %s %lu\n", mutex->cfile_name, - mutex->cline); + (ulong) mutex->cline); if (mutex_get_lock_word(mutex) != 0) { @@ -812,8 +826,8 @@ sync_thread_levels_g( &file_name, &line, &thread_id); printf("InnoDB: Locked mutex: addr %lx thread %ld file %s line %ld\n", - (ulint)mutex, os_thread_pf(thread_id), - file_name, line); + (ulong) mutex, (ulong) os_thread_pf(thread_id), + file_name, (ulong) line); } else { printf("Not locked\n"); } @@ -991,7 +1005,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 @@ -1275,10 +1289,13 @@ sync_print_wait_info( sprintf(buf, "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); } /*********************************************************************** |