Commit f4051140 authored by marko's avatar marko

branches/zip: Remove more references to buf_block_align().

ibuf_reset_free_bits(): Remove, as there already is a similar function
ibuf_reset_free_bits_with_type().

ibuf_reset_free_bits_with_type(), ibuf_set_free_bits(),
ibuf_update_free_bits_if_full(), btr_leaf_page_release(),
buf_page_make_young(): Replace page_t with buf_block_t.

btr_compress(): Replace btr_page_get() with btr_block_get().
parent fcaa035f
...@@ -747,7 +747,7 @@ btr_create( ...@@ -747,7 +747,7 @@ btr_create(
trees in the same mtr, otherwise the latch on a bitmap page would trees in the same mtr, otherwise the latch on a bitmap page would
prevent it because of the latching order */ prevent it because of the latching order */
ibuf_reset_free_bits_with_type(type, page); ibuf_reset_free_bits_with_type(type, block);
/* In the following assertion we test that two records of maximum /* In the following assertion we test that two records of maximum
allowed size fit on the root page: this fact is needed to ensure allowed size fit on the root page: this fact is needed to ensure
...@@ -1164,7 +1164,7 @@ btr_root_raise_and_insert( ...@@ -1164,7 +1164,7 @@ btr_root_raise_and_insert(
page_get_page_no(new_page)); page_get_page_no(new_page));
#endif #endif
ibuf_reset_free_bits(index, new_page); ibuf_reset_free_bits_with_type(index->type, new_block);
/* Reposition the cursor to the child node */ /* Reposition the cursor to the child node */
page_cur_search(new_page, index, tuple, page_cur_search(new_page, index, tuple,
PAGE_CUR_LE, page_cursor); PAGE_CUR_LE, page_cursor);
...@@ -1934,7 +1934,7 @@ btr_page_split_and_insert( ...@@ -1934,7 +1934,7 @@ btr_page_split_and_insert(
start of the function for a new split */ start of the function for a new split */
insert_failed: insert_failed:
/* We play safe and reset the free bits for new_page */ /* We play safe and reset the free bits for new_page */
ibuf_reset_free_bits(cursor->index, new_page); ibuf_reset_free_bits_with_type(cursor->index->type, new_block);
/* fprintf(stderr, "Split second round %lu\n", /* fprintf(stderr, "Split second round %lu\n",
page_get_page_no(page)); */ page_get_page_no(page)); */
...@@ -2182,7 +2182,7 @@ btr_lift_page_up( ...@@ -2182,7 +2182,7 @@ btr_lift_page_up(
btr_page_free(index, page, mtr); btr_page_free(index, page, mtr);
/* We play safe and reset the free bits for the father */ /* We play safe and reset the free bits for the father */
ibuf_reset_free_bits(index, father_page); ibuf_reset_free_bits_with_type(index->type, father_block);
ut_ad(page_validate(father_page, index)); 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_page, mtr));
} }
...@@ -2211,6 +2211,7 @@ btr_compress( ...@@ -2211,6 +2211,7 @@ btr_compress(
ulint space; ulint space;
ulint left_page_no; ulint left_page_no;
ulint right_page_no; ulint right_page_no;
buf_block_t* merge_block;
page_t* merge_page; page_t* merge_page;
page_zip_des_t* merge_page_zip; page_zip_des_t* merge_page_zip;
ibool is_left; ibool is_left;
...@@ -2252,16 +2253,18 @@ btr_compress( ...@@ -2252,16 +2253,18 @@ btr_compress(
if (is_left) { if (is_left) {
merge_page = btr_page_get(space, left_page_no, RW_X_LATCH, merge_block = btr_block_get(space, left_page_no, RW_X_LATCH,
mtr); mtr);
merge_page = buf_block_get_frame(merge_block);
#ifdef UNIV_BTR_DEBUG #ifdef UNIV_BTR_DEBUG
ut_a(btr_page_get_next(merge_page, mtr) ut_a(btr_page_get_next(merge_page, mtr)
== page_get_page_no(page)); == page_get_page_no(page));
#endif /* UNIV_BTR_DEBUG */ #endif /* UNIV_BTR_DEBUG */
} else if (right_page_no != FIL_NULL) { } else if (right_page_no != FIL_NULL) {
merge_page = btr_page_get(space, right_page_no, RW_X_LATCH, merge_block = btr_block_get(space, right_page_no, RW_X_LATCH,
mtr); mtr);
merge_page = buf_block_get_frame(merge_block);
#ifdef UNIV_BTR_DEBUG #ifdef UNIV_BTR_DEBUG
ut_a(btr_page_get_prev(merge_page, mtr) ut_a(btr_page_get_prev(merge_page, mtr)
== page_get_page_no(page)); == page_get_page_no(page));
...@@ -2275,7 +2278,9 @@ btr_compress( ...@@ -2275,7 +2278,9 @@ btr_compress(
n_recs = page_get_n_recs(page); n_recs = page_get_n_recs(page);
data_size = page_get_data_size(page); data_size = page_get_data_size(page);
#ifdef UNIV_BTR_DEBUG
ut_a(page_is_comp(merge_page) == page_is_comp(page)); ut_a(page_is_comp(merge_page) == page_is_comp(page));
#endif /* UNIV_BTR_DEBUG */
max_ins_size_reorg = page_get_max_insert_size_after_reorganize( max_ins_size_reorg = page_get_max_insert_size_after_reorganize(
merge_page, n_recs); merge_page, n_recs);
...@@ -2314,13 +2319,11 @@ btr_compress( ...@@ -2314,13 +2319,11 @@ btr_compress(
} }
} }
merge_page_zip = buf_frame_get_page_zip(merge_page); merge_page_zip = buf_block_get_page_zip(merge_block);
#ifdef UNIV_ZIP_DEBUG #ifdef UNIV_ZIP_DEBUG
if (UNIV_LIKELY_NULL(merge_page_zip)) { if (UNIV_LIKELY_NULL(merge_page_zip)) {
ut_a(page_zip_validate(merge_page_zip, merge_page)); ut_a(page_zip_validate(merge_page_zip, merge_page));
ut_a(page_zip_validate( ut_a(page_zip_validate(buf_frame_get_page_zip(page), page));
buf_frame_get_page_zip(page),
page));
} }
#endif /* UNIV_ZIP_DEBUG */ #endif /* UNIV_ZIP_DEBUG */
...@@ -2411,7 +2414,7 @@ btr_compress( ...@@ -2411,7 +2414,7 @@ btr_compress(
} }
/* We have added new records to merge_page: update its free bits */ /* We have added new records to merge_page: update its free bits */
ibuf_update_free_bits_if_full(index, merge_page, ibuf_update_free_bits_if_full(index, merge_block,
UNIV_PAGE_SIZE, ULINT_UNDEFINED); UNIV_PAGE_SIZE, ULINT_UNDEFINED);
ut_ad(page_validate(merge_page, index)); ut_ad(page_validate(merge_page, index));
...@@ -2465,7 +2468,7 @@ btr_discard_only_page_on_level( ...@@ -2465,7 +2468,7 @@ btr_discard_only_page_on_level(
mtr, index); mtr, index);
/* We play safe and reset the free bits for the father */ /* We play safe and reset the free bits for the father */
ibuf_reset_free_bits(index, father_page); ibuf_reset_free_bits_with_type(index->type, father_block);
} else { } else {
ut_ad(page_get_n_recs(father_page) == 1); ut_ad(page_get_n_recs(father_page) == 1);
......
...@@ -1030,6 +1030,7 @@ btr_cur_optimistic_insert( ...@@ -1030,6 +1030,7 @@ btr_cur_optimistic_insert(
big_rec_t* big_rec_vec = NULL; big_rec_t* big_rec_vec = NULL;
dict_index_t* index; dict_index_t* index;
page_cur_t* page_cursor; page_cur_t* page_cursor;
buf_block_t* block;
page_t* page; page_t* page;
page_zip_des_t* page_zip; page_zip_des_t* page_zip;
ulint max_size; ulint max_size;
...@@ -1044,9 +1045,10 @@ btr_cur_optimistic_insert( ...@@ -1044,9 +1045,10 @@ btr_cur_optimistic_insert(
*big_rec = NULL; *big_rec = NULL;
page = btr_cur_get_page(cursor); block = buf_block_align(btr_cur_get_rec(cursor));
page = buf_block_get_frame(block);
index = cursor->index; index = cursor->index;
page_zip = buf_frame_get_page_zip(page); page_zip = buf_block_get_page_zip(block);
if (!dtuple_check_typed_no_assert(entry)) { if (!dtuple_check_typed_no_assert(entry)) {
fputs("InnoDB: Error in a tuple to insert into ", stderr); fputs("InnoDB: Error in a tuple to insert into ", stderr);
...@@ -1059,7 +1061,7 @@ btr_cur_optimistic_insert( ...@@ -1059,7 +1061,7 @@ btr_cur_optimistic_insert(
} }
#endif /* UNIV_DEBUG */ #endif /* UNIV_DEBUG */
ut_ad(mtr_memo_contains_page(mtr, page, MTR_MEMO_PAGE_X_FIX)); ut_ad(mtr_memo_contains(mtr, block, MTR_MEMO_PAGE_X_FIX));
max_size = page_get_max_insert_size_after_reorganize(page, 1); max_size = page_get_max_insert_size_after_reorganize(page, 1);
level = btr_page_get_level(page, mtr); level = btr_page_get_level(page, mtr);
...@@ -1189,7 +1191,7 @@ btr_cur_optimistic_insert( ...@@ -1189,7 +1191,7 @@ btr_cur_optimistic_insert(
#endif #endif
if (!(type & DICT_CLUSTERED)) { if (!(type & DICT_CLUSTERED)) {
/* We have added a record to page: update its free bits */ /* We have added a record to page: update its free bits */
ibuf_update_free_bits_if_full(cursor->index, page, max_size, ibuf_update_free_bits_if_full(cursor->index, block, max_size,
rec_size + PAGE_DIR_SLOT_SIZE); rec_size + PAGE_DIR_SLOT_SIZE);
} }
......
...@@ -351,14 +351,14 @@ btr_pcur_release_leaf( ...@@ -351,14 +351,14 @@ btr_pcur_release_leaf(
btr_pcur_t* cursor, /* in: persistent cursor */ btr_pcur_t* cursor, /* in: persistent cursor */
mtr_t* mtr) /* in: mtr */ mtr_t* mtr) /* in: mtr */
{ {
page_t* page; buf_block_t* block;
ut_a(cursor->pos_state == BTR_PCUR_IS_POSITIONED); ut_a(cursor->pos_state == BTR_PCUR_IS_POSITIONED);
ut_ad(cursor->latch_mode != BTR_NO_LATCHES); ut_ad(cursor->latch_mode != BTR_NO_LATCHES);
page = btr_cur_get_page(btr_pcur_get_btr_cur(cursor)); block = buf_block_align(btr_cur_get_rec(btr_pcur_get_btr_cur(cursor)));
btr_leaf_page_release(page, cursor->latch_mode, mtr); btr_leaf_page_release(block, cursor->latch_mode, mtr);
cursor->latch_mode = BTR_NO_LATCHES; cursor->latch_mode = BTR_NO_LATCHES;
...@@ -378,10 +378,11 @@ btr_pcur_move_to_next_page( ...@@ -378,10 +378,11 @@ btr_pcur_move_to_next_page(
last record of the current page */ last record of the current page */
mtr_t* mtr) /* in: mtr */ mtr_t* mtr) /* in: mtr */
{ {
ulint next_page_no; ulint next_page_no;
ulint space; ulint space;
page_t* page; page_t* page;
page_t* next_page; buf_block_t* next_block;
page_t* next_page;
ut_a(cursor->pos_state == BTR_PCUR_IS_POSITIONED); ut_a(cursor->pos_state == BTR_PCUR_IS_POSITIONED);
ut_ad(cursor->latch_mode != BTR_NO_LATCHES); ut_ad(cursor->latch_mode != BTR_NO_LATCHES);
...@@ -396,14 +397,16 @@ btr_pcur_move_to_next_page( ...@@ -396,14 +397,16 @@ btr_pcur_move_to_next_page(
ut_ad(next_page_no != FIL_NULL); ut_ad(next_page_no != FIL_NULL);
next_page = btr_page_get(space, next_page_no, cursor->latch_mode, mtr); next_block = btr_block_get(space, next_page_no,
cursor->latch_mode, mtr);
next_page = buf_block_get_frame(next_block);
#ifdef UNIV_BTR_DEBUG #ifdef UNIV_BTR_DEBUG
ut_a(page_is_comp(next_page) == page_is_comp(page));
ut_a(btr_page_get_prev(next_page, mtr) == page_get_page_no(page)); ut_a(btr_page_get_prev(next_page, mtr) == page_get_page_no(page));
#endif /* UNIV_BTR_DEBUG */ #endif /* UNIV_BTR_DEBUG */
ut_a(page_is_comp(next_page) == page_is_comp(page)); next_block->check_index_page_at_flush = TRUE;
buf_block_align(next_page)->check_index_page_at_flush = TRUE;
btr_leaf_page_release(page, cursor->latch_mode, mtr); btr_leaf_page_release(buf_block_align(page), cursor->latch_mode, mtr);
page_cur_set_before_first(next_page, btr_pcur_get_page_cur(cursor)); page_cur_set_before_first(next_page, btr_pcur_get_page_cur(cursor));
...@@ -471,7 +474,7 @@ btr_pcur_move_backward_from_page( ...@@ -471,7 +474,7 @@ btr_pcur_move_backward_from_page(
prev_page = btr_pcur_get_btr_cur(cursor)->left_page; prev_page = btr_pcur_get_btr_cur(cursor)->left_page;
btr_leaf_page_release(page, latch_mode, mtr); btr_leaf_page_release(buf_block_align(page), latch_mode, mtr);
page_cur_set_after_last(prev_page, page_cur_set_after_last(prev_page,
btr_pcur_get_page_cur(cursor)); btr_pcur_get_page_cur(cursor));
...@@ -483,7 +486,8 @@ btr_pcur_move_backward_from_page( ...@@ -483,7 +486,8 @@ btr_pcur_move_backward_from_page(
prev_page = btr_pcur_get_btr_cur(cursor)->left_page; prev_page = btr_pcur_get_btr_cur(cursor)->left_page;
btr_leaf_page_release(prev_page, latch_mode, mtr); btr_leaf_page_release(buf_block_align(prev_page),
latch_mode, mtr);
} }
cursor->latch_mode = latch_mode; cursor->latch_mode = latch_mode;
......
...@@ -756,8 +756,8 @@ btr_search_guess_on_hash( ...@@ -756,8 +756,8 @@ btr_search_guess_on_hash(
goto failure_unlock; goto failure_unlock;
} }
page = page_align(rec); block = buf_block_align(rec);
block = buf_block_align(page); page = buf_block_get_frame(block);
if (UNIV_LIKELY(!has_search_latch)) { if (UNIV_LIKELY(!has_search_latch)) {
...@@ -780,7 +780,7 @@ btr_search_guess_on_hash( ...@@ -780,7 +780,7 @@ btr_search_guess_on_hash(
if (UNIV_UNLIKELY(block->state == BUF_BLOCK_REMOVE_HASH)) { if (UNIV_UNLIKELY(block->state == BUF_BLOCK_REMOVE_HASH)) {
if (UNIV_LIKELY(!has_search_latch)) { if (UNIV_LIKELY(!has_search_latch)) {
btr_leaf_page_release(page, latch_mode, mtr); btr_leaf_page_release(block, latch_mode, mtr);
} }
goto failure; goto failure;
...@@ -804,7 +804,7 @@ btr_search_guess_on_hash( ...@@ -804,7 +804,7 @@ btr_search_guess_on_hash(
can_only_compare_to_cursor_rec, can_only_compare_to_cursor_rec,
tuple, mode, mtr)) { tuple, mode, mtr)) {
if (UNIV_LIKELY(!has_search_latch)) { if (UNIV_LIKELY(!has_search_latch)) {
btr_leaf_page_release(page, latch_mode, mtr); btr_leaf_page_release(block, latch_mode, mtr);
} }
goto failure; goto failure;
...@@ -824,7 +824,7 @@ btr_search_guess_on_hash( ...@@ -824,7 +824,7 @@ btr_search_guess_on_hash(
/* Currently, does not work if the following fails: */ /* Currently, does not work if the following fails: */
ut_ad(!has_search_latch); ut_ad(!has_search_latch);
btr_leaf_page_release(page, latch_mode, mtr); btr_leaf_page_release(block, latch_mode, mtr);
btr_cur_search_to_nth_level(index, 0, tuple, mode, latch_mode, btr_cur_search_to_nth_level(index, 0, tuple, mode, latch_mode,
&cursor2, 0, mtr); &cursor2, 0, mtr);
...@@ -856,7 +856,7 @@ btr_search_guess_on_hash( ...@@ -856,7 +856,7 @@ btr_search_guess_on_hash(
if (UNIV_LIKELY(!has_search_latch) if (UNIV_LIKELY(!has_search_latch)
&& buf_block_peek_if_too_old(block)) { && buf_block_peek_if_too_old(block)) {
buf_page_make_young(page); buf_page_make_young(block);
} }
/* Increment the page get statistics though we did not really /* Increment the page get statistics though we did not really
......
...@@ -984,14 +984,10 @@ the buffer pool. */ ...@@ -984,14 +984,10 @@ the buffer pool. */
void void
buf_page_make_young( buf_page_make_young(
/*================*/ /*================*/
buf_frame_t* frame) /* in: buffer frame of a file page */ buf_block_t* block) /* in: buffer block of a file page */
{ {
buf_block_t* block;
mutex_enter(&(buf_pool->mutex)); mutex_enter(&(buf_pool->mutex));
block = buf_block_align(frame);
ut_a(block->state == BUF_BLOCK_FILE_PAGE); ut_a(block->state == BUF_BLOCK_FILE_PAGE);
buf_LRU_make_block_young(block); buf_LRU_make_block_young(block);
......
...@@ -832,15 +832,17 @@ were kept. */ ...@@ -832,15 +832,17 @@ were kept. */
void void
ibuf_set_free_bits( ibuf_set_free_bits(
/*===============*/ /*===============*/
ulint type, /* in: index type */ ulint type, /* in: index type */
page_t* page, /* in: index page; free bit is set if the index is buf_block_t* block, /* in: index page; free bit is reset
non-clustered and page level is 0 */ if the index is a non-clustered
ulint val, /* in: value to set: < 4 */ non-unique, and page level is 0 */
ulint max_val)/* in: ULINT_UNDEFINED or a maximum value which ulint val, /* in: value to set: < 4 */
the bits must have before setting; this is for ulint max_val)/* in: ULINT_UNDEFINED or a maximum
debugging */ value which the bits must have before
setting; this is for debugging */
{ {
mtr_t mtr; mtr_t mtr;
page_t* page;
page_t* bitmap_page; page_t* bitmap_page;
ulint space; ulint space;
ulint page_no; ulint page_no;
...@@ -851,6 +853,8 @@ ibuf_set_free_bits( ...@@ -851,6 +853,8 @@ ibuf_set_free_bits(
return; return;
} }
page = buf_block_get_frame(block);
if (!page_is_leaf(page)) { if (!page_is_leaf(page)) {
return; return;
...@@ -858,9 +862,9 @@ ibuf_set_free_bits( ...@@ -858,9 +862,9 @@ ibuf_set_free_bits(
mtr_start(&mtr); mtr_start(&mtr);
space = page_get_space_id(page); space = buf_block_get_space(block);
page_no = page_get_page_no(page); page_no = buf_block_get_page_no(block);
zip_size = fil_space_get_zip_size(space); zip_size = buf_block_get_zip_size(block);
bitmap_page = ibuf_bitmap_get_map_page(space, page_no, zip_size, &mtr); bitmap_page = ibuf_bitmap_get_map_page(space, page_no, zip_size, &mtr);
if (max_val != ULINT_UNDEFINED) { if (max_val != ULINT_UNDEFINED) {
...@@ -905,29 +909,12 @@ bitmap page were kept. */ ...@@ -905,29 +909,12 @@ bitmap page were kept. */
void void
ibuf_reset_free_bits_with_type( ibuf_reset_free_bits_with_type(
/*===========================*/ /*===========================*/
ulint type, /* in: index type */ ulint type, /* in: index type */
page_t* page) /* in: index page; free bits are set to 0 if the index buf_block_t* block) /* in: index page; free bits are set to 0
is non-clustered and non-unique and the page level is if the index is a non-clustered
0 */ non-unique, and page level is 0 */
{
ibuf_set_free_bits(type, page, 0, ULINT_UNDEFINED);
}
/****************************************************************************
Resets the free bits of the page in the ibuf bitmap. This is done in a
separate mini-transaction, hence this operation does not restrict further
work to solely ibuf bitmap operations, which would result if the latch to
the bitmap page were kept. */
void
ibuf_reset_free_bits(
/*=================*/
dict_index_t* index, /* in: index */
page_t* page) /* in: index page; free bits are set to 0 if
the index is non-clustered and non-unique and
the page level is 0 */
{ {
ibuf_set_free_bits(index->type, page, 0, ULINT_UNDEFINED); ibuf_set_free_bits(type, block, 0, ULINT_UNDEFINED);
} }
/************************************************************************** /**************************************************************************
......
...@@ -145,9 +145,10 @@ UNIV_INLINE ...@@ -145,9 +145,10 @@ UNIV_INLINE
void void
btr_leaf_page_release( btr_leaf_page_release(
/*==================*/ /*==================*/
page_t* page, /* in: page */ buf_block_t* block, /* in: buffer block */
ulint latch_mode, /* in: BTR_SEARCH_LEAF or BTR_MODIFY_LEAF */ ulint latch_mode, /* in: BTR_SEARCH_LEAF or
mtr_t* mtr); /* in: mtr */ BTR_MODIFY_LEAF */
mtr_t* mtr); /* in: mtr */
/****************************************************************** /******************************************************************
Gets the child node file address in a node pointer. */ Gets the child node file address in a node pointer. */
UNIV_INLINE UNIV_INLINE
......
...@@ -263,14 +263,15 @@ UNIV_INLINE ...@@ -263,14 +263,15 @@ UNIV_INLINE
void void
btr_leaf_page_release( btr_leaf_page_release(
/*==================*/ /*==================*/
page_t* page, /* in: page */ buf_block_t* block, /* in: buffer block */
ulint latch_mode, /* in: BTR_SEARCH_LEAF or BTR_MODIFY_LEAF */ ulint latch_mode, /* in: BTR_SEARCH_LEAF or
mtr_t* mtr) /* in: mtr */ BTR_MODIFY_LEAF */
mtr_t* mtr) /* in: mtr */
{ {
ut_ad(latch_mode == BTR_SEARCH_LEAF || latch_mode == BTR_MODIFY_LEAF); ut_ad(latch_mode == BTR_SEARCH_LEAF || latch_mode == BTR_MODIFY_LEAF);
ut_ad(!mtr_memo_contains_page(mtr, page, MTR_MEMO_MODIFY)); ut_ad(!mtr_memo_contains(mtr, block, MTR_MEMO_MODIFY));
mtr_memo_release(mtr, buf_block_align(page), mtr_memo_release(mtr, block,
latch_mode == BTR_SEARCH_LEAF latch_mode == BTR_SEARCH_LEAF
? MTR_MEMO_PAGE_S_FIX ? MTR_MEMO_PAGE_S_FIX
: MTR_MEMO_PAGE_X_FIX); : MTR_MEMO_PAGE_X_FIX);
......
...@@ -277,7 +277,7 @@ the buffer pool. */ ...@@ -277,7 +277,7 @@ the buffer pool. */
void void
buf_page_make_young( buf_page_make_young(
/*================*/ /*================*/
buf_frame_t* frame); /* in: buffer frame of a file page */ buf_block_t* block); /* in: buffer block of a file page */
/************************************************************************ /************************************************************************
Returns TRUE if the page can be found in the buffer pool hash table. NOTE Returns TRUE if the page can be found in the buffer pool hash table. NOTE
that it is possible that the page is not yet read from disk, though. */ that it is possible that the page is not yet read from disk, though. */
......
...@@ -63,23 +63,10 @@ bitmap page were kept. */ ...@@ -63,23 +63,10 @@ bitmap page were kept. */
void void
ibuf_reset_free_bits_with_type( ibuf_reset_free_bits_with_type(
/*===========================*/ /*===========================*/
ulint type, /* in: index type */ ulint type, /* in: index type */
page_t* page); /* in: index page; free bits are set to 0 if the index buf_block_t* block); /* in: index page; free bits are set to 0
is non-clustered and non-unique and the page level is if the index is a non-clustered
0 */ non-unique, and page level is 0 */
/****************************************************************************
Resets the free bits of the page in the ibuf bitmap. This is done in a
separate mini-transaction, hence this operation does not restrict further
work to solely ibuf bitmap operations, which would result if the latch to
the bitmap page were kept. */
void
ibuf_reset_free_bits(
/*=================*/
dict_index_t* index, /* in: index */
page_t* page); /* in: index page; free bits are set to 0 if
the index is non-clustered and non-unique and
the page level is 0 */
/**************************************************************************** /****************************************************************************
Updates the free bits of the page in the ibuf bitmap if there is not enough Updates the free bits of the page in the ibuf bitmap if there is not enough
free on the page any more. This is done in a separate mini-transaction, hence free on the page any more. This is done in a separate mini-transaction, hence
...@@ -90,7 +77,7 @@ void ...@@ -90,7 +77,7 @@ void
ibuf_update_free_bits_if_full( ibuf_update_free_bits_if_full(
/*==========================*/ /*==========================*/
dict_index_t* index, /* in: index */ dict_index_t* index, /* in: index */
page_t* page, /* in: index page to which we have added new buf_block_t* block, /* in: index page to which we have added new
records; the free bits are updated if the records; the free bits are updated if the
index is non-clustered and non-unique and index is non-clustered and non-unique and
the page level is 0, and the page becomes the page level is 0, and the page becomes
......
...@@ -58,13 +58,14 @@ were kept. */ ...@@ -58,13 +58,14 @@ were kept. */
void void
ibuf_set_free_bits( ibuf_set_free_bits(
/*===============*/ /*===============*/
ulint type, /* in: index type */ ulint type, /* in: index type */
page_t* page, /* in: index page; free bit is reset if the index is buf_block_t* block, /* in: index page; free bit is reset
a non-clustered non-unique, and page level is 0 */ if the index is a non-clustered
ulint val, /* in: value to set: < 4 */ non-unique, and page level is 0 */
ulint max_val);/* in: ULINT_UNDEFINED or a maximum value which ulint val, /* in: value to set: < 4 */
the bits must have before setting; this is for ulint max_val);/* in: ULINT_UNDEFINED or a maximum
debugging */ value which the bits must have before
setting; this is for debugging */
/************************************************************************** /**************************************************************************
A basic partial test if an insert to the insert buffer could be possible and A basic partial test if an insert to the insert buffer could be possible and
...@@ -185,7 +186,7 @@ void ...@@ -185,7 +186,7 @@ void
ibuf_update_free_bits_if_full( ibuf_update_free_bits_if_full(
/*==========================*/ /*==========================*/
dict_index_t* index, /* in: index */ dict_index_t* index, /* in: index */
page_t* page, /* in: index page to which we have added new buf_block_t* block, /* in: index page to which we have added new
records; the free bits are updated if the records; the free bits are updated if the
index is non-clustered and non-unique and index is non-clustered and non-unique and
the page level is 0, and the page becomes the page level is 0, and the page becomes
...@@ -209,10 +210,11 @@ ibuf_update_free_bits_if_full( ...@@ -209,10 +210,11 @@ ibuf_update_free_bits_if_full(
after = ibuf_index_page_calc_free_bits(max_ins_size after = ibuf_index_page_calc_free_bits(max_ins_size
- increase); - increase);
#ifdef UNIV_IBUF_DEBUG #ifdef UNIV_IBUF_DEBUG
ut_a(after <= ibuf_index_page_calc_free(page)); ut_a(after <= ibuf_index_page_calc_free(buf_block_get_frame(
block)));
#endif #endif
} else { } else {
after = ibuf_index_page_calc_free(page); after = ibuf_index_page_calc_free(buf_block_get_frame(block));
} }
if (after == 0) { if (after == 0) {
...@@ -221,10 +223,10 @@ ibuf_update_free_bits_if_full( ...@@ -221,10 +223,10 @@ ibuf_update_free_bits_if_full(
cannot make inserts using the insert buffer from slipping cannot make inserts using the insert buffer from slipping
out of the buffer pool */ out of the buffer pool */
buf_page_make_young(page); buf_page_make_young(block);
} }
if (before > after) { if (before > after) {
ibuf_set_free_bits(index->type, page, after, before); ibuf_set_free_bits(index->type, block, after, before);
} }
} }
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