Commit bdf341a2 authored by marko's avatar marko

branches/zip: Add assertions that the kernel_mutex is being held

while accessing table->locks or un_member.tab_lock.locks.
This is related to Issue #158.  According to static analysis,
the added debug assertions should always hold.

lock_table_has_to_wait_in_queue(), lock_queue_iterator_reset(),
lock_queue_iterator_get_prev(), add_trx_relevant_locks_to_cache(),
fetch_data_into_cache(): Add ut_ad(mutex_own(&kernel_mutex)).
parent b267d1cc
...@@ -15,6 +15,9 @@ Created July 16, 2007 Vasil Dimov ...@@ -15,6 +15,9 @@ Created July 16, 2007 Vasil Dimov
#include "lock0priv.h" #include "lock0priv.h"
#include "ut0dbg.h" #include "ut0dbg.h"
#include "ut0lst.h" #include "ut0lst.h"
#ifdef UNIV_DEBUG
# include "srv0srv.h" /* kernel_mutex */
#endif /* UNIV_DEBUG */
/*********************************************************************** /***********************************************************************
Initialize lock queue iterator so that it starts to iterate from Initialize lock queue iterator so that it starts to iterate from
...@@ -34,6 +37,8 @@ lock_queue_iterator_reset( ...@@ -34,6 +37,8 @@ lock_queue_iterator_reset(
ulint bit_no) /* in: record number in the ulint bit_no) /* in: record number in the
heap */ heap */
{ {
ut_ad(mutex_own(&kernel_mutex));
iter->current_lock = lock; iter->current_lock = lock;
if (bit_no != ULINT_UNDEFINED) { if (bit_no != ULINT_UNDEFINED) {
...@@ -68,6 +73,8 @@ lock_queue_iterator_get_prev( ...@@ -68,6 +73,8 @@ lock_queue_iterator_get_prev(
{ {
const lock_t* prev_lock; const lock_t* prev_lock;
ut_ad(mutex_own(&kernel_mutex));
switch (lock_get_type_low(iter->current_lock)) { switch (lock_get_type_low(iter->current_lock)) {
case LOCK_REC: case LOCK_REC:
prev_lock = lock_rec_get_prev( prev_lock = lock_rec_get_prev(
......
...@@ -3834,6 +3834,7 @@ lock_table_has_to_wait_in_queue( ...@@ -3834,6 +3834,7 @@ lock_table_has_to_wait_in_queue(
dict_table_t* table; dict_table_t* table;
lock_t* lock; lock_t* lock;
ut_ad(mutex_own(&kernel_mutex));
ut_ad(lock_get_wait(wait_lock)); ut_ad(lock_get_wait(wait_lock));
table = wait_lock->un_member.tab_lock.table; table = wait_lock->un_member.tab_lock.table;
......
...@@ -954,6 +954,8 @@ add_trx_relevant_locks_to_cache( ...@@ -954,6 +954,8 @@ add_trx_relevant_locks_to_cache(
requested lock row, or NULL or requested lock row, or NULL or
undefined */ undefined */
{ {
ut_ad(mutex_own(&kernel_mutex));
/* If transaction is waiting we add the wait lock and all locks /* If transaction is waiting we add the wait lock and all locks
from another transactions that are blocking the wait lock. */ from another transactions that are blocking the wait lock. */
if (trx->que_state == TRX_QUE_LOCK_WAIT) { if (trx->que_state == TRX_QUE_LOCK_WAIT) {
...@@ -1095,6 +1097,8 @@ fetch_data_into_cache( ...@@ -1095,6 +1097,8 @@ fetch_data_into_cache(
i_s_trx_row_t* trx_row; i_s_trx_row_t* trx_row;
i_s_locks_row_t* requested_lock_row; i_s_locks_row_t* requested_lock_row;
ut_ad(mutex_own(&kernel_mutex));
trx_i_s_cache_clear(cache); trx_i_s_cache_clear(cache);
/* We iterate over the list of all transactions and add each one /* We iterate over the list of all transactions and add each one
......
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