diff --git a/buf/buf0buf.c b/buf/buf0buf.c index 6a4b79ef0fc..03b9c8c8cb3 100644 --- a/buf/buf0buf.c +++ b/buf/buf0buf.c @@ -1588,7 +1588,7 @@ lookup: } } -#ifdef UNIV_IBUF_DEBUG +#ifdef UNIV_IBUF_COUNT_DEBUG ut_a(ibuf_count_get(buf_page_get_space(bpage), buf_page_get_page_no(bpage)) == 0); #endif @@ -1992,7 +1992,7 @@ wait_until_unfixed: buf_read_ahead_linear(space, zip_size, offset); } -#ifdef UNIV_IBUF_DEBUG +#ifdef UNIV_IBUF_COUNT_DEBUG ut_a(ibuf_count_get(buf_block_get_space(block), buf_block_get_page_no(block)) == 0); #endif @@ -2111,7 +2111,7 @@ buf_page_optimistic_get_func( buf_block_get_page_no(block)); } -#ifdef UNIV_IBUF_DEBUG +#ifdef UNIV_IBUF_COUNT_DEBUG ut_a(ibuf_count_get(buf_block_get_space(block), buf_block_get_page_no(block)) == 0); #endif @@ -2204,7 +2204,7 @@ buf_page_get_known_nowait( ut_a(block->page.file_page_was_freed == FALSE); #endif -#ifdef UNIV_IBUF_DEBUG +#ifdef UNIV_IBUF_COUNT_DEBUG ut_a((mode == BUF_KEEP_OLD) || (ibuf_count_get(buf_block_get_space(block), buf_block_get_page_no(block)) == 0)); @@ -2558,7 +2558,7 @@ buf_page_create( block = (buf_block_t*) buf_page_hash_get(space, offset); if (block && buf_page_in_file(&block->page)) { -#ifdef UNIV_IBUF_DEBUG +#ifdef UNIV_IBUF_COUNT_DEBUG ut_a(ibuf_count_get(space, offset) == 0); #endif #ifdef UNIV_DEBUG_FILE_ACCESSES @@ -2655,7 +2655,7 @@ buf_page_create( #if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG ut_a(++buf_dbg_counter % 357 || buf_validate()); #endif /* UNIV_DEBUG || UNIV_BUF_DEBUG */ -#ifdef UNIV_IBUF_DEBUG +#ifdef UNIV_IBUF_COUNT_DEBUG ut_a(ibuf_count_get(buf_block_get_space(block), buf_block_get_page_no(block)) == 0); #endif @@ -2808,7 +2808,7 @@ corrupt: mutex_enter(&(buf_pool->mutex)); mutex_enter(buf_page_get_mutex(bpage)); -#ifdef UNIV_IBUF_DEBUG +#ifdef UNIV_IBUF_COUNT_DEBUG if (io_type == BUF_IO_WRITE || uncompressed) { /* For BUF_IO_READ of compressed-only blocks, the buffered operations will be merged by buf_page_get_gen() @@ -2950,7 +2950,7 @@ buf_validate(void) block)) == &block->page); -#ifdef UNIV_IBUF_DEBUG +#ifdef UNIV_IBUF_COUNT_DEBUG ut_a(buf_page_get_io_fix(&block->page) == BUF_IO_READ || !ibuf_count_get(buf_block_get_space( diff --git a/buf/buf0flu.c b/buf/buf0flu.c index f59753898f0..de0bd9ef1fe 100644 --- a/buf/buf0flu.c +++ b/buf/buf0flu.c @@ -675,7 +675,7 @@ buf_flush_write_block_low( ut_ad(buf_page_in_file(bpage)); -#ifdef UNIV_IBUF_DEBUG +#ifdef UNIV_IBUF_COUNT_DEBUG ut_a(ibuf_count_get(bpage->space, bpage->offset) == 0); #endif ut_ad(bpage->newest_modification != 0); diff --git a/ibuf/ibuf0ibuf.c b/ibuf/ibuf0ibuf.c index 9a3c06ed836..dfe99686523 100644 --- a/ibuf/ibuf0ibuf.c +++ b/ibuf/ibuf0ibuf.c @@ -144,7 +144,7 @@ static ulint ibuf_rnd = 986058871; ulint ibuf_flush_count = 0; -#ifdef UNIV_IBUF_DEBUG +#ifdef UNIV_IBUF_COUNT_DEBUG /* Dimensions for the ibuf_count array */ #define IBUF_COUNT_N_SPACES 500 #define IBUF_COUNT_N_PAGES 2000 @@ -318,7 +318,7 @@ ibuf_tree_root_get( return(buf_block_get_frame(block)); } -#ifdef UNIV_IBUF_DEBUG +#ifdef UNIV_IBUF_COUNT_DEBUG /********************************************************************** Gets the ibuf count for a given page. */ @@ -380,7 +380,7 @@ ibuf_init_at_db_start(void) ibuf->size = 0; -#ifdef UNIV_IBUF_DEBUG +#ifdef UNIV_IBUF_COUNT_DEBUG { ulint i, j; @@ -695,7 +695,7 @@ ibuf_bitmap_page_set_bits( #endif ut_ad(ut_is_2pow(zip_size)); ut_ad(mtr_memo_contains_page(mtr, page, MTR_MEMO_PAGE_X_FIX)); -#ifdef UNIV_IBUF_DEBUG +#ifdef UNIV_IBUF_COUNT_DEBUG ut_a((bit != IBUF_BITMAP_BUFFERED) || (val != FALSE) || (0 == ibuf_count_get(page_get_space_id(page), page_no))); @@ -2671,7 +2671,7 @@ ibuf_insert_low( page */ buffered = ibuf_get_volume_buffered(&pcur, space, page_no, &mtr); -#ifdef UNIV_IBUF_DEBUG +#ifdef UNIV_IBUF_COUNT_DEBUG ut_a((buffered == 0) || ibuf_count_get(space, page_no)); #endif mtr_start(&bitmap_mtr); @@ -2760,7 +2760,7 @@ ibuf_insert_low( } function_exit: -#ifdef UNIV_IBUF_DEBUG +#ifdef UNIV_IBUF_COUNT_DEBUG if (err == DB_SUCCESS) { fprintf(stderr, "Incrementing ibuf count of space %lu page %lu\n" @@ -3017,7 +3017,7 @@ ibuf_delete_rec( success = btr_cur_optimistic_delete(btr_pcur_get_btr_cur(pcur), mtr); if (success) { -#ifdef UNIV_IBUF_DEBUG +#ifdef UNIV_IBUF_COUNT_DEBUG fprintf(stderr, "Decrementing ibuf count of space %lu page %lu\n" "from %lu by 1\n", space, page_no, @@ -3084,7 +3084,7 @@ ibuf_delete_rec( FALSE, mtr); ut_a(err == DB_SUCCESS); -#ifdef UNIV_IBUF_DEBUG +#ifdef UNIV_IBUF_COUNT_DEBUG ibuf_count_set(space, page_no, ibuf_count_get(space, page_no) - 1); #else UT_NOT_USED(space); @@ -3371,7 +3371,7 @@ loop: } reset_bit: -#ifdef UNIV_IBUF_DEBUG +#ifdef UNIV_IBUF_COUNT_DEBUG if (ibuf_count_get(space, page_no) > 0) { /* btr_print_tree(ibuf_data->index->tree, 100); ibuf_print(); */ @@ -3426,7 +3426,7 @@ reset_bit: } ibuf_exit(); -#ifdef UNIV_IBUF_DEBUG +#ifdef UNIV_IBUF_COUNT_DEBUG ut_a(ibuf_count_get(space, page_no) == 0); #endif } @@ -3629,7 +3629,7 @@ ibuf_print( FILE* file) /* in: file where to print */ { ibuf_data_t* data; -#ifdef UNIV_IBUF_DEBUG +#ifdef UNIV_IBUF_COUNT_DEBUG ulint i; #endif @@ -3647,7 +3647,7 @@ ibuf_print( (ulong) data->n_inserts, (ulong) data->n_merged_recs, (ulong) data->n_merges); -#ifdef UNIV_IBUF_DEBUG +#ifdef UNIV_IBUF_COUNT_DEBUG for (i = 0; i < IBUF_COUNT_N_PAGES; i++) { if (ibuf_count_get(data->space, i) > 0) { diff --git a/include/ibuf0ibuf.h b/include/ibuf0ibuf.h index c03dc132dc4..1f9a0346e1e 100644 --- a/include/ibuf0ibuf.h +++ b/include/ibuf0ibuf.h @@ -269,7 +269,7 @@ ibuf_parse_bitmap_init( byte* end_ptr,/* in: buffer end */ buf_block_t* block, /* in: block or NULL */ mtr_t* mtr); /* in: mtr or NULL */ -#ifdef UNIV_IBUF_DEBUG +#ifdef UNIV_IBUF_COUNT_DEBUG /********************************************************************** Gets the ibuf count for a given page. */ diff --git a/include/univ.i b/include/univ.i index dac4dfbf7c8..f12bff8e9e1 100644 --- a/include/univ.i +++ b/include/univ.i @@ -90,7 +90,8 @@ memory is read outside the allocated blocks. */ #define UNIV_HASH_DEBUG /* debug HASH_ macros */ #define UNIV_LIST_DEBUG /* debug UT_LIST_ macros */ #define UNIV_MEM_DEBUG /* detect memory leaks etc */ -#define UNIV_IBUF_DEBUG /* debug the insert buffer; +#define UNIV_IBUF_DEBUG /* debug the insert buffer */ +#define UNIV_IBUF_COUNT_DEBUG /* debug the insert buffer; this limits the database to IBUF_COUNT_N_SPACES and IBUF_COUNT_N_PAGES, and the insert buffer must be empty when the database is started */ #define UNIV_SYNC_DEBUG /* debug mutex and latch