Commit 9311391e 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 17f87488
...@@ -977,9 +977,8 @@ btr_page_reorganize_low( ...@@ -977,9 +977,8 @@ btr_page_reorganize_low(
if (UNIV_LIKELY_NULL(page_zip) if (UNIV_LIKELY_NULL(page_zip)
&& !dict_index_is_clust(index) && page_is_leaf(page)) { && !dict_index_is_clust(index) && page_is_leaf(page)) {
ibuf_update_free_bits_if_full( ibuf_update_free_bits_zip(
index, page_zip_get_size(page_zip), block, index, page_zip_get_size(page_zip), block);
UNIV_PAGE_SIZE, ULINT_UNDEFINED);
} }
func_exit: func_exit:
...@@ -2519,8 +2518,14 @@ err_exit: ...@@ -2519,8 +2518,14 @@ err_exit:
if (!dict_index_is_clust(index) && page_is_leaf(merge_page)) { if (!dict_index_is_clust(index) && page_is_leaf(merge_page)) {
/* We have added new records to merge_page: /* We have added new records to merge_page:
update its free bits */ update its free bits */
ibuf_update_free_bits_if_full(index, zip_size, merge_block, if (zip_size) {
UNIV_PAGE_SIZE, ULINT_UNDEFINED); 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)); ut_ad(page_validate(merge_page, index));
......
...@@ -898,11 +898,12 @@ btr_cur_insert_if_possible( ...@@ -898,11 +898,12 @@ btr_cur_insert_if_possible(
} }
if (buf_block_get_page_zip(block) 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. */ /* Update the free bits in the insert buffer. */
ibuf_update_free_bits_if_full( ibuf_update_free_bits_zip(cursor->index,
cursor->index, buf_block_get_zip_size(block), buf_block_get_zip_size(block),
block, UNIV_PAGE_SIZE, ULINT_UNDEFINED); block);
} }
return(rec); return(rec);
...@@ -1228,12 +1229,11 @@ fail_err: ...@@ -1228,12 +1229,11 @@ fail_err:
if (!dict_index_is_clust(index) && UNIV_LIKELY(0 == level)) { if (!dict_index_is_clust(index) && UNIV_LIKELY(0 == level)) {
/* We have added a record to page: update its free bits */ /* We have added a record to page: update its free bits */
if (zip_size) { if (zip_size) {
ibuf_update_free_bits_if_full( ibuf_update_free_bits_zip(cursor->index,
cursor->index, zip_size, block, zip_size, block);
UNIV_PAGE_SIZE, ULINT_UNDEFINED);
} else { } else {
ibuf_update_free_bits_if_full( ibuf_update_free_bits_if_full(
cursor->index, zip_size, block, max_size, cursor->index, block, max_size,
rec_size + PAGE_DIR_SLOT_SIZE); rec_size + PAGE_DIR_SLOT_SIZE);
} }
} }
...@@ -1733,11 +1733,11 @@ btr_cur_update_in_place( ...@@ -1733,11 +1733,11 @@ btr_cur_update_in_place(
thr, &roll_ptr); thr, &roll_ptr);
if (UNIV_UNLIKELY(err != DB_SUCCESS)) { 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. */ /* Update the free bits in the insert buffer. */
ibuf_update_free_bits_if_full( ibuf_update_free_bits_zip(
index, buf_block_get_zip_size(block), index, page_zip_get_size(page_zip), block);
block, UNIV_PAGE_SIZE, ULINT_UNDEFINED);
} }
if (UNIV_LIKELY_NULL(heap)) { if (UNIV_LIKELY_NULL(heap)) {
...@@ -1775,12 +1775,11 @@ btr_cur_update_in_place( ...@@ -1775,12 +1775,11 @@ btr_cur_update_in_place(
rw_lock_x_unlock(&btr_search_latch); 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. */ /* Update the free bits in the insert buffer. */
ibuf_update_free_bits_if_full(index, ibuf_update_free_bits_zip(index, buf_block_get_zip_size(block),
buf_block_get_zip_size(block), block);
block,
UNIV_PAGE_SIZE, ULINT_UNDEFINED);
} }
btr_cur_update_in_place_log(flags, rec, index, update, btr_cur_update_in_place_log(flags, rec, index, update,
...@@ -1954,11 +1953,11 @@ btr_cur_optimistic_update( ...@@ -1954,11 +1953,11 @@ btr_cur_optimistic_update(
&roll_ptr); &roll_ptr);
if (err != DB_SUCCESS) { if (err != DB_SUCCESS) {
err_exit: 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. */ /* Update the free bits in the insert buffer. */
ibuf_update_free_bits_if_full( ibuf_update_free_bits_zip(
index, buf_block_get_zip_size(block), index, buf_block_get_zip_size(block), block);
block, UNIV_PAGE_SIZE, ULINT_UNDEFINED);
} }
mem_heap_free(heap); mem_heap_free(heap);
......
...@@ -77,8 +77,6 @@ void ...@@ -77,8 +77,6 @@ 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 */
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 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
...@@ -90,6 +88,19 @@ ibuf_update_free_bits_if_full( ...@@ -90,6 +88,19 @@ ibuf_update_free_bits_if_full(
ulint increase);/* in: upper limit for the additional space ulint increase);/* in: upper limit for the additional space
used in the latest operation, if known, or used in the latest operation, if known, or
ULINT_UNDEFINED */ 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 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 in the mtr given, which means that the latching order rules virtually
......
...@@ -232,8 +232,6 @@ void ...@@ -232,8 +232,6 @@ 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 */
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 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
...@@ -249,19 +247,19 @@ ibuf_update_free_bits_if_full( ...@@ -249,19 +247,19 @@ ibuf_update_free_bits_if_full(
ulint before; ulint before;
ulint after; 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 (max_ins_size >= increase) {
#if ULINT32_UNDEFINED <= UNIV_PAGE_SIZE #if ULINT32_UNDEFINED <= UNIV_PAGE_SIZE
# error "ULINT32_UNDEFINED <= UNIV_PAGE_SIZE" # error "ULINT32_UNDEFINED <= UNIV_PAGE_SIZE"
#endif #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); - increase);
#ifdef UNIV_IBUF_DEBUG #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 #endif
} else { } else {
after = ibuf_index_page_calc_free(zip_size, block); after = ibuf_index_page_calc_free(0, block);
} }
if (after == 0) { if (after == 0) {
...@@ -277,3 +275,31 @@ ibuf_update_free_bits_if_full( ...@@ -277,3 +275,31 @@ ibuf_update_free_bits_if_full(
ibuf_set_free_bits(index->type, block, after, before); 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( ...@@ -3875,9 +3875,8 @@ page_zip_reorganize(
if (!dict_index_is_clust(index) && page_is_leaf(page)) { if (!dict_index_is_clust(index) && page_is_leaf(page)) {
/* Recompute the insert buffer free bits. */ /* Recompute the insert buffer free bits. */
ibuf_update_free_bits_if_full( ibuf_update_free_bits_zip(index,
index, page_zip_get_size(page_zip), block, page_zip_get_size(page_zip), block);
UNIV_PAGE_SIZE, ULINT_UNDEFINED);
} }
buf_block_free(temp_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