Commit 0d6c2414 authored by marko's avatar marko

branches/zip: Remove a few buf_block_align() calls from debug builds.

btr_check_node_ptr(): Replace page_t* parameter with buf_block_t*.

btr_free_externally_stored_field(): Add const qualifier to rec.
Remove an explicit buf_block_align() call, but replace an
mtr_memo_contains() with mtr_memo_contains_page().

row_upd_rec_sys_fields(): Reorder an assertion containing buf_block_align()
so that the costly call can be avoided in some cases.
parent 08851238
......@@ -2205,7 +2205,7 @@ btr_lift_page_up(
/* We play safe and reset the free bits for the father */
ibuf_reset_free_bits_with_type(index->type, father_block);
ut_ad(page_validate(father_page, index));
ut_ad(btr_check_node_ptr(index, father_page, mtr));
ut_ad(btr_check_node_ptr(index, father_block, mtr));
}
/*****************************************************************
......@@ -2440,7 +2440,7 @@ err_exit:
/* Free the file page */
btr_page_free(index, block, mtr);
ut_ad(btr_check_node_ptr(index, merge_page, mtr));
ut_ad(btr_check_node_ptr(index, merge_block, mtr));
return(TRUE);
}
......@@ -2596,7 +2596,7 @@ btr_discard_page(
/* Free the file page */
btr_page_free(index, block, mtr);
ut_ad(btr_check_node_ptr(index, merge_page, mtr));
ut_ad(btr_check_node_ptr(index, merge_block, mtr));
}
#ifdef UNIV_BTR_PRINT
......@@ -2744,14 +2744,14 @@ btr_check_node_ptr(
/*===============*/
/* out: TRUE */
dict_index_t* index, /* in: index tree */
page_t* page, /* in: index page */
buf_block_t* block, /* in: index page */
mtr_t* mtr) /* in: mtr */
{
mem_heap_t* heap;
dtuple_t* tuple;
ulint* offsets;
btr_cur_t cursor;
buf_block_t* block = buf_block_align(page);
page_t* page = buf_block_get_frame(block);
ut_ad(mtr_memo_contains(mtr, block, MTR_MEMO_PAGE_X_FIX));
if (dict_index_get_page(index) == block->offset) {
......
......@@ -2839,7 +2839,7 @@ btr_cur_pessimistic_delete(
ut_a(!page_zip || page_zip_validate(page_zip, page));
#endif /* UNIV_ZIP_DEBUG */
ut_ad(btr_check_node_ptr(index, page, mtr));
ut_ad(btr_check_node_ptr(index, block, mtr));
*err = DB_SUCCESS;
......@@ -3908,7 +3908,7 @@ btr_free_externally_stored_field(
an undo log page, not an index
page) */
byte* field_ref, /* in/out: field reference */
rec_t* rec, /* in: record containing field_ref, for
const rec_t* rec, /* in: record containing field_ref, for
page_zip_write_blob_ptr(), or NULL */
const ulint* offsets, /* in: rec_get_offsets(rec, index),
or NULL */
......@@ -3929,16 +3929,16 @@ btr_free_externally_stored_field(
ulint next_page_no;
mtr_t mtr;
#ifdef UNIV_DEBUG
buf_block_t* block = buf_block_align(field_ref);
ut_ad(mtr_memo_contains(local_mtr, dict_index_get_lock(index),
MTR_MEMO_X_LOCK));
ut_ad(mtr_memo_contains(local_mtr, block, MTR_MEMO_PAGE_X_FIX));
ut_ad(mtr_memo_contains_page(local_mtr, field_ref,
MTR_MEMO_PAGE_X_FIX));
ut_ad(!rec || rec_offs_validate(rec, index, offsets));
if (rec) {
ulint local_len;
byte* f = rec_get_nth_field(rec, offsets, i, &local_len);
const byte* f = rec_get_nth_field(rec, offsets,
i, &local_len);
ut_a(local_len >= BTR_EXTERN_FIELD_REF_SIZE);
local_len -= BTR_EXTERN_FIELD_REF_SIZE;
f += local_len;
......@@ -3960,7 +3960,6 @@ btr_free_externally_stored_field(
#ifdef UNIV_SYNC_DEBUG
buf_block_dbg_add_level(rec_block, SYNC_NO_ORDER_CHECK);
#endif /* UNIV_SYNC_DEBUG */
ut_ad(rec_block == block);
space_id = mach_read_from_4(field_ref + BTR_EXTERN_SPACE_ID);
page_no = mach_read_from_4(field_ref + BTR_EXTERN_PAGE_NO);
......
......@@ -301,7 +301,7 @@ btr_check_node_ptr(
/*===============*/
/* out: TRUE */
dict_index_t* index, /* in: index tree */
page_t* page, /* in: index page */
buf_block_t* block, /* in: index page */
mtr_t* mtr); /* in: mtr */
#endif /* UNIV_DEBUG */
/*****************************************************************
......
......@@ -504,7 +504,7 @@ btr_free_externally_stored_field(
an undo log page, not an index
page) */
byte* field_ref, /* in/out: field reference */
rec_t* rec, /* in: record containing field_ref, for
const rec_t* rec, /* in: record containing field_ref, for
page_zip_write_blob_ptr(), or NULL */
const ulint* offsets, /* in: rec_get_offsets(rec, index),
or NULL */
......
......@@ -116,8 +116,8 @@ row_upd_rec_sys_fields(
ut_ad(dict_index_is_clust(index));
ut_ad(rec_offs_validate(rec, index, offsets));
#ifdef UNIV_SYNC_DEBUG
ut_ad(!buf_block_align(rec)->is_hashed
|| rw_lock_own(&btr_search_latch, RW_LOCK_EX));
ut_ad(rw_lock_own(&btr_search_latch, RW_LOCK_EX)
|| !buf_block_align(rec)->is_hashed);
#endif /* UNIV_SYNC_DEBUG */
if (UNIV_LIKELY_NULL(page_zip)) {
......
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