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