ibuf0ibuf.c:

  Add diagnostic prints if insert buffer merge is tried to a page whose type is not an index page, try to recover from the situation by discarding the insert buffer records
parent 9d633d9a
...@@ -2483,7 +2483,9 @@ ibuf_merge_or_delete_for_page( ...@@ -2483,7 +2483,9 @@ ibuf_merge_or_delete_for_page(
ulint old_bits; ulint old_bits;
ulint new_bits; ulint new_bits;
dulint max_trx_id; dulint max_trx_id;
ibool corruption_noticed = FALSE;
mtr_t mtr; mtr_t mtr;
char err_buf[500];
if (srv_force_recovery >= SRV_FORCE_NO_IBUF_MERGE) { if (srv_force_recovery >= SRV_FORCE_NO_IBUF_MERGE) {
...@@ -2535,7 +2537,38 @@ ibuf_merge_or_delete_for_page( ...@@ -2535,7 +2537,38 @@ ibuf_merge_or_delete_for_page(
block = buf_block_align(page); block = buf_block_align(page);
rw_lock_x_lock_move_ownership(&(block->lock)); rw_lock_x_lock_move_ownership(&(block->lock));
ut_a(fil_page_get_type(page) == FIL_PAGE_INDEX); if (fil_page_get_type(page) != FIL_PAGE_INDEX) {
corruption_noticed = TRUE;
ut_print_timestamp(stderr);
mtr_start(&mtr);
fprintf(stderr,
" InnoDB: Dump of the ibuf bitmap page:\n");
bitmap_page = ibuf_bitmap_get_map_page(space, page_no,
&mtr);
buf_page_print(bitmap_page);
mtr_commit(&mtr);
fprintf(stderr, "\nInnoDB: Dump of the page:\n");
buf_page_print(page);
fprintf(stderr,
"InnoDB: Error: corruption in the tablespace. Bitmap shows insert\n"
"InnoDB: buffer records to page n:o %lu though the page\n"
"InnoDB: type is %lu, which is not an index page!\n"
"InnoDB: We try to resolve the problem by skipping the insert buffer\n"
"InnoDB: merge for this page. Please run CHECK TABLE on your tables\n"
"InnoDB: to determine if they are corrupt after this.\n\n"
"InnoDB: Please make a detailed bug report and send it to\n"
"InnoDB: mysql@lists.mysql.com\n\n",
page_no, fil_page_get_type(page));
}
} }
n_inserts = 0; n_inserts = 0;
...@@ -2578,8 +2611,14 @@ loop: ...@@ -2578,8 +2611,14 @@ loop:
goto reset_bit; goto reset_bit;
} }
if (corruption_noticed) {
rec_sprintf(err_buf, 450, ibuf_rec);
fprintf(stderr,
"InnoDB: Discarding record\n %s\n from the insert buffer!\n\n", err_buf);
if (page) { } else if (page) {
/* Now we have at pcur a record which should be /* Now we have at pcur a record which should be
inserted to the index page; NOTE that the call below inserted to the index page; NOTE that the call below
copies pointers to fields in ibuf_rec, and we must copies pointers to fields in ibuf_rec, and we must
......
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