summaryrefslogtreecommitdiff
path: root/storage/xtradb
diff options
context:
space:
mode:
authorJan Lindström <jplindst@mariadb.org>2014-04-28 08:30:05 +0300
committerJan Lindström <jplindst@mariadb.org>2014-04-28 08:30:05 +0300
commit772aa0c57525706a9f6e3285005ff22fc115b647 (patch)
treeadc43e0d58189993318c912ad2f9c4fdcb595cfb /storage/xtradb
parent53612e7787f4b462113a82b25834b1e18a0c051b (diff)
downloadmariadb-git-772aa0c57525706a9f6e3285005ff22fc115b647.tar.gz
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.
Diffstat (limited to 'storage/xtradb')
-rw-r--r--storage/xtradb/btr/btr0cur.c285
-rw-r--r--storage/xtradb/btr/btr0pcur.c21
-rw-r--r--storage/xtradb/fil/fil0fil.c15
-rw-r--r--storage/xtradb/include/btr0cur.h22
-rw-r--r--storage/xtradb/include/fil0fil.h8
5 files changed, 333 insertions, 18 deletions
diff --git a/storage/xtradb/btr/btr0cur.c b/storage/xtradb/btr/btr0cur.c
index e5d0f002af6..3c56d29bdd0 100644
--- a/storage/xtradb/btr/btr0cur.c
+++ b/storage/xtradb/btr/btr0cur.c
@@ -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
- ut_a(page_is_comp(get_block->frame) == page_is_comp(page));
+
+ 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
- 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));
+ 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
- ut_a(page_is_comp(get_block->frame) == page_is_comp(page));
+ 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
- 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));
+ 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
- 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));
+ 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
- ut_a(page_is_comp(get_block->frame) == page_is_comp(page));
+ 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));
+ }
+}
diff --git a/storage/xtradb/btr/btr0pcur.c b/storage/xtradb/btr/btr0pcur.c
index d1b3dc4a3e6..c197009b003 100644
--- a/storage/xtradb/btr/btr0pcur.c
+++ b/storage/xtradb/btr/btr0pcur.c
@@ -440,9 +440,24 @@ btr_pcur_move_to_next_page(
});
#ifdef UNIV_BTR_DEBUG
- 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)));
+
+ 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;
diff --git a/storage/xtradb/fil/fil0fil.c b/storage/xtradb/fil/fil0fil.c
index e966510b654..40ceee3ba61 100644
--- a/storage/xtradb/fil/fil0fil.c
+++ b/storage/xtradb/fil/fil0fil.c
@@ -468,6 +468,21 @@ fil_space_get_by_id(
}
/*******************************************************************//**
+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
fil_space_t*
diff --git a/storage/xtradb/include/btr0cur.h b/storage/xtradb/include/btr0cur.h
index 7b56c1bbb6e..25f987cb8e1 100644
--- a/storage/xtradb/include/btr0cur.h
+++ b/storage/xtradb/include/btr0cur.h
@@ -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
diff --git a/storage/xtradb/include/fil0fil.h b/storage/xtradb/include/fil0fil.h
index a7d8d87035b..d138bd472b7 100644
--- a/storage/xtradb/include/fil0fil.h
+++ b/storage/xtradb/include/fil0fil.h
@@ -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