Commit 772aa0c5 authored by Jan Lindström's avatar Jan Lindström

MDEV-6160: InnoDB: Failing assertion: page_is_comp(next_page) == page_is_comp(page)

This is not yet a fix. This is change to print additional information at the point
when this assertion is going to happen. Print as much information about the pages
and index to find out why next page is not a compact format.
parent 53612e77
......@@ -68,6 +68,7 @@ Created 10/16/1994 Heikki Tuuri
#include "ibuf0ibuf.h"
#include "lock0lock.h"
#include "zlib.h"
#include "fil0fil.h"
/** Buffered B-tree operation types, introduced as part of delete buffering. */
typedef enum btr_op_enum {
......@@ -258,7 +259,23 @@ btr_cur_latch_leaves(
get_block = btr_block_get(
space, zip_size, page_no, mode, cursor->index, mtr);
#ifdef UNIV_BTR_DEBUG
if (page_is_comp(get_block->frame) != page_is_comp(page)) {
btr_pages_info(page, get_block->frame, space,
zip_size, page_no, latch_mode,
cursor->index,
btr_page_get_next(page, mtr),
btr_page_get_prev(page, mtr),
buf_block_get_space(get_block),
buf_block_get_zip_size(get_block),
btr_page_get_next(get_block->frame, mtr),
btr_page_get_prev(get_block->frame, mtr),
mtr, __FILE__, __LINE__);
fprintf(stderr, "InnoDB: Info: latch_mode == %lu mode == %lu\n", latch_mode, mode);
ut_a(page_is_comp(get_block->frame) == page_is_comp(page));
}
#endif /* UNIV_BTR_DEBUG */
get_block->check_index_page_at_flush = TRUE;
return;
......@@ -271,10 +288,25 @@ btr_cur_latch_leaves(
space, zip_size, left_page_no,
RW_X_LATCH, cursor->index, mtr);
#ifdef UNIV_BTR_DEBUG
if (page_is_comp(get_block->frame) != page_is_comp(page)) {
btr_pages_info(page, get_block->frame, space,
zip_size, left_page_no, latch_mode,
cursor->index,
btr_page_get_next(page, mtr),
btr_page_get_prev(page, mtr),
buf_block_get_space(get_block),
buf_block_get_zip_size(get_block),
btr_page_get_next(get_block->frame, mtr),
btr_page_get_prev(get_block->frame, mtr),
mtr, __FILE__, __LINE__);
fprintf(stderr, "InnoDB: Info: latch_mode %lu mode %lu\n", latch_mode, mode);
ut_a(page_is_comp(get_block->frame)
== page_is_comp(page));
ut_a(btr_page_get_next(get_block->frame, mtr)
== page_get_page_no(page));
}
#endif /* UNIV_BTR_DEBUG */
get_block->check_index_page_at_flush = TRUE;
}
......@@ -283,7 +315,21 @@ btr_cur_latch_leaves(
space, zip_size, page_no,
RW_X_LATCH, cursor->index, mtr);
#ifdef UNIV_BTR_DEBUG
if (page_is_comp(get_block->frame) != page_is_comp(page)) {
btr_pages_info(page, get_block->frame, space,
zip_size, page_no, latch_mode,
cursor->index,
btr_page_get_next(page, mtr),
btr_page_get_prev(page, mtr),
buf_block_get_space(get_block),
buf_block_get_zip_size(get_block),
btr_page_get_next(get_block->frame, mtr),
btr_page_get_prev(get_block->frame, mtr),
mtr, __FILE__, __LINE__);
fprintf(stderr, "InnoDB: Info: mode %lu\n", mode);
ut_a(page_is_comp(get_block->frame) == page_is_comp(page));
}
#endif /* UNIV_BTR_DEBUG */
get_block->check_index_page_at_flush = TRUE;
......@@ -294,10 +340,24 @@ btr_cur_latch_leaves(
space, zip_size, right_page_no,
RW_X_LATCH, cursor->index, mtr);
#ifdef UNIV_BTR_DEBUG
if (page_is_comp(get_block->frame) != page_is_comp(page)) {
btr_pages_info(page, get_block->frame, space,
zip_size, right_page_no, latch_mode,
cursor->index,
btr_page_get_next(page, mtr),
btr_page_get_prev(page, mtr),
buf_block_get_space(get_block),
buf_block_get_zip_size(get_block),
btr_page_get_next(get_block->frame, mtr),
btr_page_get_prev(get_block->frame, mtr),
mtr, __FILE__, __LINE__);
fprintf(stderr, "InnoDB: Info: latch_mode %lu mode %lu\n", latch_mode, mode);
ut_a(page_is_comp(get_block->frame)
== page_is_comp(page));
ut_a(btr_page_get_prev(get_block->frame, mtr)
== page_get_page_no(page));
}
#endif /* UNIV_BTR_DEBUG */
get_block->check_index_page_at_flush = TRUE;
}
......@@ -316,10 +376,24 @@ btr_cur_latch_leaves(
left_page_no, mode, cursor->index, mtr);
cursor->left_block = get_block;
#ifdef UNIV_BTR_DEBUG
if (page_is_comp(get_block->frame) != page_is_comp(page)) {
btr_pages_info(page, get_block->frame, space,
zip_size, left_page_no, latch_mode,
cursor->index,
btr_page_get_next(page, mtr),
btr_page_get_prev(page, mtr),
buf_block_get_space(get_block),
buf_block_get_zip_size(get_block),
btr_page_get_next(get_block->frame, mtr),
btr_page_get_prev(get_block->frame, mtr),
mtr, __FILE__, __LINE__);
fprintf(stderr, "InnoDB: Info: latch_mode %lu mode %lu\n", latch_mode, mode);
ut_a(page_is_comp(get_block->frame)
== page_is_comp(page));
ut_a(btr_page_get_next(get_block->frame, mtr)
== page_get_page_no(page));
}
#endif /* UNIV_BTR_DEBUG */
get_block->check_index_page_at_flush = TRUE;
}
......@@ -327,7 +401,22 @@ btr_cur_latch_leaves(
get_block = btr_block_get(
space, zip_size, page_no, mode, cursor->index, mtr);
#ifdef UNIV_BTR_DEBUG
if (page_is_comp(get_block->frame) != page_is_comp(page)) {
btr_pages_info(page, get_block->frame, space,
zip_size, page_no, latch_mode,
cursor->index,
btr_page_get_next(page, mtr),
btr_page_get_prev(page, mtr),
buf_block_get_space(get_block),
buf_block_get_zip_size(get_block),
btr_page_get_next(get_block->frame, mtr),
btr_page_get_prev(get_block->frame, mtr),
mtr, __FILE__, __LINE__);
fprintf(stderr, "InnoDB: Info: latch_mode %lu mode %lu\n", latch_mode, mode);
ut_a(page_is_comp(get_block->frame) == page_is_comp(page));
}
#endif /* UNIV_BTR_DEBUG */
get_block->check_index_page_at_flush = TRUE;
return;
......@@ -5388,3 +5477,169 @@ btr_rec_copy_externally_stored_field(
zip_size, local_len, heap));
}
#endif /* !UNIV_HOTBACKUP */
/*******************************************************************//**
Print information about old page and a new page on a B-tree when
we note that page types do not match.*/
void
btr_pages_info(
page_t* old_page, /*!< in: Page where we were */
page_t* new_page, /*!< in: Page where we travelsed */
ulint space_id, /*!< in: space id */
ulint zip_size, /*!< in: zip size */
ulint page_no, /*!< in: Page id where travelsed */
ulint latch_mode, /*!< in: Used latch mode */
dict_index_t* index, /*!< in: Used index */
ulint old_next_page_no, /*!< in: Next page number from old page */
ulint old_prev_page_no, /*!< in: Prev page number from old page */
ulint new_space_id, /*!< in: Space id of new page */
ulint new_zip_size, /*!< in: Zip size of new page */
ulint new_next_page_no, /*!< in: Next page number from new page */
ulint new_prev_page_no, /*!< in: Prev page number from new page */
mtr_t* mtr, /*!< in: mini transaction */
const char* file, /*!< in: file name where called */
ulint line) /*!< in: line number where called */
{
const char* old_name = fil_space_get_name(space_id);
const char* new_name = fil_space_get_name(new_space_id);
const char* name=NULL;
ulint spaceid=0,space=0;
buf_block_t* block=NULL;
page_t* page=NULL;
fprintf(stderr,"InnoDB: === Error: Index corruption detected ! === \n");
fprintf(stderr,"InnoDB File %s Line %lu \n", file, line);
dict_index_name_print(stderr, NULL, index);
fprintf(stderr,"InnoDB: Current page = %p \n", old_page);
fprintf(stderr,"InnoDB: New page = %p \n", new_page);
fprintf(stderr,"InnoDB: Current page->page_no = %lu \n", page_get_page_no(old_page));
fprintf(stderr,"InnoDB: New page->page_no = %lu \n", page_get_page_no(new_page));
fprintf(stderr,"InnoDB: Current page->space_id = %lu \n", page_get_space_id(old_page));
fprintf(stderr,"InnoDB: New page->space_id = %lu \n", page_get_space_id(new_page));
fprintf(stderr,"InnoDB: Current page->n_recs = %lu \n", page_get_n_recs(old_page));
fprintf(stderr,"InnoDB: New page->n_recs = %lu \n", page_get_n_recs(new_page));
fprintf(stderr,"InnoDB: Current page->n_slots = %lu \n", page_dir_get_n_slots(old_page));
fprintf(stderr,"InnoDB: New page->n_slots = %lu \n", page_dir_get_n_slots(new_page));
fprintf(stderr,"InnoDB: Current page->is_compact = %lu \n", page_is_comp(old_page));
fprintf(stderr,"InnoDB: New page->is_compact = %lu \n", page_is_comp(new_page));
fprintf(stderr,"InnoDB: Current page->is_leaf = %lu \n", page_is_leaf(old_page));
fprintf(stderr,"InnoDB: New page->is_leaf = %lu \n", page_is_leaf(new_page));
fprintf(stderr,"InnoDB: Current page valid = %lu \n", page_validate(old_page, index));
fprintf(stderr,"InnoDB: New page valid = %lu \n", page_validate(new_page, index));
fprintf(stderr,"InnoDB: Current page number = %lu \n", page_no);
fprintf(stderr,"InnoDB: Current page next page number = %lu \n", old_next_page_no);
fprintf(stderr,"InnoDB: Current page prev page number = %lu \n", old_prev_page_no);
fprintf(stderr,"InnoDB: New page next page number = %lu \n", new_next_page_no);
fprintf(stderr,"InnoDB: New page prev page number = %lu \n", new_prev_page_no);
fprintf(stderr,"InnoDB: Current page space_id = %lu \n", space_id);
fprintf(stderr,"InnoDB: New page space_id = %lu \n", new_space_id);
if (old_name)
fprintf(stderr,"InnoDB: Current page file = %s \n", old_name);
if (new_name)
fprintf(stderr,"InnoDB: New page file = %s \n", new_name);
fprintf(stderr,"InnoDB: OLD NEXT PAGE ID INFO = %lu \n", old_next_page_no);
if (old_next_page_no != FIL_NULL) {
block = btr_block_get(space_id, zip_size, old_next_page_no,
BTR_NO_LATCHES,
index, mtr);
space = buf_block_get_space(block);
zip_size = buf_block_get_zip_size(block);
fprintf(stderr,"InnoDB: Block space_id = %lu \n", space);
fprintf(stderr,"InnoDB: Block zip_size = %lu \n", zip_size);
page = buf_block_get_frame(block);
spaceid = page_get_space_id(page);
name = fil_space_get_name(spaceid);
fprintf(stderr,"InnoDB: Page space_id = %lu \n", space_id);
if (name)
fprintf(stderr,"InnoDB: Page file = %s \n", name);
fprintf(stderr,"InnoDB: Page->page_no = %lu \n", page_get_page_no(page));
fprintf(stderr,"InnoDB: Page->space_id = %lu \n", page_get_space_id(page));
fprintf(stderr,"InnoDB: Page->n_recs = %lu \n", page_get_n_recs(page));
fprintf(stderr,"InnoDB: Page->n_slots = %lu \n", page_dir_get_n_slots(page));
fprintf(stderr,"InnoDB: Page->is_compact = %lu \n", page_is_comp(page));
fprintf(stderr,"InnoDB: Page->is_leaf = %lu \n", page_is_leaf(page));
fprintf(stderr,"InnoDB: Page valid = %lu \n", page_validate(page, index));
}
fprintf(stderr,"InnoDB: OLD PREV PAGE ID INFO = %lu \n", old_prev_page_no);
if (old_prev_page_no != FIL_NULL) {
block = btr_block_get(space_id, zip_size, old_prev_page_no,
BTR_NO_LATCHES,
index, mtr);
space = buf_block_get_space(block);
zip_size = buf_block_get_zip_size(block);
fprintf(stderr,"InnoDB: Block space_id = %lu \n", space);
fprintf(stderr,"InnoDB: Block zip_size = %lu \n", zip_size);
page = buf_block_get_frame(block);
spaceid = page_get_space_id(page);
name = fil_space_get_name(spaceid);
fprintf(stderr,"InnoDB: Page space_id = %lu \n", space_id);
if (name)
fprintf(stderr,"InnoDB: Page file = %s \n", name);
fprintf(stderr,"InnoDB: Page->page_no = %lu \n", page_get_page_no(page));
fprintf(stderr,"InnoDB: Page->space_id = %lu \n", page_get_space_id(page));
fprintf(stderr,"InnoDB: Page->n_recs = %lu \n", page_get_n_recs(page));
fprintf(stderr,"InnoDB: Page->n_slots = %lu \n", page_dir_get_n_slots(page));
fprintf(stderr,"InnoDB: Page->is_compact = %lu \n", page_is_comp(page));
fprintf(stderr,"InnoDB: Page->is_leaf = %lu \n", page_is_leaf(page));
fprintf(stderr,"InnoDB: Page valid = %lu \n", page_validate(page, index));
}
fprintf(stderr,"InnoDB: NEW NEXT PAGE ID INFO = %lu \n", new_next_page_no);
if (new_next_page_no != FIL_NULL) {
block = btr_block_get(space_id, zip_size, new_next_page_no,
BTR_NO_LATCHES,
index, mtr);
space = buf_block_get_space(block);
zip_size = buf_block_get_zip_size(block);
fprintf(stderr,"InnoDB: Block space_id = %lu \n", space);
fprintf(stderr,"InnoDB: Block zip_size = %lu \n", zip_size);
page = buf_block_get_frame(block);
spaceid = page_get_space_id(page);
name = fil_space_get_name(spaceid);
fprintf(stderr,"InnoDB: Page space_id = %lu \n", space_id);
if (name)
fprintf(stderr,"InnoDB: Page file = %s \n", name);
fprintf(stderr,"InnoDB: Page->page_no = %lu \n", page_get_page_no(page));
fprintf(stderr,"InnoDB: Page->space_id = %lu \n", page_get_space_id(page));
fprintf(stderr,"InnoDB: Page->n_recs = %lu \n", page_get_n_recs(page));
fprintf(stderr,"InnoDB: Page->n_slots = %lu \n", page_dir_get_n_slots(page));
fprintf(stderr,"InnoDB: Page->is_compact = %lu \n", page_is_comp(page));
fprintf(stderr,"InnoDB: Page->is_leaf = %lu \n", page_is_leaf(page));
fprintf(stderr,"InnoDB: Page valid = %lu \n", page_validate(page, index));
}
fprintf(stderr,"InnoDB: NEW PREV PAGE ID INFO = %lu \n", new_prev_page_no);
if (new_prev_page_no != FIL_NULL) {
block = btr_block_get(space_id, zip_size, new_prev_page_no,
BTR_NO_LATCHES,
index, mtr);
page = buf_block_get_frame(block);
spaceid = page_get_space_id(page);
name = fil_space_get_name(spaceid);
fprintf(stderr,"InnoDB: Page space_id = %lu \n", space_id);
if (name)
fprintf(stderr,"InnoDB: Page file = %s \n", name);
fprintf(stderr,"InnoDB: Page->page_no = %lu \n", page_get_page_no(page));
fprintf(stderr,"InnoDB: Page->space_id = %lu \n", page_get_space_id(page));
fprintf(stderr,"InnoDB: Page->n_recs = %lu \n", page_get_n_recs(page));
fprintf(stderr,"InnoDB: Page->n_slots = %lu \n", page_dir_get_n_slots(page));
fprintf(stderr,"InnoDB: Page->is_compact = %lu \n", page_is_comp(page));
fprintf(stderr,"InnoDB: Page->is_leaf = %lu \n", page_is_leaf(page));
fprintf(stderr,"InnoDB: Page valid = %lu \n", page_validate(page, index));
}
}
......@@ -425,9 +425,24 @@ btr_pcur_move_to_next_page(
btr_pcur_get_btr_cur(cursor)->index, mtr);
next_page = buf_block_get_frame(next_block);
#ifdef UNIV_BTR_DEBUG
if (page_is_comp(next_page) != page_is_comp(page)) {
btr_pages_info(page, next_page, space,
zip_size, next_page_no, cursor->latch_mode,
btr_pcur_get_btr_cur(cursor)->index,
btr_page_get_next(page, mtr),
btr_page_get_prev(page, mtr),
buf_block_get_space(next_block),
buf_block_get_zip_size(next_block),
btr_page_get_next(next_page, mtr),
btr_page_get_prev(next_page, mtr),
mtr, __FILE__, __LINE__);
ut_a(page_is_comp(next_page) == page_is_comp(page));
ut_a(btr_page_get_prev(next_page, mtr)
== buf_block_get_page_no(btr_pcur_get_block(cursor)));
}
#endif /* UNIV_BTR_DEBUG */
next_block->check_index_page_at_flush = TRUE;
......
......@@ -457,6 +457,21 @@ fil_space_get_by_id(
return(space);
}
/*******************************************************************//**
Returns the table space name for a given id, NULL if not found. */
const char*
fil_space_get_name(
/*================*/
ulint id) /*!< in: space id */
{
fil_space_t* space;
mutex_enter(&fil_system->mutex);
space = fil_space_get_by_id(id);
mutex_exit(&fil_system->mutex);
return (space == NULL ? NULL : space->name);
}
/*******************************************************************//**
Returns the table space by a given name, NULL if not found. */
UNIV_INLINE
......
......@@ -825,6 +825,28 @@ extern ulint btr_cur_n_sea_old;
extern uint btr_cur_limit_optimistic_insert_debug;
#endif /* UNIV_DEBUG */
/*******************************************************************//**
Print information about old page and a new page on a B-tree when
we note that page types do not match.*/
void
btr_pages_info(
page_t* old_page, /*!< in: Page where we were */
page_t* new_page, /*!< in: Page where we travelsed */
ulint space_id, /*!< in: space id */
ulint zip_size, /*!< in: zip size */
ulint page_no, /*!< in: Page id where travelsed */
ulint latch_mode, /*!< in: Used latch mode */
dict_index_t* index, /*!< in: Used index */
ulint old_next_page_no, /*!< in: Next page number from old page */
ulint old_prev_page_no, /*!< in: Prev page number from old page */
ulint new_space_id, /*!< in: Space id of new page */
ulint new_zip_size, /*!< in: Zip size of new page */
ulint new_next_page_no, /*!< in: Next page number from new page */
ulint new_prev_page_no, /*!< in: Prev page number from new page */
mtr_t* mtr, /*!< in: mini transaction */
const char* file, /*!< in: file name where called */
ulint line); /*!< in: line number where called */
#ifndef UNIV_NONINL
#include "btr0cur.ic"
#endif
......
......@@ -752,6 +752,14 @@ fil_mtr_rename_log(
const char* tmp_name); /*!< in: temp table name used while
swapping */
typedef struct fil_space_struct fil_space_t;
/*******************************************************************//**
Returns the table space name for a given id, NULL if not found. */
const char*
fil_space_get_name(
/*================*/
ulint id); /*!< in: space id */
#endif
......@@ -68,6 +68,7 @@ Created 10/16/1994 Heikki Tuuri
#include "ibuf0ibuf.h"
#include "lock0lock.h"
#include "zlib.h"
#include "fil0fil.h"
/** Buffered B-tree operation types, introduced as part of delete buffering. */
typedef enum btr_op_enum {
......@@ -262,7 +263,23 @@ btr_cur_latch_leaves(
SRV_CORRUPT_TABLE_CHECK(get_block, return;);
#ifdef UNIV_BTR_DEBUG
if (page_is_comp(get_block->frame) != page_is_comp(page)) {
btr_pages_info(page, get_block->frame, space,
zip_size, page_no, latch_mode,
cursor->index,
btr_page_get_next(page, mtr),
btr_page_get_prev(page, mtr),
buf_block_get_space(get_block),
buf_block_get_zip_size(get_block),
btr_page_get_next(get_block->frame, mtr),
btr_page_get_prev(get_block->frame, mtr),
mtr, __FILE__, __LINE__);
fprintf(stderr, "InnoDB: Info: latch_mode == %lu mode == %lu\n", latch_mode, mode);
ut_a(page_is_comp(get_block->frame) == page_is_comp(page));
}
#endif /* UNIV_BTR_DEBUG */
get_block->check_index_page_at_flush = TRUE;
return;
......@@ -285,10 +302,25 @@ btr_cur_latch_leaves(
SRV_CORRUPT_TABLE_CHECK(get_block, return;);
#ifdef UNIV_BTR_DEBUG
if (page_is_comp(get_block->frame) != page_is_comp(page)) {
btr_pages_info(page, get_block->frame, space,
zip_size, left_page_no, latch_mode,
cursor->index,
btr_page_get_next(page, mtr),
btr_page_get_prev(page, mtr),
buf_block_get_space(get_block),
buf_block_get_zip_size(get_block),
btr_page_get_next(get_block->frame, mtr),
btr_page_get_prev(get_block->frame, mtr),
mtr, __FILE__, __LINE__);
fprintf(stderr, "InnoDB: Info: sibling_mode %lu mode %lu\n", sibling_mode, mode);
ut_a(page_is_comp(get_block->frame)
== page_is_comp(page));
ut_a(btr_page_get_next(get_block->frame, mtr)
== page_get_page_no(page));
}
#endif /* UNIV_BTR_DEBUG */
if (sibling_mode == RW_NO_LATCH) {
/* btr_block_get() called with RW_NO_LATCH will
......@@ -309,7 +341,21 @@ btr_cur_latch_leaves(
SRV_CORRUPT_TABLE_CHECK(get_block, return;);
#ifdef UNIV_BTR_DEBUG
if (page_is_comp(get_block->frame) != page_is_comp(page)) {
btr_pages_info(page, get_block->frame, space,
zip_size, page_no, latch_mode,
cursor->index,
btr_page_get_next(page, mtr),
btr_page_get_prev(page, mtr),
buf_block_get_space(get_block),
buf_block_get_zip_size(get_block),
btr_page_get_next(get_block->frame, mtr),
btr_page_get_prev(get_block->frame, mtr),
mtr, __FILE__, __LINE__);
fprintf(stderr, "InnoDB: Info: mode %lu\n", mode);
ut_a(page_is_comp(get_block->frame) == page_is_comp(page));
}
#endif /* UNIV_BTR_DEBUG */
get_block->check_index_page_at_flush = TRUE;
......@@ -323,10 +369,24 @@ btr_cur_latch_leaves(
SRV_CORRUPT_TABLE_CHECK(get_block, return;);
#ifdef UNIV_BTR_DEBUG
if (page_is_comp(get_block->frame) != page_is_comp(page)) {
btr_pages_info(page, get_block->frame, space,
zip_size, right_page_no, latch_mode,
cursor->index,
btr_page_get_next(page, mtr),
btr_page_get_prev(page, mtr),
buf_block_get_space(get_block),
buf_block_get_zip_size(get_block),
btr_page_get_next(get_block->frame, mtr),
btr_page_get_prev(get_block->frame, mtr),
mtr, __FILE__, __LINE__);
fprintf(stderr, "InnoDB: Info: sibling_mode %lu mode %lu\n", sibling_mode, mode);
ut_a(page_is_comp(get_block->frame)
== page_is_comp(page));
ut_a(btr_page_get_prev(get_block->frame, mtr)
== page_get_page_no(page));
}
#endif /* UNIV_BTR_DEBUG */
if (sibling_mode == RW_NO_LATCH) {
mtr_memo_release(mtr, get_block,
......@@ -353,10 +413,24 @@ btr_cur_latch_leaves(
SRV_CORRUPT_TABLE_CHECK(get_block, return;);
#ifdef UNIV_BTR_DEBUG
if (page_is_comp(get_block->frame) != page_is_comp(page)) {
btr_pages_info(page, get_block->frame, space,
zip_size, left_page_no, latch_mode,
cursor->index,
btr_page_get_next(page, mtr),
btr_page_get_prev(page, mtr),
buf_block_get_space(get_block),
buf_block_get_zip_size(get_block),
btr_page_get_next(get_block->frame, mtr),
btr_page_get_prev(get_block->frame, mtr),
mtr, __FILE__, __LINE__);
fprintf(stderr, "InnoDB: Info: latch_mode %lu mode %lu\n", latch_mode, mode);
ut_a(page_is_comp(get_block->frame)
== page_is_comp(page));
ut_a(btr_page_get_next(get_block->frame, mtr)
== page_get_page_no(page));
}
#endif /* UNIV_BTR_DEBUG */
get_block->check_index_page_at_flush = TRUE;
}
......@@ -367,7 +441,22 @@ btr_cur_latch_leaves(
SRV_CORRUPT_TABLE_CHECK(get_block, return;);
#ifdef UNIV_BTR_DEBUG
if (page_is_comp(get_block->frame) != page_is_comp(page)) {
btr_pages_info(page, get_block->frame, space,
zip_size, page_no, latch_mode,
cursor->index,
btr_page_get_next(page, mtr),
btr_page_get_prev(page, mtr),
buf_block_get_space(get_block),
buf_block_get_zip_size(get_block),
btr_page_get_next(get_block->frame, mtr),
btr_page_get_prev(get_block->frame, mtr),
mtr, __FILE__, __LINE__);
fprintf(stderr, "InnoDB: Info: latch_mode %lu mode %lu\n", latch_mode, mode);
ut_a(page_is_comp(get_block->frame) == page_is_comp(page));
}
#endif /* UNIV_BTR_DEBUG */
get_block->check_index_page_at_flush = TRUE;
return;
......@@ -5582,3 +5671,169 @@ btr_rec_copy_externally_stored_field(
zip_size, local_len, heap));
}
#endif /* !UNIV_HOTBACKUP */
/*******************************************************************//**
Print information about old page and a new page on a B-tree when
we note that page types do not match.*/
void
btr_pages_info(
page_t* old_page, /*!< in: Page where we were */
page_t* new_page, /*!< in: Page where we travelsed */
ulint space_id, /*!< in: space id */
ulint zip_size, /*!< in: zip size */
ulint page_no, /*!< in: Page id where travelsed */
ulint latch_mode, /*!< in: Used latch mode */
dict_index_t* index, /*!< in: Used index */
ulint old_next_page_no, /*!< in: Next page number from old page */
ulint old_prev_page_no, /*!< in: Prev page number from old page */
ulint new_space_id, /*!< in: Space id of new page */
ulint new_zip_size, /*!< in: Zip size of new page */
ulint new_next_page_no, /*!< in: Next page number from new page */
ulint new_prev_page_no, /*!< in: Prev page number from new page */
mtr_t* mtr, /*!< in: mini transaction */
const char* file, /*!< in: file name where called */
ulint line) /*!< in: line number where called */
{
const char* old_name = fil_space_get_name(space_id);
const char* new_name = fil_space_get_name(new_space_id);
const char* name=NULL;
ulint spaceid=0,space=0;
buf_block_t* block=NULL;
page_t* page=NULL;
fprintf(stderr,"InnoDB: === Error: Index corruption detected ! === \n");
fprintf(stderr,"InnoDB File %s Line %lu \n", file, line);
dict_index_name_print(stderr, NULL, index);
fprintf(stderr,"InnoDB: Current page = %p \n", old_page);
fprintf(stderr,"InnoDB: New page = %p \n", new_page);
fprintf(stderr,"InnoDB: Current page->page_no = %lu \n", page_get_page_no(old_page));
fprintf(stderr,"InnoDB: New page->page_no = %lu \n", page_get_page_no(new_page));
fprintf(stderr,"InnoDB: Current page->space_id = %lu \n", page_get_space_id(old_page));
fprintf(stderr,"InnoDB: New page->space_id = %lu \n", page_get_space_id(new_page));
fprintf(stderr,"InnoDB: Current page->n_recs = %lu \n", page_get_n_recs(old_page));
fprintf(stderr,"InnoDB: New page->n_recs = %lu \n", page_get_n_recs(new_page));
fprintf(stderr,"InnoDB: Current page->n_slots = %lu \n", page_dir_get_n_slots(old_page));
fprintf(stderr,"InnoDB: New page->n_slots = %lu \n", page_dir_get_n_slots(new_page));
fprintf(stderr,"InnoDB: Current page->is_compact = %lu \n", page_is_comp(old_page));
fprintf(stderr,"InnoDB: New page->is_compact = %lu \n", page_is_comp(new_page));
fprintf(stderr,"InnoDB: Current page->is_leaf = %lu \n", page_is_leaf(old_page));
fprintf(stderr,"InnoDB: New page->is_leaf = %lu \n", page_is_leaf(new_page));
fprintf(stderr,"InnoDB: Current page valid = %lu \n", page_validate(old_page, index));
fprintf(stderr,"InnoDB: New page valid = %lu \n", page_validate(new_page, index));
fprintf(stderr,"InnoDB: Current page number = %lu \n", page_no);
fprintf(stderr,"InnoDB: Current page next page number = %lu \n", old_next_page_no);
fprintf(stderr,"InnoDB: Current page prev page number = %lu \n", old_prev_page_no);
fprintf(stderr,"InnoDB: New page next page number = %lu \n", new_next_page_no);
fprintf(stderr,"InnoDB: New page prev page number = %lu \n", new_prev_page_no);
fprintf(stderr,"InnoDB: Current page space_id = %lu \n", space_id);
fprintf(stderr,"InnoDB: New page space_id = %lu \n", new_space_id);
if (old_name)
fprintf(stderr,"InnoDB: Current page file = %s \n", old_name);
if (new_name)
fprintf(stderr,"InnoDB: New page file = %s \n", new_name);
fprintf(stderr,"InnoDB: OLD NEXT PAGE ID INFO = %lu \n", old_next_page_no);
if (old_next_page_no != FIL_NULL) {
block = btr_block_get(space_id, zip_size, old_next_page_no,
BTR_NO_LATCHES,
index, mtr);
space = buf_block_get_space(block);
zip_size = buf_block_get_zip_size(block);
fprintf(stderr,"InnoDB: Block space_id = %lu \n", space);
fprintf(stderr,"InnoDB: Block zip_size = %lu \n", zip_size);
page = buf_block_get_frame(block);
spaceid = page_get_space_id(page);
name = fil_space_get_name(spaceid);
fprintf(stderr,"InnoDB: Page space_id = %lu \n", space_id);
if (name)
fprintf(stderr,"InnoDB: Page file = %s \n", name);
fprintf(stderr,"InnoDB: Page->page_no = %lu \n", page_get_page_no(page));
fprintf(stderr,"InnoDB: Page->space_id = %lu \n", page_get_space_id(page));
fprintf(stderr,"InnoDB: Page->n_recs = %lu \n", page_get_n_recs(page));
fprintf(stderr,"InnoDB: Page->n_slots = %lu \n", page_dir_get_n_slots(page));
fprintf(stderr,"InnoDB: Page->is_compact = %lu \n", page_is_comp(page));
fprintf(stderr,"InnoDB: Page->is_leaf = %lu \n", page_is_leaf(page));
fprintf(stderr,"InnoDB: Page valid = %lu \n", page_validate(page, index));
}
fprintf(stderr,"InnoDB: OLD PREV PAGE ID INFO = %lu \n", old_prev_page_no);
if (old_prev_page_no != FIL_NULL) {
block = btr_block_get(space_id, zip_size, old_prev_page_no,
BTR_NO_LATCHES,
index, mtr);
space = buf_block_get_space(block);
zip_size = buf_block_get_zip_size(block);
fprintf(stderr,"InnoDB: Block space_id = %lu \n", space);
fprintf(stderr,"InnoDB: Block zip_size = %lu \n", zip_size);
page = buf_block_get_frame(block);
spaceid = page_get_space_id(page);
name = fil_space_get_name(spaceid);
fprintf(stderr,"InnoDB: Page space_id = %lu \n", space_id);
if (name)
fprintf(stderr,"InnoDB: Page file = %s \n", name);
fprintf(stderr,"InnoDB: Page->page_no = %lu \n", page_get_page_no(page));
fprintf(stderr,"InnoDB: Page->space_id = %lu \n", page_get_space_id(page));
fprintf(stderr,"InnoDB: Page->n_recs = %lu \n", page_get_n_recs(page));
fprintf(stderr,"InnoDB: Page->n_slots = %lu \n", page_dir_get_n_slots(page));
fprintf(stderr,"InnoDB: Page->is_compact = %lu \n", page_is_comp(page));
fprintf(stderr,"InnoDB: Page->is_leaf = %lu \n", page_is_leaf(page));
fprintf(stderr,"InnoDB: Page valid = %lu \n", page_validate(page, index));
}
fprintf(stderr,"InnoDB: NEW NEXT PAGE ID INFO = %lu \n", new_next_page_no);
if (new_next_page_no != FIL_NULL) {
block = btr_block_get(space_id, zip_size, new_next_page_no,
BTR_NO_LATCHES,
index, mtr);
space = buf_block_get_space(block);
zip_size = buf_block_get_zip_size(block);
fprintf(stderr,"InnoDB: Block space_id = %lu \n", space);
fprintf(stderr,"InnoDB: Block zip_size = %lu \n", zip_size);
page = buf_block_get_frame(block);
spaceid = page_get_space_id(page);
name = fil_space_get_name(spaceid);
fprintf(stderr,"InnoDB: Page space_id = %lu \n", space_id);
if (name)
fprintf(stderr,"InnoDB: Page file = %s \n", name);
fprintf(stderr,"InnoDB: Page->page_no = %lu \n", page_get_page_no(page));
fprintf(stderr,"InnoDB: Page->space_id = %lu \n", page_get_space_id(page));
fprintf(stderr,"InnoDB: Page->n_recs = %lu \n", page_get_n_recs(page));
fprintf(stderr,"InnoDB: Page->n_slots = %lu \n", page_dir_get_n_slots(page));
fprintf(stderr,"InnoDB: Page->is_compact = %lu \n", page_is_comp(page));
fprintf(stderr,"InnoDB: Page->is_leaf = %lu \n", page_is_leaf(page));
fprintf(stderr,"InnoDB: Page valid = %lu \n", page_validate(page, index));
}
fprintf(stderr,"InnoDB: NEW PREV PAGE ID INFO = %lu \n", new_prev_page_no);
if (new_prev_page_no != FIL_NULL) {
block = btr_block_get(space_id, zip_size, new_prev_page_no,
BTR_NO_LATCHES,
index, mtr);
page = buf_block_get_frame(block);
spaceid = page_get_space_id(page);
name = fil_space_get_name(spaceid);
fprintf(stderr,"InnoDB: Page space_id = %lu \n", space_id);
if (name)
fprintf(stderr,"InnoDB: Page file = %s \n", name);
fprintf(stderr,"InnoDB: Page->page_no = %lu \n", page_get_page_no(page));
fprintf(stderr,"InnoDB: Page->space_id = %lu \n", page_get_space_id(page));
fprintf(stderr,"InnoDB: Page->n_recs = %lu \n", page_get_n_recs(page));
fprintf(stderr,"InnoDB: Page->n_slots = %lu \n", page_dir_get_n_slots(page));
fprintf(stderr,"InnoDB: Page->is_compact = %lu \n", page_is_comp(page));
fprintf(stderr,"InnoDB: Page->is_leaf = %lu \n", page_is_leaf(page));
fprintf(stderr,"InnoDB: Page valid = %lu \n", page_validate(page, index));
}
}
......@@ -440,9 +440,24 @@ btr_pcur_move_to_next_page(
});
#ifdef UNIV_BTR_DEBUG
if (page_is_comp(next_page) != page_is_comp(page)) {
btr_pages_info(page, next_page, space,
zip_size, next_page_no, cursor->latch_mode,
btr_pcur_get_btr_cur(cursor)->index,
btr_page_get_next(page, mtr),
btr_page_get_prev(page, mtr),
buf_block_get_space(next_block),
buf_block_get_zip_size(next_block),
btr_page_get_next(next_page, mtr),
btr_page_get_prev(next_page, mtr),
mtr, __FILE__, __LINE__);
ut_a(page_is_comp(next_page) == page_is_comp(page));
ut_a(btr_page_get_prev(next_page, mtr)
== buf_block_get_page_no(btr_pcur_get_block(cursor)));
}
#endif /* UNIV_BTR_DEBUG */
next_block->check_index_page_at_flush = TRUE;
......
......@@ -467,6 +467,21 @@ fil_space_get_by_id(
return(space);
}
/*******************************************************************//**
Returns the table space name for a given id, NULL if not found. */
const char*
fil_space_get_name(
/*================*/
ulint id) /*!< in: space id */
{
fil_space_t* space;
mutex_enter(&fil_system->mutex);
space = fil_space_get_by_id(id);
mutex_exit(&fil_system->mutex);
return (space == NULL ? NULL : space->name);
}
/*******************************************************************//**
Returns the table space by a given name, NULL if not found. */
UNIV_INLINE
......
......@@ -826,6 +826,28 @@ extern ulint btr_cur_n_sea_old;
extern uint btr_cur_limit_optimistic_insert_debug;
#endif /* UNIV_DEBUG */
/*******************************************************************//**
Print information about old page and a new page on a B-tree when
we note that page types do not match.*/
void
btr_pages_info(
page_t* old_page, /*!< in: Page where we were */
page_t* new_page, /*!< in: Page where we travelsed */
ulint space_id, /*!< in: space id */
ulint zip_size, /*!< in: zip size */
ulint page_no, /*!< in: Page id where travelsed */
ulint latch_mode, /*!< in: Used latch mode */
dict_index_t* index, /*!< in: Used index */
ulint old_next_page_no, /*!< in: Next page number from old page */
ulint old_prev_page_no, /*!< in: Prev page number from old page */
ulint new_space_id, /*!< in: Space id of new page */
ulint new_zip_size, /*!< in: Zip size of new page */
ulint new_next_page_no, /*!< in: Next page number from new page */
ulint new_prev_page_no, /*!< in: Prev page number from new page */
mtr_t* mtr, /*!< in: mini transaction */
const char* file, /*!< in: file name where called */
ulint line); /*!< in: line number where called */
#ifndef UNIV_NONINL
#include "btr0cur.ic"
#endif
......
......@@ -794,6 +794,14 @@ fil_mtr_rename_log(
const char* tmp_name); /*!< in: temp table name used while
swapping */
typedef struct fil_space_struct fil_space_t;
/*******************************************************************//**
Returns the table space name for a given id, NULL if not found. */
const char*
fil_space_get_name(
/*================*/
ulint id); /*!< in: space id */
#endif
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