Commit 0b32ddbb authored by marko's avatar marko

branches/zip: Avoid bogus messages about latching order violations when

UNIV_SYNC_DEBUG is defined.

sync_thread_levels_g(): Add the parameter "warn".  Do not print
anything unless it is set.

sync_thread_add_level(): Pass warn=TRUE to sync_thread_levels_g()
when the check is within an assertion; FALSE if it is not.
parent 75a00e01
...@@ -850,7 +850,8 @@ sync_thread_levels_g( ...@@ -850,7 +850,8 @@ sync_thread_levels_g(
/*=================*/ /*=================*/
sync_level_t* arr, /*!< in: pointer to level array for an OS sync_level_t* arr, /*!< in: pointer to level array for an OS
thread */ thread */
ulint limit) /*!< in: level limit */ ulint limit, /*!< in: level limit */
ulint warn) /*!< in: TRUE=display a diagnostic message */
{ {
sync_level_t* slot; sync_level_t* slot;
rw_lock_t* lock; rw_lock_t* lock;
...@@ -864,6 +865,11 @@ sync_thread_levels_g( ...@@ -864,6 +865,11 @@ sync_thread_levels_g(
if (slot->latch != NULL) { if (slot->latch != NULL) {
if (slot->level <= limit) { if (slot->level <= limit) {
if (!warn) {
return(FALSE);
}
lock = slot->latch; lock = slot->latch;
mutex = slot->latch; mutex = slot->latch;
...@@ -1101,7 +1107,7 @@ sync_thread_add_level( ...@@ -1101,7 +1107,7 @@ sync_thread_add_level(
case SYNC_DICT_HEADER: case SYNC_DICT_HEADER:
case SYNC_TRX_I_S_RWLOCK: case SYNC_TRX_I_S_RWLOCK:
case SYNC_TRX_I_S_LAST_READ: case SYNC_TRX_I_S_LAST_READ:
if (!sync_thread_levels_g(array, level)) { if (!sync_thread_levels_g(array, level, TRUE)) {
fprintf(stderr, fprintf(stderr,
"InnoDB: sync_thread_levels_g(array, %lu)" "InnoDB: sync_thread_levels_g(array, %lu)"
" does not hold!\n", level); " does not hold!\n", level);
...@@ -1112,36 +1118,44 @@ sync_thread_add_level( ...@@ -1112,36 +1118,44 @@ sync_thread_add_level(
/* Either the thread must own the buffer pool mutex /* Either the thread must own the buffer pool mutex
(buf_pool_mutex), or it is allowed to latch only ONE (buf_pool_mutex), or it is allowed to latch only ONE
buffer block (block->mutex or buf_pool_zip_mutex). */ buffer block (block->mutex or buf_pool_zip_mutex). */
if (!sync_thread_levels_g(array, level)) { if (!sync_thread_levels_g(array, level, FALSE)) {
ut_a(sync_thread_levels_g(array, level - 1)); ut_a(sync_thread_levels_g(array, level - 1, TRUE));
ut_a(sync_thread_levels_contain(array, SYNC_BUF_POOL)); ut_a(sync_thread_levels_contain(array, SYNC_BUF_POOL));
} }
break; break;
case SYNC_REC_LOCK: case SYNC_REC_LOCK:
ut_a((sync_thread_levels_contain(array, SYNC_KERNEL) if (sync_thread_levels_contain(array, SYNC_KERNEL)) {
&& sync_thread_levels_g(array, SYNC_REC_LOCK - 1)) ut_a(sync_thread_levels_g(array, SYNC_REC_LOCK - 1,
|| sync_thread_levels_g(array, SYNC_REC_LOCK)); TRUE));
} else {
ut_a(sync_thread_levels_g(array, SYNC_REC_LOCK, TRUE));
}
break; break;
case SYNC_IBUF_BITMAP: case SYNC_IBUF_BITMAP:
/* Either the thread must own the master mutex to all /* Either the thread must own the master mutex to all
the bitmap pages, or it is allowed to latch only ONE the bitmap pages, or it is allowed to latch only ONE
bitmap page. */ bitmap page. */
ut_a((sync_thread_levels_contain(array, SYNC_IBUF_BITMAP_MUTEX) if (sync_thread_levels_contain(array,
&& sync_thread_levels_g(array, SYNC_IBUF_BITMAP - 1)) SYNC_IBUF_BITMAP_MUTEX)) {
|| sync_thread_levels_g(array, SYNC_IBUF_BITMAP)); ut_a(sync_thread_levels_g(array, SYNC_IBUF_BITMAP - 1,
TRUE));
} else {
ut_a(sync_thread_levels_g(array, SYNC_IBUF_BITMAP,
TRUE));
}
break; break;
case SYNC_FSP_PAGE: case SYNC_FSP_PAGE:
ut_a(sync_thread_levels_contain(array, SYNC_FSP)); ut_a(sync_thread_levels_contain(array, SYNC_FSP));
break; break;
case SYNC_FSP: case SYNC_FSP:
ut_a(sync_thread_levels_contain(array, SYNC_FSP) ut_a(sync_thread_levels_contain(array, SYNC_FSP)
|| sync_thread_levels_g(array, SYNC_FSP)); || sync_thread_levels_g(array, SYNC_FSP, TRUE));
break; break;
case SYNC_TRX_UNDO_PAGE: case SYNC_TRX_UNDO_PAGE:
ut_a(sync_thread_levels_contain(array, SYNC_TRX_UNDO) ut_a(sync_thread_levels_contain(array, SYNC_TRX_UNDO)
|| sync_thread_levels_contain(array, SYNC_RSEG) || sync_thread_levels_contain(array, SYNC_RSEG)
|| sync_thread_levels_contain(array, SYNC_PURGE_SYS) || sync_thread_levels_contain(array, SYNC_PURGE_SYS)
|| sync_thread_levels_g(array, SYNC_TRX_UNDO_PAGE)); || sync_thread_levels_g(array, SYNC_TRX_UNDO_PAGE, TRUE));
break; break;
case SYNC_RSEG_HEADER: case SYNC_RSEG_HEADER:
ut_a(sync_thread_levels_contain(array, SYNC_RSEG)); ut_a(sync_thread_levels_contain(array, SYNC_RSEG));
...@@ -1153,37 +1167,41 @@ sync_thread_add_level( ...@@ -1153,37 +1167,41 @@ sync_thread_add_level(
case SYNC_TREE_NODE: case SYNC_TREE_NODE:
ut_a(sync_thread_levels_contain(array, SYNC_INDEX_TREE) ut_a(sync_thread_levels_contain(array, SYNC_INDEX_TREE)
|| sync_thread_levels_contain(array, SYNC_DICT_OPERATION) || sync_thread_levels_contain(array, SYNC_DICT_OPERATION)
|| sync_thread_levels_g(array, SYNC_TREE_NODE - 1)); || sync_thread_levels_g(array, SYNC_TREE_NODE - 1, TRUE));
break; break;
case SYNC_TREE_NODE_NEW: case SYNC_TREE_NODE_NEW:
ut_a(sync_thread_levels_contain(array, SYNC_FSP_PAGE) ut_a(sync_thread_levels_contain(array, SYNC_FSP_PAGE)
|| sync_thread_levels_contain(array, SYNC_IBUF_MUTEX)); || sync_thread_levels_contain(array, SYNC_IBUF_MUTEX));
break; break;
case SYNC_INDEX_TREE: case SYNC_INDEX_TREE:
ut_a((sync_thread_levels_contain(array, SYNC_IBUF_MUTEX) if (sync_thread_levels_contain(array, SYNC_IBUF_MUTEX)
&& sync_thread_levels_contain(array, SYNC_FSP) && sync_thread_levels_contain(array, SYNC_FSP)) {
&& sync_thread_levels_g(array, SYNC_FSP_PAGE - 1)) ut_a(sync_thread_levels_g(array, SYNC_FSP_PAGE - 1,
|| sync_thread_levels_g(array, SYNC_TREE_NODE - 1)); TRUE));
} else {
ut_a(sync_thread_levels_g(array, SYNC_TREE_NODE - 1,
TRUE));
}
break; break;
case SYNC_IBUF_MUTEX: case SYNC_IBUF_MUTEX:
ut_a(sync_thread_levels_g(array, SYNC_FSP_PAGE - 1)); ut_a(sync_thread_levels_g(array, SYNC_FSP_PAGE - 1, TRUE));
break; break;
case SYNC_IBUF_PESS_INSERT_MUTEX: case SYNC_IBUF_PESS_INSERT_MUTEX:
ut_a(sync_thread_levels_g(array, SYNC_FSP - 1) ut_a(sync_thread_levels_g(array, SYNC_FSP - 1, TRUE));
&& !sync_thread_levels_contain(array, SYNC_IBUF_MUTEX)); ut_a(!sync_thread_levels_contain(array, SYNC_IBUF_MUTEX));
break; break;
case SYNC_IBUF_HEADER: case SYNC_IBUF_HEADER:
ut_a(sync_thread_levels_g(array, SYNC_FSP - 1) ut_a(sync_thread_levels_g(array, SYNC_FSP - 1, TRUE));
&& !sync_thread_levels_contain(array, SYNC_IBUF_MUTEX) ut_a(!sync_thread_levels_contain(array, SYNC_IBUF_MUTEX));
&& !sync_thread_levels_contain( ut_a(!sync_thread_levels_contain(array,
array, SYNC_IBUF_PESS_INSERT_MUTEX)); SYNC_IBUF_PESS_INSERT_MUTEX));
break; break;
case SYNC_DICT: case SYNC_DICT:
#ifdef UNIV_DEBUG #ifdef UNIV_DEBUG
ut_a(buf_debug_prints ut_a(buf_debug_prints
|| sync_thread_levels_g(array, SYNC_DICT)); || sync_thread_levels_g(array, SYNC_DICT, TRUE));
#else /* UNIV_DEBUG */ #else /* UNIV_DEBUG */
ut_a(sync_thread_levels_g(array, SYNC_DICT)); ut_a(sync_thread_levels_g(array, SYNC_DICT, TRUE));
#endif /* UNIV_DEBUG */ #endif /* UNIV_DEBUG */
break; break;
default: default:
......
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