Commit 5fc003b6 authored by marko's avatar marko

branches/zip: Make mutex_own() work with UNIV_DEBUG, without UNIV_SYNC_DEBUG.

parent ca662b43
......@@ -104,9 +104,7 @@ buf_buddy_alloc_zip(
{
buf_page_t* bpage;
#ifdef UNIV_SYNC_DEBUG
ut_a(mutex_own(&buf_pool->mutex));
#endif /* UNIV_SYNC_DEBUG */
ut_ad(mutex_own(&buf_pool->mutex));
ut_a(i < BUF_BUDDY_SIZES);
#if defined UNIV_DEBUG && !defined UNIV_DEBUG_VALGRIND
......@@ -158,10 +156,8 @@ buf_buddy_block_free(
buf_page_t* bpage;
buf_block_t* block;
#ifdef UNIV_SYNC_DEBUG
ut_a(mutex_own(&buf_pool->mutex));
ut_a(!mutex_own(&buf_pool->zip_mutex));
#endif /* UNIV_SYNC_DEBUG */
ut_ad(mutex_own(&buf_pool->mutex));
ut_ad(!mutex_own(&buf_pool->zip_mutex));
ut_a(!ut_align_offset(buf, UNIV_PAGE_SIZE));
HASH_SEARCH(hash, buf_pool->zip_hash, fold, bpage,
......@@ -188,10 +184,9 @@ buf_buddy_block_register(
buf_block_t* block) /* in: buffer frame to allocate */
{
const ulint fold = BUF_POOL_ZIP_FOLD(block);
#ifdef UNIV_SYNC_DEBUG
ut_a(mutex_own(&buf_pool->mutex));
ut_a(!mutex_own(&buf_pool->zip_mutex));
#endif /* UNIV_SYNC_DEBUG */
ut_ad(mutex_own(&buf_pool->mutex));
ut_ad(!mutex_own(&buf_pool->zip_mutex));
buf_block_set_state(block, BUF_BLOCK_MEMORY);
ut_a(block->frame);
......@@ -245,10 +240,8 @@ buf_buddy_alloc_clean(
{
buf_page_t* bpage;
#ifdef UNIV_SYNC_DEBUG
ut_a(mutex_own(&buf_pool->mutex));
ut_a(!mutex_own(&buf_pool->zip_mutex));
#endif /* UNIV_SYNC_DEBUG */
ut_ad(mutex_own(&buf_pool->mutex));
ut_ad(!mutex_own(&buf_pool->zip_mutex));
if (BUF_BUDDY_LOW << i >= PAGE_ZIP_MIN_SIZE
&& i < BUF_BUDDY_SIZES) {
......@@ -370,10 +363,8 @@ buf_buddy_alloc_low(
{
buf_block_t* block;
#ifdef UNIV_SYNC_DEBUG
ut_a(mutex_own(&buf_pool->mutex));
ut_a(!mutex_own(&buf_pool->zip_mutex));
#endif /* UNIV_SYNC_DEBUG */
ut_ad(mutex_own(&buf_pool->mutex));
ut_ad(!mutex_own(&buf_pool->zip_mutex));
if (i < BUF_BUDDY_SIZES) {
/* Try to allocate from the buddy system. */
......@@ -432,10 +423,8 @@ buf_buddy_relocate(
buf_page_t* bpage;
const ulint size = BUF_BUDDY_LOW << i;
#ifdef UNIV_SYNC_DEBUG
ut_a(mutex_own(&buf_pool->mutex));
ut_a(!mutex_own(&buf_pool->zip_mutex));
#endif /* UNIV_SYNC_DEBUG */
ut_ad(mutex_own(&buf_pool->mutex));
ut_ad(!mutex_own(&buf_pool->zip_mutex));
ut_ad(!ut_align_offset(src, size));
ut_ad(!ut_align_offset(dst, size));
#ifdef UNIV_DEBUG_VALGRIND
......@@ -570,10 +559,9 @@ buf_buddy_free_low(
{
buf_page_t* bpage;
buf_page_t* buddy;
#ifdef UNIV_SYNC_DEBUG
ut_a(mutex_own(&buf_pool->mutex));
ut_a(!mutex_own(&buf_pool->zip_mutex));
#endif /* UNIV_SYNC_DEBUG */
ut_ad(mutex_own(&buf_pool->mutex));
ut_ad(!mutex_own(&buf_pool->zip_mutex));
recombine:
#ifdef UNIV_DEBUG_VALGRIND
VALGRIND_CHECK_MEM_IS_ADDRESSABLE(buf, BUF_BUDDY_LOW << i);
......
......@@ -724,9 +724,7 @@ buf_chunk_contains_zip(
ulint i;
ut_ad(buf_pool);
#ifdef UNIV_SYNC_DEBUG
ut_a(mutex_own(&buf_pool->mutex));
#endif /* UNIV_SYNC_DEBUG */
ut_ad(mutex_own(&buf_pool->mutex));
block = chunk->blocks;
......@@ -780,9 +778,7 @@ buf_chunk_not_freed(
ulint i;
ut_ad(buf_pool);
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(buf_pool->mutex)));
#endif /* UNIV_SYNC_DEBUG */
block = chunk->blocks;
......@@ -815,9 +811,7 @@ buf_chunk_all_free(
ulint i;
ut_ad(buf_pool);
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(buf_pool->mutex)));
#endif /* UNIV_SYNC_DEBUG */
block = chunk->blocks;
......@@ -843,9 +837,7 @@ buf_chunk_free(
buf_block_t* block;
const buf_block_t* block_end;
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(buf_pool->mutex)));
#endif /* UNIV_SYNC_DEBUG */
block_end = chunk->blocks + chunk->size;
......@@ -975,10 +967,9 @@ buf_relocate(
{
buf_page_t* b;
ulint fold;
#ifdef UNIV_SYNC_DEBUG
ut_a(mutex_own(&buf_pool->mutex));
ut_a(mutex_own(buf_page_get_mutex(bpage)));
#endif /* UNIV_SYNC_DEBUG */
ut_ad(mutex_own(&buf_pool->mutex));
ut_ad(mutex_own(buf_page_get_mutex(bpage)));
ut_a(buf_page_get_io_fix(bpage) == BUF_IO_NONE);
ut_a(bpage->buf_fix_count == 0);
ut_a(buf_page_in_file(bpage));
......@@ -1027,9 +1018,7 @@ buf_pool_shrink(
buf_chunk_t* max_chunk;
buf_chunk_t* max_free_chunk;
#ifdef UNIV_SYNC_DEBUG
ut_ad(!mutex_own(&buf_pool->mutex));
#endif /* UNIV_SYNC_DEBUG */
try_again:
btr_search_disable(); /* Empty the adaptive hash index again */
......@@ -1318,9 +1307,7 @@ buf_block_make_young(
/*=================*/
buf_page_t* bpage) /* in: block to make younger */
{
#ifdef UNIV_SYNC_DEBUG
ut_ad(!mutex_own(&(buf_pool->mutex)));
#endif /* UNIV_SYNC_DEBUG */
/* Note that we read freed_page_clock's without holding any mutex:
this is allowed since the result is used only in heuristics */
......@@ -1933,10 +1920,9 @@ buf_page_init(
buf_block_t* block) /* in: block to init */
{
buf_page_t* hash_page;
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(buf_pool->mutex)));
ut_ad(mutex_own(&(block->mutex)));
#endif /* UNIV_SYNC_DEBUG */
ut_a(buf_block_get_state(block) != BUF_BLOCK_FILE_PAGE);
/* Set the state of the block */
......
......@@ -51,10 +51,7 @@ buf_flush_insert_into_flush_list(
/*=============================*/
buf_page_t* bpage) /* in: block which is modified */
{
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(buf_pool->mutex)));
#endif /* UNIV_SYNC_DEBUG */
ut_ad((UT_LIST_GET_FIRST(buf_pool->flush_list) == NULL)
|| (UT_LIST_GET_FIRST(buf_pool->flush_list)->oldest_modification
<= bpage->oldest_modification));
......@@ -99,9 +96,7 @@ buf_flush_insert_sorted_into_flush_list(
buf_page_t* prev_b;
buf_page_t* b;
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(buf_pool->mutex)));
#endif /* UNIV_SYNC_DEBUG */
switch (buf_page_get_state(bpage)) {
case BUF_BLOCK_ZIP_PAGE:
......@@ -157,10 +152,8 @@ buf_flush_ready_for_replace(
buf_page_t* bpage) /* in: buffer control block, must be
buf_page_in_file(bpage) and in the LRU list */
{
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(buf_pool->mutex)));
ut_ad(mutex_own(buf_page_get_mutex(bpage)));
#endif /* UNIV_SYNC_DEBUG */
ut_ad(bpage->in_LRU_list);
if (UNIV_LIKELY(buf_page_in_file(bpage))) {
......@@ -192,11 +185,8 @@ buf_flush_ready_for_flush(
enum buf_flush flush_type)/* in: BUF_FLUSH_LRU or BUF_FLUSH_LIST */
{
ut_a(buf_page_in_file(bpage));
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(buf_pool->mutex)));
ut_ad(mutex_own(buf_page_get_mutex(bpage)));
#endif /* UNIV_SYNC_DEBUG */
if (bpage->oldest_modification != 0
&& buf_page_get_io_fix(bpage) == BUF_IO_NONE) {
......@@ -227,11 +217,8 @@ buf_flush_remove(
/*=============*/
buf_page_t* bpage) /* in: pointer to the block in question */
{
#ifdef UNIV_SYNC_DEBUG
ut_a(mutex_own(&buf_pool->mutex));
ut_a(mutex_own(buf_page_get_mutex(bpage)));
#endif /* UNIV_SYNC_DEBUG */
ut_ad(mutex_own(&buf_pool->mutex));
ut_ad(mutex_own(buf_page_get_mutex(bpage)));
ut_ad(bpage->in_flush_list);
ut_d(bpage->in_flush_list = FALSE);
......
......@@ -226,9 +226,7 @@ buf_LRU_insert_zip_clean(
{
buf_page_t* b;
#ifdef UNIV_SYNC_DEBUG
ut_a(mutex_own(&buf_pool->mutex));
#endif /* UNIV_SYNC_DEBUG */
ut_ad(mutex_own(&buf_pool->mutex));
ut_ad(buf_page_get_state(bpage) == BUF_BLOCK_ZIP_PAGE);
/* Find the first successor of bpage in the LRU list
......@@ -374,9 +372,7 @@ buf_LRU_get_free_only(void)
{
buf_block_t* block;
#ifdef UNIV_SYNC_DEBUG
ut_a(mutex_own(&buf_pool->mutex));
#endif /* UNIV_SYNC_DEBUG */
ut_ad(mutex_own(&buf_pool->mutex));
block = (buf_block_t*) UT_LIST_GET_FIRST(buf_pool->free);
......@@ -601,9 +597,7 @@ buf_LRU_old_adjust_len(void)
ulint new_len;
ut_a(buf_pool->LRU_old);
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(buf_pool->mutex)));
#endif /* UNIV_SYNC_DEBUG */
ut_ad(3 * (BUF_LRU_OLD_MIN_LEN / 8) > BUF_LRU_OLD_TOLERANCE + 5);
for (;;) {
......@@ -645,9 +639,7 @@ buf_LRU_old_init(void)
{
buf_page_t* bpage;
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(buf_pool->mutex)));
#endif /* UNIV_SYNC_DEBUG */
ut_a(UT_LIST_GET_LEN(buf_pool->LRU) == BUF_LRU_OLD_MIN_LEN);
/* We first initialize all blocks in the LRU list as old and then use
......@@ -678,9 +670,7 @@ buf_LRU_remove_block(
{
ut_ad(buf_pool);
ut_ad(bpage);
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(buf_pool->mutex)));
#endif /* UNIV_SYNC_DEBUG */
ut_a(buf_page_in_file(bpage));
......@@ -740,9 +730,7 @@ buf_LRU_add_block_to_end_low(
ut_ad(buf_pool);
ut_ad(bpage);
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(buf_pool->mutex)));
#endif /* UNIV_SYNC_DEBUG */
ut_a(buf_page_in_file(bpage));
......@@ -798,9 +786,7 @@ buf_LRU_add_block_low(
{
ut_ad(buf_pool);
ut_ad(bpage);
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(buf_pool->mutex)));
#endif /* UNIV_SYNC_DEBUG */
ut_a(buf_page_in_file(bpage));
ut_ad(!bpage->in_LRU_list);
......@@ -904,11 +890,8 @@ buf_LRU_free_block(
buf_page_t* b = NULL;
mutex_t* block_mutex = buf_page_get_mutex(bpage);
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&buf_pool->mutex));
ut_ad(mutex_own(block_mutex));
#endif /* UNIV_SYNC_DEBUG */
ut_ad(buf_page_in_file(bpage));
ut_ad(bpage->in_LRU_list);
ut_ad(!bpage->in_flush_list == !bpage->oldest_modification);
......@@ -1072,10 +1055,9 @@ buf_LRU_block_free_non_file_page(
buf_block_t* block) /* in: block, must not contain a file page */
{
void* data;
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(buf_pool->mutex)));
ut_ad(mutex_own(&block->mutex));
#endif /* UNIV_SYNC_DEBUG */
ut_ad(block);
switch (buf_block_get_state(block)) {
......@@ -1141,10 +1123,8 @@ buf_LRU_block_remove_hashed_page(
{
const buf_page_t* hashed_bpage;
ut_ad(bpage);
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(buf_pool->mutex)));
ut_ad(mutex_own(buf_page_get_mutex(bpage)));
#endif /* UNIV_SYNC_DEBUG */
ut_a(buf_page_get_io_fix(bpage) == BUF_IO_NONE);
ut_a(bpage->buf_fix_count == 0);
......@@ -1298,10 +1278,9 @@ buf_LRU_block_free_hashed_page(
buf_block_t* block) /* in: block, must contain a file page and
be in a state where it can be freed */
{
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(buf_pool->mutex)));
ut_ad(mutex_own(&block->mutex));
#endif /* UNIV_SYNC_DEBUG */
buf_block_set_state(block, BUF_BLOCK_MEMORY);
buf_LRU_block_free_non_file_page(block);
......
......@@ -86,9 +86,7 @@ dict_hdr_flush_row_id(void)
dulint id;
mtr_t mtr;
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(dict_sys->mutex)));
#endif /* UNIV_SYNC_DEBUG */
id = dict_sys->row_id;
......
......@@ -219,9 +219,7 @@ dict_build_table_def_step(
ulint i;
ulint row_len;
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(dict_sys->mutex)));
#endif /* UNIV_SYNC_DEBUG */
table = node->table;
......@@ -325,9 +323,7 @@ dict_create_sys_indexes_tuple(
dfield_t* dfield;
byte* ptr;
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(dict_sys->mutex)));
#endif /* UNIV_SYNC_DEBUG */
ut_ad(index && heap);
sys_indexes = dict_sys->sys_indexes;
......@@ -525,9 +521,7 @@ dict_build_index_def_step(
dtuple_t* row;
trx_t* trx;
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(dict_sys->mutex)));
#endif /* UNIV_SYNC_DEBUG */
trx = thr_get_trx(thr);
......@@ -598,9 +592,7 @@ dict_create_index_tree_step(
btr_pcur_t pcur;
mtr_t mtr;
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(dict_sys->mutex)));
#endif /* UNIV_SYNC_DEBUG */
index = node->index;
table = node->table;
......@@ -657,10 +649,7 @@ dict_drop_index_tree(
const byte* ptr;
ulint len;
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(dict_sys->mutex)));
#endif /* UNIV_SYNC_DEBUG */
ut_a(!dict_table_is_comp(dict_sys->sys_indexes));
ptr = rec_get_nth_field_old(rec, DICT_SYS_INDEXES_PAGE_NO_FIELD, &len);
......@@ -735,10 +724,7 @@ dict_truncate_index_tree(
ulint comp;
dict_index_t* index;
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(dict_sys->mutex)));
#endif /* UNIV_SYNC_DEBUG */
ut_a(!dict_table_is_comp(dict_sys->sys_indexes));
rec = btr_pcur_get_rec(pcur);
ptr = rec_get_nth_field_old(rec, DICT_SYS_INDEXES_PAGE_NO_FIELD, &len);
......@@ -925,9 +911,7 @@ dict_create_table_step(
trx_t* trx;
ut_ad(thr);
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(dict_sys->mutex)));
#endif /* UNIV_SYNC_DEBUG */
trx = thr_get_trx(thr);
......@@ -1034,9 +1018,7 @@ dict_create_index_step(
trx_t* trx;
ut_ad(thr);
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(dict_sys->mutex)));
#endif /* UNIV_SYNC_DEBUG */
trx = thr_get_trx(thr);
......@@ -1468,9 +1450,7 @@ dict_create_add_foreigns_to_dictionary(
ulint number = start_id + 1;
ulint error;
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(dict_sys->mutex)));
#endif /* UNIV_SYNC_DEBUG */
if (NULL == dict_table_get_low("SYS_FOREIGN")) {
fprintf(stderr,
......
......@@ -682,9 +682,7 @@ dict_table_get_on_id(
if we are doing a rollback to handle an error in TABLE
CREATE, for example, we already have the mutex! */
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(dict_sys->mutex)));
#endif /* UNIV_SYNC_DEBUG */
return(dict_table_get_on_id_low(table_id));
}
......@@ -894,9 +892,8 @@ dict_table_add_to_cache(
/* The lower limit for what we consider a "big" row */
#define BIG_ROW_SIZE 1024
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(dict_sys->mutex)));
#endif /* UNIV_SYNC_DEBUG */
dict_table_add_system_columns(table);
table->cached = TRUE;
......@@ -1007,9 +1004,7 @@ dict_table_rename_in_cache(
ibool success;
ut_ad(table);
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(dict_sys->mutex)));
#endif /* UNIV_SYNC_DEBUG */
old_size = mem_heap_get_size(table->heap);
......@@ -1213,9 +1208,7 @@ dict_table_change_id_in_cache(
dulint new_id) /* in: new id to set */
{
ut_ad(table);
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(dict_sys->mutex)));
#endif /* UNIV_SYNC_DEBUG */
ut_ad(table->magic_n == DICT_TABLE_MAGIC_N);
/* Remove the table from the hash table of id's */
......@@ -1242,9 +1235,7 @@ dict_table_remove_from_cache(
ulint size;
ut_ad(table);
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(dict_sys->mutex)));
#endif /* UNIV_SYNC_DEBUG */
ut_ad(table->magic_n == DICT_TABLE_MAGIC_N);
#if 0
......@@ -1358,9 +1349,7 @@ dict_index_add_to_cache(
ulint i;
ut_ad(index);
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(dict_sys->mutex)));
#endif /* UNIV_SYNC_DEBUG */
ut_ad(index->n_def == index->n_fields);
ut_ad(index->magic_n == DICT_INDEX_MAGIC_N);
......@@ -1456,9 +1445,7 @@ dict_index_remove_from_cache(
ut_ad(table && index);
ut_ad(table->magic_n == DICT_TABLE_MAGIC_N);
ut_ad(index->magic_n == DICT_INDEX_MAGIC_N);
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(dict_sys->mutex)));
#endif /* UNIV_SYNC_DEBUG */
rw_lock_free(&index->lock);
......@@ -1488,9 +1475,7 @@ dict_index_find_cols(
ut_ad(table && index);
ut_ad(table->magic_n == DICT_TABLE_MAGIC_N);
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(dict_sys->mutex)));
#endif /* UNIV_SYNC_DEBUG */
for (i = 0; i < index->n_fields; i++) {
ulint j;
......@@ -1651,9 +1636,7 @@ dict_index_build_internal_clust(
ut_ad(table && index);
ut_ad(dict_index_is_clust(index));
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(dict_sys->mutex)));
#endif /* UNIV_SYNC_DEBUG */
ut_ad(table->magic_n == DICT_TABLE_MAGIC_N);
/* Create a new index object with certainly enough fields */
......@@ -1805,9 +1788,7 @@ dict_index_build_internal_non_clust(
ut_ad(table && index);
ut_ad(!dict_index_is_clust(index));
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(dict_sys->mutex)));
#endif /* UNIV_SYNC_DEBUG */
ut_ad(table->magic_n == DICT_TABLE_MAGIC_N);
/* The clustered index should be the first in the list of indexes */
......@@ -1920,9 +1901,7 @@ dict_foreign_remove_from_cache(
/*===========================*/
dict_foreign_t* foreign) /* in, own: foreign constraint */
{
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(dict_sys->mutex)));
#endif /* UNIV_SYNC_DEBUG */
ut_a(foreign);
if (foreign->referenced_table) {
......@@ -1954,9 +1933,7 @@ dict_foreign_find(
{
dict_foreign_t* foreign;
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(dict_sys->mutex)));
#endif /* UNIV_SYNC_DEBUG */
foreign = UT_LIST_GET_FIRST(table->foreign_list);
......@@ -2115,9 +2092,7 @@ dict_foreign_add_to_cache(
ibool added_to_referenced_list= FALSE;
FILE* ef = dict_foreign_err_file;
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(dict_sys->mutex)));
#endif /* UNIV_SYNC_DEBUG */
for_table = dict_table_check_if_in_cache_low(
foreign->foreign_table_name);
......@@ -2796,9 +2771,7 @@ dict_create_foreign_constraints_low(
const char* column_names[500];
const char* referenced_table_name;
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(dict_sys->mutex)));
#endif /* UNIV_SYNC_DEBUG */
table = dict_table_get_low(name);
......@@ -3427,9 +3400,7 @@ dict_foreign_parse_drop_constraints(
str = dict_strip_comments(*(trx->mysql_query_str));
ptr = str;
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(dict_sys->mutex)));
#endif /* UNIV_SYNC_DEBUG */
loop:
ptr = dict_scan_to(ptr, "DROP");
......@@ -3538,9 +3509,7 @@ dict_index_get_if_in_cache_low(
/* out: index, NULL if not found */
dulint index_id) /* in: index id */
{
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(dict_sys->mutex)));
#endif /* UNIV_SYNC_DEBUG */
return(dict_index_find_on_id_low(index_id));
}
......@@ -3883,9 +3852,7 @@ dict_foreign_print_low(
{
ulint i;
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(dict_sys->mutex)));
#endif /* UNIV_SYNC_DEBUG */
fprintf(stderr, " FOREIGN KEY CONSTRAINT %s: %s (",
foreign->id, foreign->foreign_table_name);
......@@ -3950,9 +3917,7 @@ dict_table_print_low(
dict_foreign_t* foreign;
ulint i;
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(dict_sys->mutex)));
#endif /* UNIV_SYNC_DEBUG */
dict_update_statistics_low(table, TRUE);
......@@ -4008,9 +3973,7 @@ dict_col_print_low(
{
dtype_t type;
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(dict_sys->mutex)));
#endif /* UNIV_SYNC_DEBUG */
dict_col_copy_type(col, &type);
fprintf(stderr, "%s: ", dict_table_get_col_name(table,
......@@ -4030,9 +3993,7 @@ dict_index_print_low(
ib_longlong n_vals;
ulint i;
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(dict_sys->mutex)));
#endif /* UNIV_SYNC_DEBUG */
if (index->n_user_defined_cols > 0) {
n_vals = index->stat_n_diff_key_vals[
......@@ -4080,9 +4041,8 @@ dict_field_print_low(
/*=================*/
dict_field_t* field) /* in: field */
{
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(dict_sys->mutex)));
#endif /* UNIV_SYNC_DEBUG */
fprintf(stderr, " %s", field->name);
if (field->prefix_len != 0) {
......
......@@ -67,9 +67,7 @@ dict_get_first_table_name_in_db(
ulint len;
mtr_t mtr;
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(dict_sys->mutex)));
#endif /* UNIV_SYNC_DEBUG */
heap = mem_heap_create(1000);
......@@ -397,9 +395,7 @@ dict_load_columns(
ulint i;
mtr_t mtr;
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(dict_sys->mutex)));
#endif /* UNIV_SYNC_DEBUG */
mtr_start(&mtr);
......@@ -522,11 +518,7 @@ dict_load_fields(
ulint i;
mtr_t mtr;
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(dict_sys->mutex)));
#endif /* UNIV_SYNC_DEBUG */
UT_NOT_USED(table);
mtr_start(&mtr);
......@@ -630,9 +622,7 @@ dict_load_indexes(
dulint id;
mtr_t mtr;
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(dict_sys->mutex)));
#endif /* UNIV_SYNC_DEBUG */
if ((ut_dulint_get_high(table->id) == 0)
&& (ut_dulint_get_low(table->id) < DICT_HDR_FIRST_ID)) {
......@@ -799,9 +789,7 @@ dict_load_table(
ulint zip_size_in_k;
mtr_t mtr;
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(dict_sys->mutex)));
#endif /* UNIV_SYNC_DEBUG */
heap = mem_heap_create(1000);
......@@ -973,9 +961,7 @@ dict_load_table_on_id(
dict_table_t* table;
mtr_t mtr;
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(dict_sys->mutex)));
#endif /* UNIV_SYNC_DEBUG */
/* NOTE that the operation of this function is protected by
the dictionary mutex, and therefore no deadlocks can occur
......@@ -1056,9 +1042,7 @@ dict_load_sys_table(
{
mem_heap_t* heap;
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(dict_sys->mutex)));
#endif /* UNIV_SYNC_DEBUG */
heap = mem_heap_create(1000);
......@@ -1089,9 +1073,7 @@ dict_load_foreign_cols(
ulint i;
mtr_t mtr;
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(dict_sys->mutex)));
#endif /* UNIV_SYNC_DEBUG */
foreign->foreign_col_names = mem_heap_alloc(
foreign->heap, foreign->n_fields * sizeof(void*));
......@@ -1167,9 +1149,7 @@ dict_load_foreign(
ulint n_fields_and_type;
mtr_t mtr;
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(dict_sys->mutex)));
#endif /* UNIV_SYNC_DEBUG */
heap2 = mem_heap_create(1000);
......@@ -1297,9 +1277,7 @@ dict_load_foreigns(
ulint err;
mtr_t mtr;
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(dict_sys->mutex)));
#endif /* UNIV_SYNC_DEBUG */
sys_foreign = dict_table_get_low("SYS_FOREIGN");
......
......@@ -477,9 +477,7 @@ fil_space_is_flushed(
{
fil_node_t* node;
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(fil_system->mutex)));
#endif /* UNIV_SYNC_DEBUG */
node = UT_LIST_GET_FIRST(space->chain);
......@@ -583,9 +581,7 @@ fil_node_open_file(
ulint zip_size;
#endif /* !UNIV_HOTBACKUP */
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(system->mutex)));
#endif /* UNIV_SYNC_DEBUG */
ut_a(node->n_pending == 0);
ut_a(node->open == FALSE);
......@@ -743,9 +739,7 @@ fil_node_close_file(
ibool ret;
ut_ad(node && system);
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(system->mutex)));
#endif /* UNIV_SYNC_DEBUG */
ut_a(node->open);
ut_a(node->n_pending == 0);
ut_a(node->n_pending_flushes == 0);
......@@ -788,9 +782,8 @@ fil_try_to_close_file_in_LRU(
fil_system_t* system = fil_system;
fil_node_t* node;
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(system->mutex)));
#endif /* UNIV_SYNC_DEBUG */
node = UT_LIST_GET_LAST(system->LRU);
if (print_info) {
......@@ -848,9 +841,7 @@ fil_mutex_enter_and_prepare_for_io(
ulint count = 0;
ulint count2 = 0;
#ifdef UNIV_SYNC_DEBUG
ut_ad(!mutex_own(&(system->mutex)));
#endif /* UNIV_SYNC_DEBUG */
retry:
mutex_enter(&(system->mutex));
......@@ -964,9 +955,7 @@ fil_node_free(
fil_space_t* space) /* in: space where the file node is chained */
{
ut_ad(node && system && space);
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(system->mutex)));
#endif /* UNIV_SYNC_DEBUG */
ut_a(node->magic_n == FIL_NODE_MAGIC_N);
ut_a(node->n_pending == 0);
......@@ -4080,9 +4069,7 @@ fil_node_prepare_for_io(
fil_space_t* space) /* in: space */
{
ut_ad(node && system && space);
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(system->mutex)));
#endif /* UNIV_SYNC_DEBUG */
if (system->n_open > system->max_n_open + 5) {
ut_print_timestamp(stderr);
......@@ -4127,9 +4114,7 @@ fil_node_complete_io(
{
ut_ad(node);
ut_ad(system);
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(system->mutex)));
#endif /* UNIV_SYNC_DEBUG */
ut_a(node->n_pending > 0);
......
......@@ -2183,10 +2183,8 @@ fseg_create_general(
header = byte_offset + buf_block_get_frame(block);
}
#ifdef UNIV_SYNC_DEBUG
ut_ad(!mutex_own(&kernel_mutex)
|| mtr_memo_contains(mtr, latch, MTR_MEMO_X_LOCK));
#endif /* UNIV_SYNC_DEBUG */
mtr_x_lock(latch, mtr);
......@@ -2341,11 +2339,10 @@ fseg_n_reserved_pages(
space = page_get_space_id(page_align(header));
#ifdef UNIV_SYNC_DEBUG
ut_ad(!mutex_own(&kernel_mutex)
|| mtr_memo_contains(mtr, fil_space_get_latch(space, NULL),
MTR_MEMO_X_LOCK));
#endif /* UNIV_SYNC_DEBUG */
mtr_x_lock(fil_space_get_latch(space, &zip_size), mtr);
inode = fseg_inode_get(header, space, zip_size, mtr);
......@@ -2754,10 +2751,8 @@ fseg_alloc_free_page_general(
latch = fil_space_get_latch(space, &zip_size);
#ifdef UNIV_SYNC_DEBUG
ut_ad(!mutex_own(&kernel_mutex)
|| mtr_memo_contains(mtr, latch, MTR_MEMO_X_LOCK));
#endif /* UNIV_SYNC_DEBUG */
mtr_x_lock(latch, mtr);
......@@ -2906,10 +2901,8 @@ fsp_reserve_free_extents(
*n_reserved = n_ext;
latch = fil_space_get_latch(space, &zip_size);
#ifdef UNIV_SYNC_DEBUG
ut_ad(!mutex_own(&kernel_mutex)
|| mtr_memo_contains(mtr, latch, MTR_MEMO_X_LOCK));
#endif /* UNIV_SYNC_DEBUG */
mtr_x_lock(latch, mtr);
......@@ -3010,9 +3003,8 @@ fsp_get_available_space_in_free_extents(
rw_lock_t* latch;
mtr_t mtr;
#ifdef UNIV_SYNC_DEBUG
ut_ad(!mutex_own(&kernel_mutex));
#endif /* UNIV_SYNC_DEBUG */
mtr_start(&mtr);
latch = fil_space_get_latch(space, &zip_size);
......@@ -3285,11 +3277,10 @@ fseg_free_page(
ulint zip_size;
fseg_inode_t* seg_inode;
#ifdef UNIV_SYNC_DEBUG
ut_ad(!mutex_own(&kernel_mutex)
|| mtr_memo_contains(mtr, fil_space_get_latch(space, NULL),
MTR_MEMO_X_LOCK));
#endif /* UNIV_SYNC_DEBUG */
mtr_x_lock(fil_space_get_latch(space, &zip_size), mtr);
seg_inode = fseg_inode_get(seg_header, space, zip_size, mtr);
......@@ -3399,11 +3390,10 @@ fseg_free_step(
space = page_get_space_id(page_align(header));
header_page = page_get_page_no(page_align(header));
#ifdef UNIV_SYNC_DEBUG
ut_ad(!mutex_own(&kernel_mutex)
|| mtr_memo_contains(mtr, fil_space_get_latch(space, NULL),
MTR_MEMO_X_LOCK));
#endif /* UNIV_SYNC_DEBUG */
mtr_x_lock(fil_space_get_latch(space, &zip_size), mtr);
descr = xdes_get_descriptor(space, zip_size, header_page, mtr);
......@@ -3475,11 +3465,10 @@ fseg_free_step_not_header(
space = page_get_space_id(page_align(header));
#ifdef UNIV_SYNC_DEBUG
ut_ad(!mutex_own(&kernel_mutex)
|| mtr_memo_contains(mtr, fil_space_get_latch(space, NULL),
MTR_MEMO_X_LOCK));
#endif /* UNIV_SYNC_DEBUG */
mtr_x_lock(fil_space_get_latch(space, &zip_size), mtr);
inode = fseg_inode_get(header, space, zip_size, mtr);
......
......@@ -122,9 +122,8 @@ ha_insert_for_fold_func(
ut_ad(table && data);
ut_ad(block->frame == page_align(data));
#ifdef UNIV_SYNC_DEBUG
ut_ad(!table->mutexes || mutex_own(hash_get_mutex(table, fold)));
#endif /* UNIV_SYNC_DEBUG */
hash = hash_calc_hash(fold, table);
cell = hash_get_nth_cell(table, hash);
......@@ -228,9 +227,8 @@ ha_delete(
{
ha_node_t* node;
#ifdef UNIV_SYNC_DEBUG
ut_ad(!table->mutexes || mutex_own(hash_get_mutex(table, fold)));
#endif /* UNIV_SYNC_DEBUG */
node = ha_search_with_data(table, fold, data);
ut_a(node);
......@@ -255,9 +253,7 @@ ha_search_and_update_if_found_func(
{
ha_node_t* node;
#ifdef UNIV_SYNC_DEBUG
ut_ad(!table->mutexes || mutex_own(hash_get_mutex(table, fold)));
#endif /* UNIV_SYNC_DEBUG */
ut_ad(new_block->frame == page_align(new_data));
node = ha_search_with_data(table, fold, data);
......@@ -289,9 +285,8 @@ ha_remove_all_nodes_to_page(
{
ha_node_t* node;
#ifdef UNIV_SYNC_DEBUG
ut_ad(!table->mutexes || mutex_own(hash_get_mutex(table, fold)));
#endif /* UNIV_SYNC_DEBUG */
node = ha_chain_get_first(table, fold);
while (node) {
......
......@@ -419,9 +419,7 @@ ibuf_data_sizes_update(
{
ulint old_size;
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&ibuf_mutex));
#endif /* UNIV_SYNC_DEBUG */
old_size = data->size;
......@@ -1613,9 +1611,7 @@ ibuf_data_enough_free_for_insert(
/* out: TRUE if enough free pages in list */
ibuf_data_t* data) /* in: ibuf data for the space */
{
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&ibuf_mutex));
#endif /* UNIV_SYNC_DEBUG */
/* We want a big margin of free pages, because a B-tree can sometimes
grow in size also if records are deleted from it, as the node pointers
......@@ -1641,16 +1637,9 @@ ibuf_data_too_much_free(
/* out: TRUE if enough free pages in list */
ibuf_data_t* data) /* in: ibuf data for the space */
{
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&ibuf_mutex));
#endif /* UNIV_SYNC_DEBUG */
if (data->free_list_len >= 3 + data->size / 2 + 3 * data->height) {
return(TRUE);
}
return(FALSE);
return(data->free_list_len >= 3 + data->size / 2 + 3 * data->height);
}
/*************************************************************************
......@@ -3547,9 +3536,7 @@ ibuf_validate_low(void)
ibuf_data_t* data;
ulint sum_sizes;
# ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&ibuf_mutex));
# endif /* UNIV_SYNC_DEBUG */
sum_sizes = 0;
......
......@@ -14,9 +14,7 @@ Created December 2006 by Marko Makela
#include "buf0buf.h"
#include "buf0buddy.h"
#include "ut0ut.h"
#ifdef UNIV_SYNC_DEBUG
# include "sync0sync.h"
#endif /* UNIV_SYNC_DEBUG */
#include "sync0sync.h"
/**************************************************************************
Allocate a block. */
......@@ -71,9 +69,7 @@ buf_buddy_alloc(
ulint size, /* in: block size, up to UNIV_PAGE_SIZE */
ibool lru) /* in: TRUE=allocate from the LRU list if needed */
{
#ifdef UNIV_SYNC_DEBUG
ut_a(mutex_own(&buf_pool->mutex));
#endif /* UNIV_SYNC_DEBUG */
ut_ad(mutex_own(&buf_pool->mutex));
return(buf_buddy_alloc_low(buf_buddy_get_slot(size), lru));
}
......@@ -88,9 +84,7 @@ buf_buddy_free(
pointed to by the buffer pool */
ulint size) /* in: block size, up to UNIV_PAGE_SIZE */
{
#ifdef UNIV_SYNC_DEBUG
ut_a(mutex_own(&buf_pool->mutex));
#endif /* UNIV_SYNC_DEBUG */
ut_ad(mutex_own(&buf_pool->mutex));
buf_buddy_free_low(buf, buf_buddy_get_slot(size));
}
......
......@@ -101,9 +101,7 @@ buf_pool_clock_tic(void)
/*====================*/
/* out: new clock value */
{
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(buf_pool->mutex)));
#endif /* UNIV_SYNC_DEBUG */
buf_pool->ulint_clock++;
......@@ -367,10 +365,9 @@ buf_page_set_io_fix(
buf_page_t* bpage, /* in/out: control block */
enum buf_io_fix io_fix) /* in: io_fix state */
{
#ifdef UNIV_SYNC_DEBUG
ut_a(mutex_own(&buf_pool->mutex));
ut_a(mutex_own(buf_page_get_mutex(bpage)));
#endif /* UNIV_SYNC_DEBUG */
ut_ad(mutex_own(&buf_pool->mutex));
ut_ad(mutex_own(buf_page_get_mutex(bpage)));
bpage->io_fix = io_fix;
ut_ad(buf_page_get_io_fix(bpage) == io_fix);
}
......@@ -396,10 +393,8 @@ buf_page_can_relocate(
/*==================*/
const buf_page_t* bpage) /* control block being relocated */
{
#ifdef UNIV_SYNC_DEBUG
ut_a(mutex_own(&buf_pool->mutex));
ut_a(mutex_own(buf_page_get_mutex((buf_page_t*) bpage)));
#endif /* UNIV_SYNC_DEBUG */
ut_ad(mutex_own(&buf_pool->mutex));
ut_ad(mutex_own(buf_page_get_mutex((buf_page_t*) bpage)));
ut_ad(buf_page_in_file(bpage));
ut_ad(bpage->in_LRU_list);
......@@ -431,9 +426,7 @@ buf_page_set_old(
ibool old) /* in: old */
{
ut_a(buf_page_in_file(bpage));
#ifdef UNIV_SYNC_DEBUG
ut_a(mutex_own(&buf_pool->mutex));
#endif /* UNIV_SYNC_DEBUG */
ut_ad(mutex_own(&buf_pool->mutex));
bpage->old = old;
}
......@@ -462,9 +455,7 @@ buf_page_set_accessed(
ibool accessed) /* in: accessed */
{
ut_a(buf_page_in_file(bpage));
#ifdef UNIV_SYNC_DEBUG
ut_a(mutex_own(buf_page_get_mutex(bpage)));
#endif /* UNIV_SYNC_DEBUG */
ut_ad(mutex_own(buf_page_get_mutex(bpage)));
bpage->accessed = accessed;
}
......@@ -853,8 +844,9 @@ buf_block_buf_fix_inc_func(
ret = rw_lock_s_lock_func_nowait(&(block->debug_latch), file, line);
ut_a(ret);
ut_a(mutex_own(&block->mutex));
#endif /* UNIV_SYNC_DEBUG */
ut_ad(mutex_own(&block->mutex));
block->page.buf_fix_count++;
}
#ifdef UNIV_SYNC_DEBUG
......@@ -877,9 +869,7 @@ buf_page_hash_get(
ulint fold;
ut_ad(buf_pool);
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(buf_pool->mutex)));
#endif /* UNIV_SYNC_DEBUG */
/* Look for the page in the hash table */
......
......@@ -35,8 +35,8 @@ buf_flush_note_modification(
ut_ad(block->page.buf_fix_count > 0);
#ifdef UNIV_SYNC_DEBUG
ut_ad(rw_lock_own(&(block->lock), RW_LOCK_EX));
ut_ad(mutex_own(&(buf_pool->mutex)));
#endif /* UNIV_SYNC_DEBUG */
ut_ad(mutex_own(&(buf_pool->mutex)));
ut_ad(mtr->start_lsn != 0);
ut_ad(mtr->modifications);
......
......@@ -585,9 +585,7 @@ dict_table_check_if_in_cache_low(
ulint table_fold;
ut_ad(table_name);
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(dict_sys->mutex)));
#endif /* UNIV_SYNC_DEBUG */
/* Look for the table name in the hash table */
table_fold = ut_fold_string(table_name);
......@@ -610,9 +608,7 @@ dict_table_get_low(
dict_table_t* table;
ut_ad(table_name);
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(dict_sys->mutex)));
#endif /* UNIV_SYNC_DEBUG */
table = dict_table_check_if_in_cache_low(table_name);
......@@ -635,9 +631,7 @@ dict_table_get_on_id_low(
dict_table_t* table;
ulint fold;
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(dict_sys->mutex)));
#endif /* UNIV_SYNC_DEBUG */
/* Look for the table name in the hash table */
fold = ut_fold_dulint(table_id);
......
......@@ -93,9 +93,7 @@ ha_search(
{
ha_node_t* node;
#ifdef UNIV_SYNC_DEBUG
ut_ad(!table->mutexes || mutex_own(hash_get_mutex(table, fold)));
#endif /* UNIV_SYNC_DEBUG */
node = ha_chain_get_first(table, fold);
......@@ -125,9 +123,7 @@ ha_search_and_get_data(
{
ha_node_t* node;
#ifdef UNIV_SYNC_DEBUG
ut_ad(!table->mutexes || mutex_own(hash_get_mutex(table, fold)));
#endif /* UNIV_SYNC_DEBUG */
node = ha_chain_get_first(table, fold);
......@@ -157,9 +153,7 @@ ha_search_with_data(
{
ha_node_t* node;
#ifdef UNIV_SYNC_DEBUG
ut_ad(!table->mutexes || mutex_own(hash_get_mutex(table, fold)));
#endif /* UNIV_SYNC_DEBUG */
node = ha_chain_get_first(table, fold);
......@@ -189,9 +183,7 @@ ha_search_and_delete_if_found(
{
ha_node_t* node;
#ifdef UNIV_SYNC_DEBUG
ut_ad(!table->mutexes || mutex_own(hash_get_mutex(table, fold)));
#endif /* UNIV_SYNC_DEBUG */
node = ha_search_with_data(table, fold, data);
......
......@@ -65,9 +65,7 @@ lock_clust_rec_some_has_impl(
{
dulint trx_id;
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
#endif /* UNIV_SYNC_DEBUG */
ut_ad(dict_index_is_clust(index));
ut_ad(page_rec_is_user_rec(rec));
......
......@@ -248,9 +248,7 @@ log_block_init(
{
ulint no;
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(log_sys->mutex)));
#endif /* UNIV_SYNC_DEBUG */
no = log_block_convert_lsn_to_no(lsn);
......@@ -272,9 +270,7 @@ log_block_init_in_old_format(
{
ulint no;
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(log_sys->mutex)));
#endif /* UNIV_SYNC_DEBUG */
no = log_block_convert_lsn_to_no(lsn);
......
......@@ -133,9 +133,8 @@ rw_lock_s_lock_low(
const char* file_name, /* in: file name where lock requested */
ulint line) /* in: line where requested */
{
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(rw_lock_get_mutex(lock)));
#endif /* UNIV_SYNC_DEBUG */
/* Check if the writer field is free */
if (UNIV_LIKELY(lock->writer == RW_LOCK_NOT_LOCKED)) {
......
......@@ -169,7 +169,16 @@ Checks that the mutex has been initialized. */
ibool
mutex_validate(
/*===========*/
mutex_t* mutex);
const mutex_t* mutex);
/**********************************************************************
Checks that the current thread owns the mutex. Works only
in the debug version. */
ibool
mutex_own(
/*======*/
/* out: TRUE if owns */
const mutex_t* mutex); /* in: mutex */
#endif /* UNIV_DEBUG */
#ifdef UNIV_SYNC_DEBUG
/**********************************************************************
......@@ -214,15 +223,6 @@ sync_thread_levels_empty_gen(
also purge_is_running mutex is
allowed */
/**********************************************************************
Checks that the current thread owns the mutex. Works only
in the debug version. */
ibool
mutex_own(
/*======*/
/* out: TRUE if owns */
mutex_t* mutex); /* in: mutex */
/**********************************************************************
Gets the debug information for a reserved mutex. */
void
......@@ -247,7 +247,7 @@ UNIV_INLINE
ulint
mutex_get_lock_word(
/*================*/
mutex_t* mutex); /* in: mutex */
const mutex_t* mutex); /* in: mutex */
#ifdef UNIV_SYNC_DEBUG
/**********************************************************************
NOT to be used outside this module except in debugging! Gets the waiters
......@@ -257,7 +257,7 @@ ulint
mutex_get_waiters(
/*==============*/
/* out: value to set */
mutex_t* mutex); /* in: mutex */
const mutex_t* mutex); /* in: mutex */
#endif /* UNIV_SYNC_DEBUG */
/*
......@@ -479,13 +479,13 @@ struct mutex_struct {
#ifdef UNIV_SYNC_DEBUG
const char* file_name; /* File where the mutex was locked */
ulint line; /* Line where the mutex was locked */
os_thread_id_t thread_id; /* Debug version: The thread id of the
thread which locked the mutex. */
ulint level; /* Level in the global latching order */
#endif /* UNIV_SYNC_DEBUG */
const char* cfile_name;/* File name where mutex created */
ulint cline; /* Line where created */
#ifdef UNIV_DEBUG
os_thread_id_t thread_id; /* The thread id of the thread
which locked the mutex. */
ulint magic_n;
# define MUTEX_MAGIC_N (ulint)979585
#endif /* UNIV_DEBUG */
......
......@@ -168,9 +168,9 @@ UNIV_INLINE
ulint
mutex_get_lock_word(
/*================*/
mutex_t* mutex) /* in: mutex */
const mutex_t* mutex) /* in: mutex */
{
volatile ulint* ptr; /* declared volatile to ensure that
const volatile ulint* ptr; /* declared volatile to ensure that
lock_word is loaded from memory */
ut_ad(mutex);
......@@ -186,9 +186,9 @@ ulint
mutex_get_waiters(
/*==============*/
/* out: value to set */
mutex_t* mutex) /* in: mutex */
const mutex_t* mutex) /* in: mutex */
{
volatile ulint* ptr; /* declared volatile to ensure that
const volatile ulint* ptr; /* declared volatile to ensure that
the value is read from memory */
ut_ad(mutex);
......@@ -206,11 +206,11 @@ mutex_exit(
/*=======*/
mutex_t* mutex) /* in: pointer to mutex */
{
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(mutex));
mutex->thread_id = ULINT_UNDEFINED;
ut_d(mutex->thread_id = ULINT_UNDEFINED);
#ifdef UNIV_SYNC_DEBUG
sync_thread_reset_level(mutex);
#endif
mutex_reset_lock_word(mutex);
......@@ -259,6 +259,7 @@ mutex_enter_func(
#endif /* UNIV_DEBUG && !UNIV_HOTBACKUP */
if (!mutex_test_and_set(mutex)) {
ut_d(mutex->thread_id = os_thread_get_curr_id());
#ifdef UNIV_SYNC_DEBUG
mutex_set_debug_info(mutex, file_name, line);
#endif
......
......@@ -62,9 +62,7 @@ trx_sys_get_nth_rseg(
trx_sys_t* sys, /* in: trx system */
ulint n) /* in: index of slot */
{
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(kernel_mutex)));
#endif /* UNIV_SYNC_DEBUG */
ut_ad(n < TRX_SYS_N_RSEGS);
return(sys->rseg_array[n]);
......@@ -122,9 +120,7 @@ trx_sysf_rseg_get_space(
ulint i, /* in: slot index == rseg id */
mtr_t* mtr) /* in: mtr */
{
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(kernel_mutex)));
#endif /* UNIV_SYNC_DEBUG */
ut_ad(sys_header);
ut_ad(i < TRX_SYS_N_RSEGS);
......@@ -147,9 +143,7 @@ trx_sysf_rseg_get_page_no(
mtr_t* mtr) /* in: mtr */
{
ut_ad(sys_header);
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(kernel_mutex)));
#endif /* UNIV_SYNC_DEBUG */
ut_ad(i < TRX_SYS_N_RSEGS);
return(mtr_read_ulint(sys_header + TRX_SYS_RSEGS
......@@ -169,9 +163,7 @@ trx_sysf_rseg_set_space(
ulint space, /* in: space id */
mtr_t* mtr) /* in: mtr */
{
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(kernel_mutex)));
#endif /* UNIV_SYNC_DEBUG */
ut_ad(sys_header);
ut_ad(i < TRX_SYS_N_RSEGS);
......@@ -195,9 +187,7 @@ trx_sysf_rseg_set_page_no(
slot is reset to unused */
mtr_t* mtr) /* in: mtr */
{
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(kernel_mutex)));
#endif /* UNIV_SYNC_DEBUG */
ut_ad(sys_header);
ut_ad(i < TRX_SYS_N_RSEGS);
......@@ -253,9 +243,7 @@ trx_get_on_id(
{
trx_t* trx;
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(kernel_mutex)));
#endif /* UNIV_SYNC_DEBUG */
trx = UT_LIST_GET_FIRST(trx_sys->trx_list);
......@@ -285,9 +273,7 @@ trx_list_get_min_trx_id(void)
{
trx_t* trx;
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(kernel_mutex)));
#endif /* UNIV_SYNC_DEBUG */
trx = UT_LIST_GET_LAST(trx_sys->trx_list);
......@@ -310,9 +296,7 @@ trx_is_active(
{
trx_t* trx;
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(kernel_mutex)));
#endif /* UNIV_SYNC_DEBUG */
if (ut_dulint_cmp(trx_id, trx_list_get_min_trx_id()) < 0) {
......@@ -349,9 +333,7 @@ trx_sys_get_new_trx_id(void)
{
dulint id;
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
#endif /* UNIV_SYNC_DEBUG */
/* VERY important: after the database is started, max_trx_id value is
divisible by TRX_SYS_TRX_ID_WRITE_MARGIN, and the following if
......@@ -381,9 +363,7 @@ trx_sys_get_new_trx_no(void)
/*========================*/
/* out: new, allocated trx number */
{
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
#endif /* UNIV_SYNC_DEBUG */
return(trx_sys_get_new_trx_id());
}
This diff is collapsed.
......@@ -165,9 +165,7 @@ log_buf_pool_get_oldest_modification(void)
{
ib_uint64_t lsn;
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(log_sys->mutex)));
#endif /* UNIV_SYNC_DEBUG */
lsn = buf_pool_get_oldest_modification();
......@@ -268,9 +266,7 @@ log_write_low(
ulint data_len;
byte* log_block;
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(log->mutex)));
#endif /* UNIV_SYNC_DEBUG */
part_loop:
/* Calculate a part length */
......@@ -339,9 +335,7 @@ log_close(void)
log_t* log = log_sys;
ulint checkpoint_age;
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(log->mutex)));
#endif /* UNIV_SYNC_DEBUG */
lsn = log->lsn;
......@@ -461,9 +455,7 @@ log_group_get_capacity(
/* out: capacity in bytes */
log_group_t* group) /* in: log group */
{
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(log_sys->mutex)));
#endif /* UNIV_SYNC_DEBUG */
return((group->file_size - LOG_FILE_HDR_SIZE) * group->n_files);
}
......@@ -479,9 +471,7 @@ log_group_calc_size_offset(
ulint offset, /* in: real offset within the log group */
log_group_t* group) /* in: log group */
{
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(log_sys->mutex)));
#endif /* UNIV_SYNC_DEBUG */
return(offset - LOG_FILE_HDR_SIZE * (1 + offset / group->file_size));
}
......@@ -497,9 +487,7 @@ log_group_calc_real_offset(
ulint offset, /* in: size offset within the log group */
log_group_t* group) /* in: log group */
{
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(log_sys->mutex)));
#endif /* UNIV_SYNC_DEBUG */
return(offset + LOG_FILE_HDR_SIZE
* (1 + offset / (group->file_size - LOG_FILE_HDR_SIZE)));
......@@ -522,9 +510,7 @@ log_group_calc_lsn_offset(
ib_longlong group_size;
ib_longlong offset;
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(log_sys->mutex)));
#endif /* UNIV_SYNC_DEBUG */
/* If total log file size is > 2 GB we can easily get overflows
with 32-bit integers. Use 64-bit integers instead. */
......@@ -634,9 +620,7 @@ log_calc_max_ages(void)
ulint archive_margin;
ulint smallest_archive_margin;
#ifdef UNIV_SYNC_DEBUG
ut_ad(!mutex_own(&(log_sys->mutex)));
#endif /* UNIV_SYNC_DEBUG */
mutex_enter(&(log_sys->mutex));
......@@ -934,9 +918,7 @@ log_flush_do_unlocks(
ulint code) /* in: any ORed combination of LOG_UNLOCK_FLUSH_LOCK
and LOG_UNLOCK_NONE_FLUSHED_LOCK */
{
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(log_sys->mutex)));
#endif /* UNIV_SYNC_DEBUG */
/* NOTE that we must own the log mutex when doing the setting of the
events: this is because transactions will wait for these events to
......@@ -968,9 +950,7 @@ log_group_check_flush_completion(
/* out: LOG_UNLOCK_NONE_FLUSHED_LOCK or 0 */
log_group_t* group) /* in: log group */
{
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(log_sys->mutex)));
#endif /* UNIV_SYNC_DEBUG */
if (!log_sys->one_flushed && group->n_pending_writes == 0) {
#ifdef UNIV_DEBUG
......@@ -1007,9 +987,7 @@ log_sys_check_flush_completion(void)
ulint move_start;
ulint move_end;
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(log_sys->mutex)));
#endif /* UNIV_SYNC_DEBUG */
if (log_sys->n_pending_writes == 0) {
......@@ -1121,10 +1099,8 @@ log_group_file_header_flush(
{
byte* buf;
ulint dest_offset;
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(log_sys->mutex)));
#endif /* UNIV_SYNC_DEBUG */
ut_ad(mutex_own(&(log_sys->mutex)));
ut_a(nth_file < group->n_files);
buf = *(group->file_header_bufs + nth_file);
......@@ -1195,9 +1171,7 @@ log_group_write_buf(
ulint next_offset;
ulint i;
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(log_sys->mutex)));
#endif /* UNIV_SYNC_DEBUG */
ut_a(len % OS_FILE_LOG_BLOCK_SIZE == 0);
ut_a(((ulint) start_lsn) % OS_FILE_LOG_BLOCK_SIZE == 0);
......@@ -1613,9 +1587,7 @@ void
log_complete_checkpoint(void)
/*=========================*/
{
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(log_sys->mutex)));
#endif /* UNIV_SYNC_DEBUG */
ut_ad(log_sys->n_pending_checkpoint_writes == 0);
log_sys->next_checkpoint_no++;
......@@ -1701,9 +1673,7 @@ log_group_checkpoint(
byte* buf;
ulint i;
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(log_sys->mutex)));
#endif /* UNIV_SYNC_DEBUG */
#if LOG_CHECKPOINT_SIZE > OS_FILE_LOG_BLOCK_SIZE
# error "LOG_CHECKPOINT_SIZE > OS_FILE_LOG_BLOCK_SIZE"
#endif
......@@ -1866,9 +1836,7 @@ log_group_read_checkpoint_info(
log_group_t* group, /* in: log group */
ulint field) /* in: LOG_CHECKPOINT_1 or LOG_CHECKPOINT_2 */
{
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(log_sys->mutex)));
#endif /* UNIV_SYNC_DEBUG */
log_sys->n_log_ios++;
......@@ -1886,9 +1854,7 @@ log_groups_write_checkpoint_info(void)
{
log_group_t* group;
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(log_sys->mutex)));
#endif /* UNIV_SYNC_DEBUG */
group = UT_LIST_GET_FIRST(log_sys->log_groups);
......@@ -2136,9 +2102,7 @@ log_group_read_log_seg(
ulint source_offset;
ibool sync;
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(log_sys->mutex)));
#endif /* UNIV_SYNC_DEBUG */
sync = (type == LOG_RECOVER);
loop:
......@@ -2207,9 +2171,7 @@ log_group_archive_file_header_write(
byte* buf;
ulint dest_offset;
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(log_sys->mutex)));
#endif /* UNIV_SYNC_DEBUG */
ut_a(nth_file < group->n_files);
......@@ -2246,9 +2208,7 @@ log_group_archive_completed_header_write(
byte* buf;
ulint dest_offset;
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(log_sys->mutex)));
#endif /* UNIV_SYNC_DEBUG */
ut_a(nth_file < group->n_files);
buf = *(group->archive_file_header_bufs + nth_file);
......@@ -2287,9 +2247,7 @@ log_group_archive(
ulint n_files;
ulint open_mode;
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(log_sys->mutex)));
#endif /* UNIV_SYNC_DEBUG */
start_lsn = log_sys->archived_lsn;
......@@ -2421,9 +2379,7 @@ log_archive_groups(void)
{
log_group_t* group;
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(log_sys->mutex)));
#endif /* UNIV_SYNC_DEBUG */
group = UT_LIST_GET_FIRST(log_sys->log_groups);
......@@ -2446,9 +2402,7 @@ log_archive_write_complete_groups(void)
ib_uint64_t end_lsn;
ulint i;
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(log_sys->mutex)));
#endif /* UNIV_SYNC_DEBUG */
group = UT_LIST_GET_FIRST(log_sys->log_groups);
......@@ -2513,9 +2467,7 @@ void
log_archive_check_completion_low(void)
/*==================================*/
{
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(log_sys->mutex)));
#endif /* UNIV_SYNC_DEBUG */
if (log_sys->n_pending_archive_ios == 0
&& log_sys->archiving_phase == LOG_ARCHIVE_READ) {
......@@ -2747,9 +2699,7 @@ log_archive_close_groups(
log_group_t* group;
ulint trunc_len;
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(log_sys->mutex)));
#endif /* UNIV_SYNC_DEBUG */
if (log_sys->archiving_state == LOG_ARCH_OFF) {
......@@ -3236,9 +3186,7 @@ log_check_log_recs(
byte* buf1;
byte* scan_buf;
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(log_sys->mutex)));
#endif /* UNIV_SYNC_DEBUG */
if (len == 0) {
......
......@@ -172,9 +172,8 @@ void
recv_sys_empty_hash(void)
/*=====================*/
{
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(recv_sys->mutex)));
#endif /* UNIV_SYNC_DEBUG */
if (recv_sys->n_addrs != 0) {
fprintf(stderr,
"InnoDB: Error: %lu pages with log records"
......@@ -1432,9 +1431,8 @@ recv_apply_hashed_log_recs(
goto loop;
}
#ifdef UNIV_SYNC_DEBUG
ut_ad(!allow_ibuf == mutex_own(&log_sys->mutex));
#endif /* UNIV_SYNC_DEBUG */
if (!allow_ibuf) {
recv_no_ibuf_operations = TRUE;
}
......@@ -1896,9 +1894,7 @@ recv_parse_log_recs(
byte* body;
ulint n_recs;
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(log_sys->mutex)));
#endif /* UNIV_SYNC_DEBUG */
ut_ad(recv_sys->parse_start_lsn != 0);
loop:
ptr = recv_sys->buf + recv_sys->recovered_offset;
......@@ -2930,9 +2926,8 @@ recv_reset_logs(
{
log_group_t* group;
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(log_sys->mutex)));
#endif /* UNIV_SYNC_DEBUG */
log_sys->lsn = ut_uint64_align_up(lsn, OS_FILE_LOG_BLOCK_SIZE);
group = UT_LIST_GET_FIRST(log_sys->log_groups);
......
......@@ -257,9 +257,7 @@ mem_pool_fill_free_list(
mem_area_t* area2;
ibool ret;
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(pool->mutex)));
#endif /* UNIV_SYNC_DEBUG */
if (i >= 63) {
/* We come here when we have run out of space in the
......
......@@ -1859,10 +1859,9 @@ pars_sql(
heap = mem_heap_create(256);
#ifdef UNIV_SYNC_DEBUG
/* Currently, the parser is not reentrant: */
ut_ad(mutex_own(&(dict_sys->mutex)));
#endif /* UNIV_SYNC_DEBUG */
pars_sym_tab_global = sym_tab_create(heap);
pars_sym_tab_global->string_len = strlen(str);
......
......@@ -127,9 +127,7 @@ que_graph_publish(
que_t* graph, /* in: graph */
sess_t* sess) /* in: session */
{
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
#endif /* UNIV_SYNC_DEBUG */
UT_LIST_ADD_LAST(graphs, sess->graphs, graph);
}
......@@ -238,9 +236,7 @@ que_thr_end_wait(
{
ibool was_active;
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
#endif /* UNIV_SYNC_DEBUG */
ut_ad(thr);
ut_ad((thr->state == QUE_THR_LOCK_WAIT)
|| (thr->state == QUE_THR_PROCEDURE_WAIT)
......@@ -280,9 +276,7 @@ que_thr_end_wait_no_next_thr(
ut_a(thr->state == QUE_THR_LOCK_WAIT); /* In MySQL this is the
only possible state here */
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
#endif /* UNIV_SYNC_DEBUG */
ut_ad(thr);
ut_ad((thr->state == QUE_THR_LOCK_WAIT)
|| (thr->state == QUE_THR_PROCEDURE_WAIT)
......@@ -419,9 +413,7 @@ que_fork_error_handle(
{
que_thr_t* thr;
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
#endif /* UNIV_SYNC_DEBUG */
ut_ad(trx->sess->state == SESS_ERROR);
ut_ad(UT_LIST_GET_LEN(trx->reply_signals) == 0);
ut_ad(UT_LIST_GET_LEN(trx->wait_thrs) == 0);
......@@ -698,9 +690,7 @@ que_graph_try_free(
{
sess_t* sess;
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
#endif /* UNIV_SYNC_DEBUG */
sess = (graph->trx)->sess;
......@@ -931,9 +921,7 @@ que_thr_stop(
que_t* graph;
ibool ret = TRUE;
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
#endif /* UNIV_SYNC_DEBUG */
graph = thr->graph;
trx = graph->trx;
......@@ -1309,10 +1297,7 @@ que_run_threads_low(
ut_ad(thr->state == QUE_THR_RUNNING);
ut_a(thr_get_trx(thr)->error_state == DB_SUCCESS);
#ifdef UNIV_SYNC_DEBUG
ut_ad(!mutex_own(&kernel_mutex));
#endif /* UNIV_SYNC_DEBUG */
/* cumul_resource counts how much resources the OS thread (NOT the
query thread) has spent in this function */
......
......@@ -162,9 +162,8 @@ read_view_oldest_copy_or_open_new(
ulint n;
ulint i;
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
#endif /* UNIV_SYNC_DEBUG */
old_view = UT_LIST_GET_LAST(trx_sys->view_list);
if (old_view == NULL) {
......@@ -245,9 +244,9 @@ read_view_open_now(
read_view_t* view;
trx_t* trx;
ulint n;
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
#endif /* UNIV_SYNC_DEBUG */
view = read_view_create_low(UT_LIST_GET_LEN(trx_sys->trx_list), heap);
view->creator_trx_id = cr_trx_id;
......@@ -313,9 +312,8 @@ read_view_close(
/*============*/
read_view_t* view) /* in: read view */
{
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
#endif /* UNIV_SYNC_DEBUG */
UT_LIST_REMOVE(view_list, trx_sys->view_list, view);
}
......
......@@ -1753,8 +1753,8 @@ row_create_table_for_mysql(
ut_ad(trx->mysql_thread_id == os_thread_get_curr_id());
#ifdef UNIV_SYNC_DEBUG
ut_ad(rw_lock_own(&dict_operation_lock, RW_LOCK_EX));
ut_ad(mutex_own(&(dict_sys->mutex)));
#endif /* UNIV_SYNC_DEBUG */
ut_ad(mutex_own(&(dict_sys->mutex)));
ut_ad(trx->dict_operation_lock_mode == RW_X_LATCH);
if (srv_created_new_raw) {
......@@ -1969,8 +1969,8 @@ row_create_index_for_mysql(
#ifdef UNIV_SYNC_DEBUG
ut_ad(rw_lock_own(&dict_operation_lock, RW_LOCK_EX));
ut_ad(mutex_own(&(dict_sys->mutex)));
#endif /* UNIV_SYNC_DEBUG */
ut_ad(mutex_own(&(dict_sys->mutex)));
ut_ad(trx->mysql_thread_id == os_thread_get_curr_id());
trx->op_info = "creating index";
......@@ -2085,8 +2085,8 @@ row_table_add_foreign_constraints(
{
ulint err;
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(dict_sys->mutex)));
#ifdef UNIV_SYNC_DEBUG
ut_ad(rw_lock_own(&dict_operation_lock, RW_LOCK_EX));
#endif /* UNIV_SYNC_DEBUG */
ut_a(sql_string);
......@@ -2251,9 +2251,7 @@ row_get_background_drop_list_len_low(void)
/*======================================*/
/* out: how many tables in list */
{
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
#endif /* UNIV_SYNC_DEBUG */
if (!row_mysql_drop_list_inited) {
......@@ -2731,8 +2729,8 @@ row_truncate_table_for_mysql(
row_mysql_lock_data_dictionary(trx);
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(dict_sys->mutex)));
#ifdef UNIV_SYNC_DEBUG
ut_ad(rw_lock_own(&dict_operation_lock, RW_LOCK_EX));
#endif /* UNIV_SYNC_DEBUG */
......@@ -3005,8 +3003,8 @@ row_drop_table_for_mysql(
locked_dictionary = TRUE;
}
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(dict_sys->mutex)));
#ifdef UNIV_SYNC_DEBUG
ut_ad(rw_lock_own(&dict_operation_lock, RW_LOCK_EX));
#endif /* UNIV_SYNC_DEBUG */
......
......@@ -63,8 +63,8 @@ row_vers_impl_x_locked_off_kernel(
mtr_t mtr;
ulint comp;
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
#ifdef UNIV_SYNC_DEBUG
ut_ad(!rw_lock_own(&(purge_sys->latch), RW_LOCK_SHARED));
#endif /* UNIV_SYNC_DEBUG */
......
......@@ -82,10 +82,7 @@ srv_que_task_enqueue_low(
que_thr_t* thr) /* in: query thread */
{
ut_ad(thr);
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
#endif /* UNIV_SYNC_DEBUG */
UT_LIST_ADD_LAST(queue, srv_sys->tasks, thr);
......
......@@ -716,9 +716,7 @@ srv_suspend_thread(void)
ulint slot_no;
ulint type;
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
#endif /* UNIV_SYNC_DEBUG */
slot_no = thr_local_get_slot_no(os_thread_get_curr_id());
......@@ -770,9 +768,7 @@ srv_release_threads(
ut_ad(type >= SRV_WORKER);
ut_ad(type <= SRV_MASTER);
ut_ad(n > 0);
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
#endif /* UNIV_SYNC_DEBUG */
for (i = 0; i < OS_THREAD_MAX_N; i++) {
......@@ -1283,9 +1279,7 @@ srv_table_reserve_slot_for_mysql(void)
srv_slot_t* slot;
ulint i;
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
#endif /* UNIV_SYNC_DEBUG */
i = 0;
slot = srv_mysql_table + i;
......@@ -1365,9 +1359,7 @@ srv_suspend_mysql_thread(
ulint sec;
ulint ms;
#ifdef UNIV_SYNC_DEBUG
ut_ad(!mutex_own(&kernel_mutex));
#endif /* UNIV_SYNC_DEBUG */
trx = thr_get_trx(thr);
......@@ -1513,9 +1505,7 @@ srv_release_mysql_thread_if_suspended(
srv_slot_t* slot;
ulint i;
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
#endif /* UNIV_SYNC_DEBUG */
for (i = 0; i < OS_THREAD_MAX_N; i++) {
......
......@@ -339,9 +339,8 @@ rw_lock_x_lock_low(
const char* file_name,/* in: file name where lock requested */
ulint line) /* in: line where requested */
{
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(rw_lock_get_mutex(lock)));
#endif /* UNIV_SYNC_DEBUG */
if (rw_lock_get_writer(lock) == RW_LOCK_NOT_LOCKED) {
if (rw_lock_get_reader_count(lock) == 0) {
......
......@@ -329,6 +329,7 @@ mutex_enter_nowait(
if (!mutex_test_and_set(mutex)) {
ut_d(mutex->thread_id = os_thread_get_curr_id());
#ifdef UNIV_SYNC_DEBUG
mutex_set_debug_info(mutex, file_name, line);
#endif
......@@ -346,13 +347,29 @@ Checks that the mutex has been initialized. */
ibool
mutex_validate(
/*===========*/
mutex_t* mutex)
const mutex_t* mutex)
{
ut_a(mutex);
ut_a(mutex->magic_n == MUTEX_MAGIC_N);
return(TRUE);
}
/**********************************************************************
Checks that the current thread owns the mutex. Works only in the debug
version. */
ibool
mutex_own(
/*======*/
/* out: TRUE if owns */
const mutex_t* mutex) /* in: mutex */
{
ut_ad(mutex_validate(mutex));
return(mutex_get_lock_word(mutex) == 1
&& os_thread_eq(mutex->thread_id, os_thread_get_curr_id()));
}
#endif /* UNIV_DEBUG */
/**********************************************************************
......@@ -451,6 +468,7 @@ mutex_spin_wait(
if (mutex_test_and_set(mutex) == 0) {
/* Succeeded! */
ut_d(mutex->thread_id = os_thread_get_curr_id());
#ifdef UNIV_SYNC_DEBUG
mutex_set_debug_info(mutex, file_name, line);
#endif
......@@ -492,6 +510,7 @@ mutex_spin_wait(
sync_array_free_cell_protected(sync_primary_wait_array,
index);
ut_d(mutex->thread_id = os_thread_get_curr_id());
#ifdef UNIV_SYNC_DEBUG
mutex_set_debug_info(mutex, file_name, line);
#endif
......@@ -592,7 +611,6 @@ mutex_set_debug_info(
mutex->file_name = file_name;
mutex->line = line;
mutex->thread_id = os_thread_get_curr_id();
}
/**********************************************************************
......@@ -614,31 +632,6 @@ mutex_get_debug_info(
*thread_id = mutex->thread_id;
}
/**********************************************************************
Checks that the current thread owns the mutex. Works only in the debug
version. */
ibool
mutex_own(
/*======*/
/* out: TRUE if owns */
mutex_t* mutex) /* in: mutex */
{
ut_ad(mutex_validate(mutex));
if (mutex_get_lock_word(mutex) != 1) {
return(FALSE);
}
if (!os_thread_eq(mutex->thread_id, os_thread_get_curr_id())) {
return(FALSE);
}
return(TRUE);
}
/**********************************************************************
Prints debug info of currently reserved mutexes. */
static
......
......@@ -64,9 +64,7 @@ thr_local_get(
try_again:
ut_ad(thr_local_hash);
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&thr_local_mutex));
#endif /* UNIV_SYNC_DEBUG */
/* Look for the local struct in the hash table */
......
......@@ -197,9 +197,7 @@ void
trx_purge_sys_create(void)
/*======================*/
{
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
#endif /* UNIV_SYNC_DEBUG */
purge_sys = mem_alloc(sizeof(trx_purge_t));
......@@ -260,9 +258,8 @@ trx_purge_add_update_undo_to_history(
ut_ad(undo);
rseg = undo->rseg;
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(rseg->mutex)));
#endif /* UNIV_SYNC_DEBUG */
rseg_header = trx_rsegf_get(rseg->space, rseg->zip_size,
rseg->page_no, mtr);
......@@ -342,9 +339,7 @@ trx_purge_free_segment(
/* fputs("Freeing an update undo log segment\n", stderr); */
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(purge_sys->mutex)));
#endif /* UNIV_SYNC_DEBUG */
loop:
mtr_start(&mtr);
mutex_enter(&(rseg->mutex));
......@@ -448,9 +443,7 @@ trx_purge_truncate_rseg_history(
ulint n_removed_logs = 0;
mtr_t mtr;
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(purge_sys->mutex)));
#endif /* UNIV_SYNC_DEBUG */
mtr_start(&mtr);
mutex_enter(&(rseg->mutex));
......@@ -543,9 +536,7 @@ trx_purge_truncate_history(void)
dulint limit_trx_no;
dulint limit_undo_no;
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(purge_sys->mutex)));
#endif /* UNIV_SYNC_DEBUG */
trx_purge_arr_get_biggest(purge_sys->arr, &limit_trx_no,
&limit_undo_no);
......@@ -585,9 +576,7 @@ trx_purge_truncate_if_arr_empty(void)
/*=================================*/
/* out: TRUE if array empty */
{
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(purge_sys->mutex)));
#endif /* UNIV_SYNC_DEBUG */
if (purge_sys->arr->n_used == 0) {
......@@ -616,9 +605,7 @@ trx_purge_rseg_get_next_history_log(
ibool del_marks;
mtr_t mtr;
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(purge_sys->mutex)));
#endif /* UNIV_SYNC_DEBUG */
mutex_enter(&(rseg->mutex));
......@@ -722,9 +709,7 @@ trx_purge_choose_next_log(void)
ulint offset = 0; /* remove warning (??? bug ???) */
mtr_t mtr;
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(purge_sys->mutex)));
#endif /* UNIV_SYNC_DEBUG */
ut_ad(purge_sys->next_stored == FALSE);
rseg = UT_LIST_GET_FIRST(trx_sys->rseg_list);
......@@ -827,9 +812,7 @@ trx_purge_get_next_rec(
ulint cmpl_info;
mtr_t mtr;
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(purge_sys->mutex)));
#endif /* UNIV_SYNC_DEBUG */
ut_ad(purge_sys->next_stored);
space = purge_sys->rseg->space;
......
......@@ -785,10 +785,8 @@ trx_roll_try_truncate(
dulint limit;
dulint biggest;
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(trx->undo_mutex)));
ut_ad(mutex_own(&((trx->rseg)->mutex)));
#endif /* UNIV_SYNC_DEBUG */
trx->pages_undone = 0;
......@@ -831,9 +829,7 @@ trx_roll_pop_top_rec(
trx_undo_rec_t* prev_rec;
page_t* prev_rec_page;
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(trx->undo_mutex)));
#endif /* UNIV_SYNC_DEBUG */
undo_page = trx_undo_page_get_s_latched(undo->space, undo->zip_size,
undo->top_page_no, mtr);
......@@ -1060,9 +1056,7 @@ trx_rollback(
que_thr_t* thr;
/* que_thr_t* thr2; */
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
#endif /* UNIV_SYNC_DEBUG */
ut_ad((trx->undo_no_arr == NULL) || ((trx->undo_no_arr)->n_used == 0));
/* Initialize the rollback field in the transaction */
......@@ -1131,9 +1125,7 @@ trx_roll_graph_build(
que_thr_t* thr;
/* que_thr_t* thr2; */
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
#endif /* UNIV_SYNC_DEBUG */
heap = mem_heap_create(512);
fork = que_fork_create(NULL, NULL, QUE_FORK_ROLLBACK, heap);
......@@ -1160,9 +1152,7 @@ trx_finish_error_processing(
trx_sig_t* sig;
trx_sig_t* next_sig;
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
#endif /* UNIV_SYNC_DEBUG */
sig = UT_LIST_GET_FIRST(trx->signals);
......@@ -1195,9 +1185,7 @@ trx_finish_partial_rollback_off_kernel(
{
trx_sig_t* sig;
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
#endif /* UNIV_SYNC_DEBUG */
sig = UT_LIST_GET_FIRST(trx->signals);
......@@ -1228,9 +1216,7 @@ trx_finish_rollback_off_kernel(
trx_sig_t* sig;
trx_sig_t* next_sig;
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
#endif /* UNIV_SYNC_DEBUG */
ut_a(trx->undo_no_arr == NULL || trx->undo_no_arr->n_used == 0);
......
......@@ -62,9 +62,7 @@ trx_rseg_header_create(
buf_block_t* block;
ut_ad(mtr);
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
#endif /* UNIV_SYNC_DEBUG */
ut_ad(mtr_memo_contains(mtr, fil_space_get_latch(space, NULL),
MTR_MEMO_X_LOCK));
sys_header = trx_sysf_get(mtr);
......@@ -143,9 +141,7 @@ trx_rseg_mem_create(
ulint sum_of_undo_sizes;
ulint len;
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
#endif /* UNIV_SYNC_DEBUG */
rseg = mem_alloc(sizeof(trx_rseg_t));
......
......@@ -557,9 +557,7 @@ trx_in_trx_list(
{
trx_t* trx;
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(kernel_mutex)));
#endif /* UNIV_SYNC_DEBUG */
trx = UT_LIST_GET_FIRST(trx_sys->trx_list);
......@@ -586,9 +584,7 @@ trx_sys_flush_max_trx_id(void)
trx_sysf_t* sys_header;
mtr_t mtr;
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
#endif /* UNIV_SYNC_DEBUG */
mtr_start(&mtr);
......@@ -810,9 +806,7 @@ trx_sysf_rseg_find_free(
ulint page_no;
ulint i;
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(kernel_mutex)));
#endif /* UNIV_SYNC_DEBUG */
sys_header = trx_sysf_get(mtr);
......
......@@ -101,9 +101,7 @@ trx_create(
{
trx_t* trx;
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
#endif /* UNIV_SYNC_DEBUG */
trx = mem_alloc(sizeof(trx_t));
......@@ -280,9 +278,7 @@ trx_free(
/*=====*/
trx_t* trx) /* in, own: trx object */
{
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
#endif /* UNIV_SYNC_DEBUG */
if (trx->declared_to_be_inside_innodb) {
ut_print_timestamp(stderr);
......@@ -406,9 +402,7 @@ trx_list_insert_ordered(
{
trx_t* trx2;
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
#endif /* UNIV_SYNC_DEBUG */
trx2 = UT_LIST_GET_FIRST(trx_sys->trx_list);
......@@ -633,9 +627,7 @@ trx_assign_rseg(void)
{
trx_rseg_t* rseg = trx_sys->latest_rseg;
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
#endif /* UNIV_SYNC_DEBUG */
loop:
/* Get next rseg in a round-robin fashion */
......@@ -672,9 +664,7 @@ trx_start_low(
{
trx_rseg_t* rseg;
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
#endif /* UNIV_SYNC_DEBUG */
ut_ad(trx->rseg == NULL);
if (trx->type == TRX_PURGE) {
......@@ -748,9 +738,7 @@ trx_commit_off_kernel(
trx_undo_t* undo;
mtr_t mtr;
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
#endif /* UNIV_SYNC_DEBUG */
trx->must_flush_log_later = FALSE;
......@@ -848,9 +836,7 @@ trx_commit_off_kernel(
ut_ad(trx->conc_state == TRX_ACTIVE
|| trx->conc_state == TRX_PREPARED);
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
#endif /* UNIV_SYNC_DEBUG */
/* The following assignment makes the transaction committed in memory
and makes its changes to data visible to other transactions.
......@@ -1033,9 +1019,7 @@ trx_handle_commit_sig_off_kernel(
trx_sig_t* sig;
trx_sig_t* next_sig;
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
#endif /* UNIV_SYNC_DEBUG */
trx->que_state = TRX_QUE_COMMITTING;
......@@ -1075,9 +1059,7 @@ trx_end_lock_wait(
{
que_thr_t* thr;
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
#endif /* UNIV_SYNC_DEBUG */
ut_ad(trx->que_state == TRX_QUE_LOCK_WAIT);
thr = UT_LIST_GET_FIRST(trx->wait_thrs);
......@@ -1104,9 +1086,7 @@ trx_lock_wait_to_suspended(
{
que_thr_t* thr;
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
#endif /* UNIV_SYNC_DEBUG */
ut_ad(trx->que_state == TRX_QUE_LOCK_WAIT);
thr = UT_LIST_GET_FIRST(trx->wait_thrs);
......@@ -1134,9 +1114,7 @@ trx_sig_reply_wait_to_suspended(
trx_sig_t* sig;
que_thr_t* thr;
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
#endif /* UNIV_SYNC_DEBUG */
sig = UT_LIST_GET_FIRST(trx->reply_signals);
......@@ -1169,9 +1147,7 @@ trx_sig_is_compatible(
{
trx_sig_t* sig;
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
#endif /* UNIV_SYNC_DEBUG */
if (UT_LIST_GET_LEN(trx->signals) == 0) {
......@@ -1257,9 +1233,7 @@ trx_sig_send(
trx_t* receiver_trx;
ut_ad(trx);
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
#endif /* UNIV_SYNC_DEBUG */
if (!trx_sig_is_compatible(trx, type, sender)) {
/* The signal is not compatible with the other signals in
......@@ -1329,9 +1303,7 @@ trx_end_signal_handling(
/*====================*/
trx_t* trx) /* in: trx */
{
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
#endif /* UNIV_SYNC_DEBUG */
ut_ad(trx->handling_signals == TRUE);
trx->handling_signals = FALSE;
......@@ -1365,9 +1337,7 @@ trx_sig_start_handle(
we can process immediately */
ut_ad(trx);
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
#endif /* UNIV_SYNC_DEBUG */
if (trx->handling_signals && (UT_LIST_GET_LEN(trx->signals) == 0)) {
......@@ -1468,9 +1438,7 @@ trx_sig_reply(
trx_t* receiver_trx;
ut_ad(sig);
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
#endif /* UNIV_SYNC_DEBUG */
if (sig->receiver != NULL) {
ut_ad((sig->receiver)->state == QUE_THR_SIG_REPLY_WAIT);
......@@ -1498,9 +1466,7 @@ trx_sig_remove(
trx_sig_t* sig) /* in, own: signal */
{
ut_ad(trx && sig);
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
#endif /* UNIV_SYNC_DEBUG */
ut_ad(sig->receiver == NULL);
......@@ -1816,9 +1782,7 @@ trx_prepare_off_kernel(
ib_uint64_t lsn = 0;
mtr_t mtr;
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
#endif /* UNIV_SYNC_DEBUG */
rseg = trx->rseg;
......@@ -1862,9 +1826,7 @@ trx_prepare_off_kernel(
mutex_enter(&kernel_mutex);
}
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
#endif /* UNIV_SYNC_DEBUG */
/*--------------------------------------*/
trx->conc_state = TRX_PREPARED;
......
......@@ -412,9 +412,7 @@ trx_undo_seg_create(
ibool success;
ut_ad(mtr && id && rseg_hdr);
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(rseg->mutex)));
#endif /* UNIV_SYNC_DEBUG */
/* fputs(type == TRX_UNDO_INSERT
? "Creating insert undo log segment\n"
......@@ -854,11 +852,9 @@ trx_undo_add_page(
ulint n_reserved;
ibool success;
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(trx->undo_mutex)));
ut_ad(!mutex_own(&kernel_mutex));
ut_ad(mutex_own(&(trx->rseg->mutex)));
#endif /* UNIV_SYNC_DEBUG */
rseg = trx->rseg;
......@@ -932,10 +928,8 @@ trx_undo_free_page(
ulint zip_size;
ut_a(hdr_page_no != page_no);
#ifdef UNIV_SYNC_DEBUG
ut_ad(!mutex_own(&kernel_mutex));
ut_ad(mutex_own(&(rseg->mutex)));
#endif /* UNIV_SYNC_DEBUG */
zip_size = rseg->zip_size;
......@@ -985,9 +979,7 @@ trx_undo_free_page_in_rollback(
ulint last_page_no;
ut_ad(undo->hdr_page_no != page_no);
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(trx->undo_mutex)));
#endif /* UNIV_SYNC_DEBUG */
last_page_no = trx_undo_free_page(undo->rseg, FALSE, undo->space,
undo->hdr_page_no, page_no, mtr);
......@@ -1042,10 +1034,8 @@ trx_undo_truncate_end(
trx_rseg_t* rseg;
mtr_t mtr;
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(trx->undo_mutex)));
ut_ad(mutex_own(&(trx->rseg->mutex)));
#endif /* UNIV_SYNC_DEBUG */
rseg = trx->rseg;
......@@ -1123,9 +1113,7 @@ trx_undo_truncate_start(
ulint page_no;
mtr_t mtr;
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(rseg->mutex)));
#endif /* UNIV_SYNC_DEBUG */
if (0 == ut_dulint_cmp(limit, ut_dulint_zero)) {
......@@ -1192,9 +1180,9 @@ trx_undo_seg_free(
do {
mtr_start(&mtr);
#ifdef UNIV_SYNC_DEBUG
ut_ad(!mutex_own(&kernel_mutex));
#endif /* UNIV_SYNC_DEBUG */
mutex_enter(&(rseg->mutex));
seg_header = trx_undo_page_get(undo->space, undo->zip_size,
......@@ -1423,9 +1411,7 @@ trx_undo_mem_create(
{
trx_undo_t* undo;
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(rseg->mutex)));
#endif /* UNIV_SYNC_DEBUG */
if (id >= TRX_RSEG_N_SLOTS) {
fprintf(stderr,
......@@ -1472,11 +1458,9 @@ trx_undo_mem_init_for_reuse(
XID* xid, /* in: X/Open XA transaction identification*/
ulint offset) /* in: undo log header byte offset on page */
{
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&((undo->rseg)->mutex)));
#endif /* UNIV_SYNC_DEBUG */
if (undo->id >= TRX_RSEG_N_SLOTS) {
if (UNIV_UNLIKELY(undo->id >= TRX_RSEG_N_SLOTS)) {
fprintf(stderr, "InnoDB: Error: undo->id is %lu\n",
(ulong) undo->id);
......@@ -1536,9 +1520,7 @@ trx_undo_create(
trx_undo_t* undo;
page_t* undo_page;
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(rseg->mutex)));
#endif /* UNIV_SYNC_DEBUG */
if (rseg->curr_size == rseg->max_size) {
......@@ -1597,9 +1579,7 @@ trx_undo_reuse_cached(
page_t* undo_page;
ulint offset;
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(rseg->mutex)));
#endif /* UNIV_SYNC_DEBUG */
if (type == TRX_UNDO_INSERT) {
......@@ -1709,15 +1689,12 @@ trx_undo_assign_undo(
rseg = trx->rseg;
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(trx->undo_mutex)));
#endif /* UNIV_SYNC_DEBUG */
mtr_start(&mtr);
#ifdef UNIV_SYNC_DEBUG
ut_ad(!mutex_own(&kernel_mutex));
#endif /* UNIV_SYNC_DEBUG */
mutex_enter(&(rseg->mutex));
undo = trx_undo_reuse_cached(trx, rseg, type, trx->id, &trx->xid,
......@@ -1876,9 +1853,8 @@ trx_undo_update_cleanup(
undo = trx->update_undo;
rseg = trx->rseg;
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(rseg->mutex)));
#endif /* UNIV_SYNC_DEBUG */
trx_purge_add_update_undo_to_history(trx, undo_page, mtr);
UT_LIST_REMOVE(undo_list, rseg->update_undo_list, undo);
......
......@@ -32,9 +32,8 @@ sess_open(void)
{
sess_t* sess;
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
#endif /* UNIV_SYNC_DEBUG */
sess = mem_alloc(sizeof(sess_t));
sess->state = SESS_ACTIVE;
......@@ -54,9 +53,7 @@ sess_close(
/*=======*/
sess_t* sess) /* in, own: session object */
{
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
#endif /* UNIV_SYNC_DEBUG */
ut_ad(sess->trx == NULL);
mem_free(sess);
......@@ -72,9 +69,8 @@ sess_try_close(
/* out: TRUE if closed */
sess_t* sess) /* in, own: session object */
{
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
#endif /* UNIV_SYNC_DEBUG */
if (UT_LIST_GET_LEN(sess->graphs) == 0) {
sess_close(sess);
......
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