Commit 5f44e6b3 authored by marko's avatar marko

branches/zip: ibuf_update_free_bits_if_full(): Remove the zip_size

parameter.  Add ibuf_update_free_bits_zip() for compressed pages.
parent a1475f69
......@@ -977,9 +977,8 @@ btr_page_reorganize_low(
if (UNIV_LIKELY_NULL(page_zip)
&& !dict_index_is_clust(index) && page_is_leaf(page)) {
ibuf_update_free_bits_if_full(
index, page_zip_get_size(page_zip), block,
UNIV_PAGE_SIZE, ULINT_UNDEFINED);
ibuf_update_free_bits_zip(
index, page_zip_get_size(page_zip), block);
}
func_exit:
......@@ -2519,8 +2518,14 @@ err_exit:
if (!dict_index_is_clust(index) && page_is_leaf(merge_page)) {
/* We have added new records to merge_page:
update its free bits */
ibuf_update_free_bits_if_full(index, zip_size, merge_block,
UNIV_PAGE_SIZE, ULINT_UNDEFINED);
if (zip_size) {
ibuf_update_free_bits_zip(index, zip_size,
merge_block);
} else {
ibuf_update_free_bits_if_full(index, merge_block,
UNIV_PAGE_SIZE,
ULINT_UNDEFINED);
}
}
ut_ad(page_validate(merge_page, index));
......
......@@ -898,11 +898,12 @@ btr_cur_insert_if_possible(
}
if (buf_block_get_page_zip(block)
&& !dict_index_is_clust(cursor->index)) {
&& !dict_index_is_clust(cursor->index)
&& page_is_leaf(buf_block_get_frame(block))) {
/* Update the free bits in the insert buffer. */
ibuf_update_free_bits_if_full(
cursor->index, buf_block_get_zip_size(block),
block, UNIV_PAGE_SIZE, ULINT_UNDEFINED);
ibuf_update_free_bits_zip(cursor->index,
buf_block_get_zip_size(block),
block);
}
return(rec);
......@@ -1228,12 +1229,11 @@ fail_err:
if (!dict_index_is_clust(index) && UNIV_LIKELY(0 == level)) {
/* We have added a record to page: update its free bits */
if (zip_size) {
ibuf_update_free_bits_if_full(
cursor->index, zip_size, block,
UNIV_PAGE_SIZE, ULINT_UNDEFINED);
ibuf_update_free_bits_zip(cursor->index,
zip_size, block);
} else {
ibuf_update_free_bits_if_full(
cursor->index, zip_size, block, max_size,
cursor->index, block, max_size,
rec_size + PAGE_DIR_SLOT_SIZE);
}
}
......@@ -1733,11 +1733,11 @@ btr_cur_update_in_place(
thr, &roll_ptr);
if (UNIV_UNLIKELY(err != DB_SUCCESS)) {
if (page_zip && !dict_index_is_clust(index)) {
if (page_zip && !dict_index_is_clust(index)
&& page_is_leaf(buf_block_get_frame(block))) {
/* Update the free bits in the insert buffer. */
ibuf_update_free_bits_if_full(
index, buf_block_get_zip_size(block),
block, UNIV_PAGE_SIZE, ULINT_UNDEFINED);
ibuf_update_free_bits_zip(
index, page_zip_get_size(page_zip), block);
}
if (UNIV_LIKELY_NULL(heap)) {
......@@ -1775,12 +1775,11 @@ btr_cur_update_in_place(
rw_lock_x_unlock(&btr_search_latch);
}
if (page_zip && !dict_index_is_clust(index)) {
if (page_zip && !dict_index_is_clust(index)
&& page_is_leaf(buf_block_get_frame(block))) {
/* Update the free bits in the insert buffer. */
ibuf_update_free_bits_if_full(index,
buf_block_get_zip_size(block),
block,
UNIV_PAGE_SIZE, ULINT_UNDEFINED);
ibuf_update_free_bits_zip(index, buf_block_get_zip_size(block),
block);
}
btr_cur_update_in_place_log(flags, rec, index, update,
......@@ -1954,11 +1953,11 @@ btr_cur_optimistic_update(
&roll_ptr);
if (err != DB_SUCCESS) {
err_exit:
if (page_zip && !dict_index_is_clust(index)) {
if (page_zip && !dict_index_is_clust(index)
&& page_is_leaf(page)) {
/* Update the free bits in the insert buffer. */
ibuf_update_free_bits_if_full(
index, buf_block_get_zip_size(block),
block, UNIV_PAGE_SIZE, ULINT_UNDEFINED);
ibuf_update_free_bits_zip(
index, buf_block_get_zip_size(block), block);
}
mem_heap_free(heap);
......
......@@ -77,8 +77,6 @@ void
ibuf_update_free_bits_if_full(
/*==========================*/
dict_index_t* index, /* in: index */
ulint zip_size,/* in: compressed page size in bytes;
0 for uncompressed pages */
buf_block_t* block, /* in: index page to which we have added new
records; the free bits are updated if the
index is non-clustered and non-unique and
......@@ -90,6 +88,19 @@ ibuf_update_free_bits_if_full(
ulint increase);/* in: upper limit for the additional space
used in the latest operation, if known, or
ULINT_UNDEFINED */
/****************************************************************************
Updates the free bits of a compressed page in the ibuf bitmap. This
is done in a separate mini-transaction, hence this operation does not
restrict further work to only ibuf bitmap operations, which would
result if the latch to the bitmap page were kept. */
UNIV_INLINE
void
ibuf_update_free_bits_zip(
/*======================*/
dict_index_t* index, /* in: index */
ulint zip_size,/* in: compressed page size in bytes */
buf_block_t* block); /* in: B-tree leaf page of a secondary
index */
/**************************************************************************
Updates the free bits for the page to reflect the present state. Does this
in the mtr given, which means that the latching order rules virtually
......
......@@ -232,8 +232,6 @@ void
ibuf_update_free_bits_if_full(
/*==========================*/
dict_index_t* index, /* in: index */
ulint zip_size,/* in: compressed page size in bytes;
0 for uncompressed pages */
buf_block_t* block, /* in: index page to which we have added new
records; the free bits are updated if the
index is non-clustered and non-unique and
......@@ -249,19 +247,19 @@ ibuf_update_free_bits_if_full(
ulint before;
ulint after;
before = ibuf_index_page_calc_free_bits(zip_size, max_ins_size);
before = ibuf_index_page_calc_free_bits(0, max_ins_size);
if (max_ins_size >= increase) {
#if ULINT32_UNDEFINED <= UNIV_PAGE_SIZE
# error "ULINT32_UNDEFINED <= UNIV_PAGE_SIZE"
#endif
after = ibuf_index_page_calc_free_bits(zip_size, max_ins_size
after = ibuf_index_page_calc_free_bits(0, max_ins_size
- increase);
#ifdef UNIV_IBUF_DEBUG
ut_a(after <= ibuf_index_page_calc_free(zip_size, block));
ut_a(after <= ibuf_index_page_calc_free(0, block));
#endif
} else {
after = ibuf_index_page_calc_free(zip_size, block);
after = ibuf_index_page_calc_free(0, block);
}
if (after == 0) {
......@@ -277,3 +275,31 @@ ibuf_update_free_bits_if_full(
ibuf_set_free_bits(index->type, block, after, before);
}
}
/****************************************************************************
Updates the free bits of a compressed page in the ibuf bitmap. This
is done in a separate mini-transaction, hence this operation does not
restrict further work to only ibuf bitmap operations, which would
result if the latch to the bitmap page were kept. */
UNIV_INLINE
void
ibuf_update_free_bits_zip(
/*======================*/
dict_index_t* index, /* in: index */
ulint zip_size,/* in: compressed page size in bytes */
buf_block_t* block) /* in: B-tree leaf page of a secondary
index */
{
ulint free_bits = ibuf_index_page_calc_free(zip_size, block);
if (free_bits == 0) {
/* We move the page to the front of the buffer pool LRU list:
the purpose of this is to prevent those pages to which we
cannot make inserts using the insert buffer from slipping
out of the buffer pool */
buf_page_make_young(&block->page);
}
ibuf_set_free_bits(index->type, block, free_bits, ULINT_UNDEFINED);
}
......@@ -3875,9 +3875,8 @@ page_zip_reorganize(
if (!dict_index_is_clust(index) && page_is_leaf(page)) {
/* Recompute the insert buffer free bits. */
ibuf_update_free_bits_if_full(
index, page_zip_get_size(page_zip), block,
UNIV_PAGE_SIZE, ULINT_UNDEFINED);
ibuf_update_free_bits_zip(index,
page_zip_get_size(page_zip), block);
}
buf_block_free(temp_block);
......
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