Commit 4299f60d authored by marko's avatar marko

ibuf_count_get(), ibuf_counts[], ibuf_counts_inited: Define these only

#ifdef UNIV_IBUF_DEBUG.  Previously, when compiled without UNIV_IBUF_DEBUG,
invoking ibuf_count_get() would crash InnoDB.  The function is only being
called #ifdef UNIV_IBUF_DEBUG.
parent 399cba57
...@@ -144,6 +144,7 @@ static ulint ibuf_rnd = 986058871; ...@@ -144,6 +144,7 @@ static ulint ibuf_rnd = 986058871;
ulint ibuf_flush_count = 0; ulint ibuf_flush_count = 0;
#ifdef UNIV_IBUF_DEBUG
/* Dimensions for the ibuf_count array */ /* Dimensions for the ibuf_count array */
#define IBUF_COUNT_N_SPACES 500 #define IBUF_COUNT_N_SPACES 500
#define IBUF_COUNT_N_PAGES 2000 #define IBUF_COUNT_N_PAGES 2000
...@@ -152,6 +153,7 @@ ulint ibuf_flush_count = 0; ...@@ -152,6 +153,7 @@ ulint ibuf_flush_count = 0;
static ulint* ibuf_counts[IBUF_COUNT_N_SPACES]; static ulint* ibuf_counts[IBUF_COUNT_N_SPACES];
static ibool ibuf_counts_inited = FALSE; static ibool ibuf_counts_inited = FALSE;
#endif
/* The start address for an insert buffer bitmap page bitmap */ /* The start address for an insert buffer bitmap page bitmap */
#define IBUF_BITMAP PAGE_DATA #define IBUF_BITMAP PAGE_DATA
...@@ -314,6 +316,7 @@ ibuf_tree_root_get( ...@@ -314,6 +316,7 @@ ibuf_tree_root_get(
return(page); return(page);
} }
#ifdef UNIV_IBUF_DEBUG
/********************************************************************** /**********************************************************************
Gets the ibuf count for a given page. */ Gets the ibuf count for a given page. */
...@@ -338,7 +341,6 @@ ibuf_count_get( ...@@ -338,7 +341,6 @@ ibuf_count_get(
/********************************************************************** /**********************************************************************
Sets the ibuf count for a given page. */ Sets the ibuf count for a given page. */
#ifdef UNIV_IBUF_DEBUG
static static
void void
ibuf_count_set( ibuf_count_set(
...@@ -389,6 +391,8 @@ ibuf_init_at_db_start(void) ...@@ -389,6 +391,8 @@ ibuf_init_at_db_start(void)
ibuf_count_set(i, j, 0); ibuf_count_set(i, j, 0);
} }
} }
ibuf_counts_inited = TRUE;
} }
#endif #endif
mutex_create(&ibuf_pessimistic_insert_mutex, mutex_create(&ibuf_pessimistic_insert_mutex,
...@@ -399,8 +403,6 @@ ibuf_init_at_db_start(void) ...@@ -399,8 +403,6 @@ ibuf_init_at_db_start(void)
mutex_create(&ibuf_bitmap_mutex, SYNC_IBUF_BITMAP_MUTEX); mutex_create(&ibuf_bitmap_mutex, SYNC_IBUF_BITMAP_MUTEX);
fil_ibuf_init_at_db_start(); fil_ibuf_init_at_db_start();
ibuf_counts_inited = TRUE;
} }
/********************************************************************** /**********************************************************************
......
...@@ -267,6 +267,7 @@ ibuf_parse_bitmap_init( ...@@ -267,6 +267,7 @@ ibuf_parse_bitmap_init(
byte* end_ptr,/* in: buffer end */ byte* end_ptr,/* in: buffer end */
page_t* page, /* in: page or NULL */ page_t* page, /* in: page or NULL */
mtr_t* mtr); /* in: mtr or NULL */ mtr_t* mtr); /* in: mtr or NULL */
#ifdef UNIV_IBUF_DEBUG
/********************************************************************** /**********************************************************************
Gets the ibuf count for a given page. */ Gets the ibuf count for a given page. */
...@@ -277,6 +278,7 @@ ibuf_count_get( ...@@ -277,6 +278,7 @@ ibuf_count_get(
currently buffered for this page */ currently buffered for this page */
ulint space, /* in: space id */ ulint space, /* in: space id */
ulint page_no);/* in: page number */ ulint page_no);/* in: page number */
#endif
/********************************************************************** /**********************************************************************
Looks if the insert buffer is empty. */ Looks if the insert buffer is empty. */
......
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