Commit 5e7796c0 authored by heikki@hundin.mysql.fi's avatar heikki@hundin.mysql.fi
Browse files

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
Loading
Loading
Loading
Loading
+41 −2
Original line number Diff line number Diff line
@@ -2483,7 +2483,9 @@ ibuf_merge_or_delete_for_page(
	ulint		old_bits;
	ulint		new_bits;
	dulint		max_trx_id;
	ibool		corruption_noticed	= FALSE;
	mtr_t		mtr;
	char		err_buf[500];

	if (srv_force_recovery >= SRV_FORCE_NO_IBUF_MERGE) {

@@ -2535,7 +2537,38 @@ ibuf_merge_or_delete_for_page(
		block = buf_block_align(page);
		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;
@@ -2579,7 +2612,13 @@ ibuf_merge_or_delete_for_page(
			goto reset_bit;
		}

	   	if (page) {
		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);
	
	   	} else if (page) {
			/* Now we have at pcur a record which should be
			inserted to the index page; NOTE that the call below
			copies pointers to fields in ibuf_rec, and we must