Commit 09fbd1e0 authored by marko's avatar marko

Output to the error log information about the limitations of

UNIV_IBUF_DEBUG.

innobase_start_or_create_for_mysql(): Note that crash recovery is broken
when UNIV_IBUF_DEBUG is defined.

ibuf_counts[]: Make this a two-dimensional array.  No need to allocate
anything from the heap.  Eliminate ibuf_counts_inited, as the array
will be zero-filled by the runtime environment.

ibuf_count_check(): New function, to print out an explanation before
assertion failure.
parent 52438c35
...@@ -150,9 +150,30 @@ ulint ibuf_flush_count = 0; ...@@ -150,9 +150,30 @@ ulint ibuf_flush_count = 0;
#define IBUF_COUNT_N_PAGES 2000 #define IBUF_COUNT_N_PAGES 2000
/* Buffered entry counts for file pages, used in debugging */ /* Buffered entry counts for file pages, used in debugging */
static ulint* ibuf_counts[IBUF_COUNT_N_SPACES]; static ulint ibuf_counts[IBUF_COUNT_N_SPACES][IBUF_COUNT_N_PAGES];
static ibool ibuf_counts_inited = FALSE; /**********************************************************************
Checks that the indexes to ibuf_counts[][] are within limits. */
UNIV_INLINE
void
ibuf_count_check(
/*=============*/
ulint space_id, /* in: space identifier */
ulint page_no) /* in: page number */
{
if (space_id < IBUF_COUNT_N_SPACES && page_no < IBUF_COUNT_N_PAGES) {
return;
}
fprintf(stderr,
"InnoDB: UNIV_IBUF_DEBUG limits space_id and page_no\n"
"InnoDB: and breaks crash recovery.\n"
"InnoDB: space_id=%lu, should be 0<=space_id<%lu\n"
"InnoDB: page_no=%lu, should be 0<=page_no<%lu\n",
(ulint) space_id, (ulint) IBUF_COUNT_N_SPACES,
(ulint) page_no, (ulint) IBUF_COUNT_N_PAGES);
ut_error;
}
#endif #endif
/* The start address for an insert buffer bitmap page bitmap */ /* The start address for an insert buffer bitmap page bitmap */
...@@ -328,15 +349,9 @@ ibuf_count_get( ...@@ -328,15 +349,9 @@ ibuf_count_get(
ulint space, /* in: space id */ ulint space, /* in: space id */
ulint page_no)/* in: page number */ ulint page_no)/* in: page number */
{ {
ut_ad(space < IBUF_COUNT_N_SPACES); ibuf_count_check(space, page_no);
ut_ad(page_no < IBUF_COUNT_N_PAGES);
if (!ibuf_counts_inited) {
return(0); return(ibuf_counts[space][page_no]);
}
return(*(ibuf_counts[space] + page_no));
} }
/********************************************************************** /**********************************************************************
...@@ -349,11 +364,10 @@ ibuf_count_set( ...@@ -349,11 +364,10 @@ ibuf_count_set(
ulint page_no,/* in: page number */ ulint page_no,/* in: page number */
ulint val) /* in: value to set */ ulint val) /* in: value to set */
{ {
ut_a(space < IBUF_COUNT_N_SPACES); ibuf_count_check(space, page_no);
ut_a(page_no < IBUF_COUNT_N_PAGES);
ut_a(val < UNIV_PAGE_SIZE); ut_a(val < UNIV_PAGE_SIZE);
*(ibuf_counts[space] + page_no) = val; ibuf_counts[space][page_no] = val;
} }
#endif #endif
...@@ -378,22 +392,6 @@ ibuf_init_at_db_start(void) ...@@ -378,22 +392,6 @@ ibuf_init_at_db_start(void)
ibuf->size = 0; ibuf->size = 0;
#ifdef UNIV_IBUF_DEBUG
{
ulint i, j;
for (i = 0; i < IBUF_COUNT_N_SPACES; i++) {
ibuf_counts[i] = mem_alloc(sizeof(ulint)
* IBUF_COUNT_N_PAGES);
for (j = 0; j < IBUF_COUNT_N_PAGES; j++) {
ibuf_count_set(i, j, 0);
}
}
ibuf_counts_inited = TRUE;
}
#endif
mutex_create(&ibuf_pessimistic_insert_mutex, mutex_create(&ibuf_pessimistic_insert_mutex,
SYNC_IBUF_PESS_INSERT_MUTEX); SYNC_IBUF_PESS_INSERT_MUTEX);
......
...@@ -1025,6 +1025,12 @@ innobase_start_or_create_for_mysql(void) ...@@ -1025,6 +1025,12 @@ innobase_start_or_create_for_mysql(void)
"InnoDB: !!!!!!!! UNIV_DEBUG switched on !!!!!!!!!\n"); "InnoDB: !!!!!!!! UNIV_DEBUG switched on !!!!!!!!!\n");
#endif #endif
#ifdef UNIV_IBUF_DEBUG
fprintf(stderr,
"InnoDB: !!!!!!!! UNIV_IBUF_DEBUG switched on !!!!!!!!!\n"
"InnoDB: Crash recovery will fail with UNIV_IBUF_DEBUG\n");
#endif
#ifdef UNIV_SYNC_DEBUG #ifdef UNIV_SYNC_DEBUG
fprintf(stderr, fprintf(stderr,
"InnoDB: !!!!!!!! UNIV_SYNC_DEBUG switched on !!!!!!!!!\n"); "InnoDB: !!!!!!!! UNIV_SYNC_DEBUG switched on !!!!!!!!!\n");
......
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