Commit 0c2b4951 authored by Marko Mäkelä's avatar Marko Mäkelä

Bug#57802 Empty ASSERTION parameter passed to the HASH_SEARCH macro

thr_local_validate(), i_s_locks_row_validate(): New validate
functions, used in UNIV_DEBUG code for checking the state of internal
memory structures.
parent 34eba1fa
2010-11-11 The InnoDB Team
* thr/thr0loc.c, trx/trx0i_s.c:
Fix Bug#57802 Empty ASSERTION parameter passed to the HASH_SEARCH macro
2010-11-10 The InnoDB Team
* dict/dict0dict.c, handler/handler0alter.cc, include/dict0dict.h
row/row0merge.c:
Fix Bug #55084 Innodb crash and corruption after alter table
Fix Bug#55084 InnoDB crash and corruption after ALTER TABLE
2010-11-10 The InnoDB Team
* srv/srv0start.c:
Fix Bug #48026 Log start and end of InnoDB buffer pool
Fix Bug#48026 Log start and end of InnoDB buffer pool
initialization to the error log
2010-11-03 The InnoDB Team
......
......@@ -71,6 +71,23 @@ struct thr_local_struct{
/** The value of thr_local_struct::magic_n */
#define THR_LOCAL_MAGIC_N 1231234
#ifdef UNIV_DEBUG
/*******************************************************************//**
Validates thread local data.
@return TRUE if valid */
static
ibool
thr_local_validate(
/*===============*/
const thr_local_t* local) /*!< in: data to validate */
{
ut_ad(local->magic_n == THR_LOCAL_MAGIC_N);
ut_ad(local->slot_no < OS_THREAD_MAX_N);
ut_ad(local->in_ibuf == FALSE || local->in_ibuf == TRUE);
return(TRUE);
}
#endif /* UNIV_DEBUG */
/*******************************************************************//**
Returns the local storage struct for a thread.
@return local storage */
......@@ -91,7 +108,8 @@ try_again:
local = NULL;
HASH_SEARCH(hash, thr_local_hash, os_thread_pf(id),
thr_local_t*, local,, os_thread_eq(local->id, id));
thr_local_t*, local, ut_ad(thr_local_validate(local)),
os_thread_eq(local->id, id));
if (local == NULL) {
mutex_exit(&thr_local_mutex);
......@@ -102,7 +120,7 @@ try_again:
goto try_again;
}
ut_ad(local->magic_n == THR_LOCAL_MAGIC_N);
ut_ad(thr_local_validate(local));
return(local);
}
......@@ -215,7 +233,8 @@ thr_local_free(
/* Look for the local struct in the hash table */
HASH_SEARCH(hash, thr_local_hash, os_thread_pf(id),
thr_local_t*, local,, os_thread_eq(local->id, id));
thr_local_t*, local, ut_ad(thr_local_validate(local)),
os_thread_eq(local->id, id));
if (local == NULL) {
mutex_exit(&thr_local_mutex);
......@@ -228,6 +247,7 @@ thr_local_free(
mutex_exit(&thr_local_mutex);
ut_a(local->magic_n == THR_LOCAL_MAGIC_N);
ut_ad(thr_local_validate(local));
mem_free(local);
}
......@@ -270,6 +290,7 @@ thr_local_close(void)
local = HASH_GET_NEXT(hash, prev_local);
ut_a(prev_local->magic_n == THR_LOCAL_MAGIC_N);
ut_ad(thr_local_validate(prev_local));
mem_free(prev_local);
}
}
......
......@@ -408,6 +408,42 @@ table_cache_create_empty_row(
return(row);
}
#ifdef UNIV_DEBUG
/*******************************************************************//**
Validates a row in the locks cache.
@return TRUE if valid */
static
ibool
i_s_locks_row_validate(
/*===================*/
const i_s_locks_row_t* row) /*!< in: row to validate */
{
ut_ad(row->lock_trx_id != 0);
ut_ad(row->lock_mode != NULL);
ut_ad(row->lock_type != NULL);
ut_ad(row->lock_table != NULL);
ut_ad(row->lock_table_id != 0);
if (row->lock_space == ULINT_UNDEFINED) {
/* table lock */
ut_ad(!strcmp("TABLE", row->lock_type));
ut_ad(row->lock_index == NULL);
ut_ad(row->lock_data == NULL);
ut_ad(row->lock_page == ULINT_UNDEFINED);
ut_ad(row->lock_rec == ULINT_UNDEFINED);
} else {
/* record lock */
ut_ad(!strcmp("RECORD", row->lock_type));
ut_ad(row->lock_index != NULL);
ut_ad(row->lock_data != NULL);
ut_ad(row->lock_page != ULINT_UNDEFINED);
ut_ad(row->lock_rec != ULINT_UNDEFINED);
}
return(TRUE);
}
#endif /* UNIV_DEBUG */
/*******************************************************************//**
Fills i_s_trx_row_t object.
If memory can not be allocated then FALSE is returned.
......@@ -435,18 +471,15 @@ fill_trx_row(
row->trx_id = trx_get_id(trx);
row->trx_started = (ib_time_t) trx->start_time;
row->trx_state = trx_get_que_state_str(trx);
row->requested_lock_row = requested_lock_row;
ut_ad(requested_lock_row == NULL
|| i_s_locks_row_validate(requested_lock_row));
if (trx->wait_lock != NULL) {
ut_a(requested_lock_row != NULL);
row->requested_lock_row = requested_lock_row;
row->trx_wait_started = (ib_time_t) trx->wait_started;
} else {
ut_a(requested_lock_row == NULL);
row->requested_lock_row = NULL;
row->trx_wait_started = 0;
}
......@@ -729,6 +762,7 @@ fill_locks_row(
row->lock_table_id = lock_get_table_id(lock);
row->hash_chain.value = row;
ut_ad(i_s_locks_row_validate(row));
return(TRUE);
}
......@@ -749,6 +783,9 @@ fill_lock_waits_row(
relevant blocking lock
row in innodb_locks */
{
ut_ad(i_s_locks_row_validate(requested_lock_row));
ut_ad(i_s_locks_row_validate(blocking_lock_row));
row->requested_lock_row = requested_lock_row;
row->blocking_lock_row = blocking_lock_row;
......@@ -820,6 +857,7 @@ locks_row_eq_lock(
or ULINT_UNDEFINED if the lock
is a table lock */
{
ut_ad(i_s_locks_row_validate(row));
#ifdef TEST_NO_LOCKS_ROW_IS_EVER_EQUAL_TO_LOCK_T
return(0);
#else
......@@ -877,7 +915,7 @@ search_innodb_locks(
/* auxiliary variable */
hash_chain,
/* assertion on every traversed item */
,
ut_ad(i_s_locks_row_validate(hash_chain->value)),
/* this determines if we have found the lock */
locks_row_eq_lock(hash_chain->value, lock, heap_no));
......@@ -917,6 +955,7 @@ add_lock_to_cache(
dst_row = search_innodb_locks(cache, lock, heap_no);
if (dst_row != NULL) {
ut_ad(i_s_locks_row_validate(dst_row));
return(dst_row);
}
#endif
......@@ -954,6 +993,7 @@ add_lock_to_cache(
} /* for()-loop */
#endif
ut_ad(i_s_locks_row_validate(dst_row));
return(dst_row);
}
......
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