summaryrefslogtreecommitdiff
path: root/storage/xtradb/btr/btr0cur.c
diff options
context:
space:
mode:
authorSeppo Jaakola <seppo.jaakola@codership.com>2013-05-26 11:26:58 +0300
committerSeppo Jaakola <seppo.jaakola@codership.com>2013-05-26 11:26:58 +0300
commitbd0eae595fc5d050913ea01bd4c6a8e47f379176 (patch)
treedc2915fa2f49d6c015d7f6f4d54fda9ae0ae046e /storage/xtradb/btr/btr0cur.c
parent9d1546fe2cdced5efb4af831fa2e560b7f80fb54 (diff)
parentcb246b20d6e0dad16797b9e09bef6f0431b88d37 (diff)
downloadmariadb-git-bd0eae595fc5d050913ea01bd4c6a8e47f379176.tar.gz
References: MDEV-4572 - merge with mariaDB 5.5.31
bzr merge lp:maria/5.5 -rtag:mariadb-5.5.31 Text conflict in cmake/cpack_rpm.cmake Text conflict in debian/dist/Debian/control Text conflict in debian/dist/Ubuntu/control Text conflict in sql/CMakeLists.txt Conflict adding file sql/db.opt. Moved existing file to sql/db.opt.moved. Conflict adding file sql/db.opt.moved. Moved existing file to sql/db.opt.moved.moved. Text conflict in sql/mysqld.cc Text conflict in support-files/mysql.spec.sh 8 conflicts encountered.
Diffstat (limited to 'storage/xtradb/btr/btr0cur.c')
-rw-r--r--storage/xtradb/btr/btr0cur.c111
1 files changed, 51 insertions, 60 deletions
diff --git a/storage/xtradb/btr/btr0cur.c b/storage/xtradb/btr/btr0cur.c
index d089fb5ad22..488212f087c 100644
--- a/storage/xtradb/btr/btr0cur.c
+++ b/storage/xtradb/btr/btr0cur.c
@@ -258,10 +258,8 @@ btr_cur_latch_leaves(
get_block = btr_block_get(
space, zip_size, page_no, mode, cursor->index, mtr);
- if (srv_pass_corrupt_table && !get_block) {
- return;
- }
- ut_a(get_block);
+ SRV_CORRUPT_TABLE_CHECK(get_block, return;);
+
#ifdef UNIV_BTR_DEBUG
ut_a(page_is_comp(get_block->frame) == page_is_comp(page));
#endif /* UNIV_BTR_DEBUG */
@@ -283,10 +281,8 @@ btr_cur_latch_leaves(
space, zip_size, left_page_no,
sibling_mode, cursor->index, mtr);
- if (srv_pass_corrupt_table && !get_block) {
- return;
- }
- ut_a(get_block);
+ SRV_CORRUPT_TABLE_CHECK(get_block, return;);
+
#ifdef UNIV_BTR_DEBUG
ut_a(page_is_comp(get_block->frame)
== page_is_comp(page));
@@ -309,10 +305,8 @@ btr_cur_latch_leaves(
space, zip_size, page_no,
mode, cursor->index, mtr);
- if (srv_pass_corrupt_table && !get_block) {
- return;
- }
- ut_a(get_block);
+ SRV_CORRUPT_TABLE_CHECK(get_block, return;);
+
#ifdef UNIV_BTR_DEBUG
ut_a(page_is_comp(get_block->frame) == page_is_comp(page));
#endif /* UNIV_BTR_DEBUG */
@@ -325,10 +319,8 @@ btr_cur_latch_leaves(
space, zip_size, right_page_no,
sibling_mode, cursor->index, mtr);
- if (srv_pass_corrupt_table && !get_block) {
- return;
- }
- ut_a(get_block);
+ SRV_CORRUPT_TABLE_CHECK(get_block, return;);
+
#ifdef UNIV_BTR_DEBUG
ut_a(page_is_comp(get_block->frame)
== page_is_comp(page));
@@ -357,10 +349,8 @@ btr_cur_latch_leaves(
left_page_no, mode, cursor->index, mtr);
cursor->left_block = get_block;
- if (srv_pass_corrupt_table && !get_block) {
- return;
- }
- ut_a(get_block);
+ SRV_CORRUPT_TABLE_CHECK(get_block, return;);
+
#ifdef UNIV_BTR_DEBUG
ut_a(page_is_comp(get_block->frame)
== page_is_comp(page));
@@ -373,10 +363,8 @@ btr_cur_latch_leaves(
get_block = btr_block_get(
space, zip_size, page_no, mode, cursor->index, mtr);
- if (srv_pass_corrupt_table && !get_block) {
- return;
- }
- ut_a(get_block);
+ SRV_CORRUPT_TABLE_CHECK(get_block, return;);
+
#ifdef UNIV_BTR_DEBUG
ut_a(page_is_comp(get_block->frame) == page_is_comp(page));
#endif /* UNIV_BTR_DEBUG */
@@ -652,18 +640,19 @@ retry_page_get:
file, line, mtr);
if (block == NULL) {
- if (srv_pass_corrupt_table
- && buf_mode != BUF_GET_IF_IN_POOL
- && buf_mode != BUF_GET_IF_IN_POOL_OR_WATCH) {
- page_cursor->block = 0;
- page_cursor->rec = 0;
- if (estimate) {
- cursor->path_arr->nth_rec = ULINT_UNDEFINED;
- }
- goto func_exit;
- }
- ut_a(buf_mode == BUF_GET_IF_IN_POOL
- || buf_mode == BUF_GET_IF_IN_POOL_OR_WATCH);
+ SRV_CORRUPT_TABLE_CHECK(buf_mode == BUF_GET_IF_IN_POOL ||
+ buf_mode == BUF_GET_IF_IN_POOL_OR_WATCH,
+ {
+ page_cursor->block = 0;
+ page_cursor->rec = 0;
+ if (estimate) {
+
+ cursor->path_arr->nth_rec =
+ ULINT_UNDEFINED;
+ }
+
+ goto func_exit;
+ });
/* This must be a search to perform an insert/delete
mark/ delete; try using the insert/delete buffer */
@@ -739,15 +728,18 @@ retry_page_get:
block->check_index_page_at_flush = TRUE;
page = buf_block_get_frame(block);
- if (srv_pass_corrupt_table && !page) {
+ SRV_CORRUPT_TABLE_CHECK(page,
+ {
page_cursor->block = 0;
page_cursor->rec = 0;
+
if (estimate) {
+
cursor->path_arr->nth_rec = ULINT_UNDEFINED;
}
+
goto func_exit;
- }
- ut_a(page);
+ });
if (rw_latch != RW_NO_LATCH) {
#ifdef UNIV_ZIP_DEBUG
@@ -943,15 +935,19 @@ btr_cur_open_at_index_side_func(
file, line, mtr);
page = buf_block_get_frame(block);
- if (srv_pass_corrupt_table && !page) {
+ SRV_CORRUPT_TABLE_CHECK(page,
+ {
page_cursor->block = 0;
page_cursor->rec = 0;
+
if (estimate) {
- cursor->path_arr->nth_rec = ULINT_UNDEFINED;
+
+ cursor->path_arr->nth_rec =
+ ULINT_UNDEFINED;
}
- break;
- }
- ut_a(page);
+ /* Can't use break with the macro */
+ goto exit_loop;
+ });
ut_ad(index->id == btr_page_get_index_id(page));
@@ -1021,6 +1017,7 @@ btr_cur_open_at_index_side_func(
page_no = btr_node_ptr_get_child_page_no(node_ptr, offsets);
}
+exit_loop:
if (UNIV_LIKELY_NULL(heap)) {
mem_heap_free(heap);
}
@@ -1074,12 +1071,13 @@ btr_cur_open_at_rnd_pos_func(
file, line, mtr);
page = buf_block_get_frame(block);
- if (srv_pass_corrupt_table && !page) {
+ SRV_CORRUPT_TABLE_CHECK(page,
+ {
page_cursor->block = 0;
page_cursor->rec = 0;
- break;
- }
- ut_a(page);
+
+ goto exit_loop;
+ });
ut_ad(index->id == btr_page_get_index_id(page));
@@ -1112,6 +1110,7 @@ btr_cur_open_at_rnd_pos_func(
page_no = btr_node_ptr_get_child_page_no(node_ptr, offsets);
}
+exit_loop:
if (UNIV_LIKELY_NULL(heap)) {
mem_heap_free(heap);
}
@@ -1300,10 +1299,7 @@ btr_cur_optimistic_insert(
block = btr_cur_get_block(cursor);
- if (srv_pass_corrupt_table && !block) {
- return(DB_CORRUPTION);
- }
- ut_a(block);
+ SRV_CORRUPT_TABLE_CHECK(block, return(DB_CORRUPTION););
page = buf_block_get_frame(block);
index = cursor->index;
@@ -3149,10 +3145,7 @@ btr_cur_optimistic_delete(
block = btr_cur_get_block(cursor);
- if (srv_pass_corrupt_table && !block) {
- return(DB_CORRUPTION);
- }
- ut_a(block);
+ SRV_CORRUPT_TABLE_CHECK(block, return(DB_CORRUPTION););
ut_ad(page_is_leaf(buf_block_get_frame(block)));
@@ -3868,10 +3861,7 @@ btr_estimate_number_of_different_key_vals(
page = btr_cur_get_page(&cursor);
- if (srv_pass_corrupt_table && !page) {
- break;
- }
- ut_a(page);
+ SRV_CORRUPT_TABLE_CHECK(page, goto exit_loop;);
rec = page_rec_get_next(page_get_infimum_rec(page));
@@ -3957,6 +3947,7 @@ btr_estimate_number_of_different_key_vals(
mtr_commit(&mtr);
}
+exit_loop:
/* If we saw k borders between different key values on
n_sample_pages leaf pages, we can estimate how many
there will be in index->stat_n_leaf_pages */