Commit a15f8bec authored by marko's avatar marko

branches/zip: When executing an optimistic update by delete-and-insert,

correctly estimate the free space on the compressed page by
page_zip_available(..., create=TRUE). This was reported as Issue #231.

btr_cur_update_alloc_zip(): Add the parameter ibool create and pass it
to page_zip_available(). The parameter was previously passed as 0.

btr_cur_optimistic_update(): Pass create=TRUE to btr_cur_update_alloc_zip().

rb://120 approved by Heikki Tuuri
parent b10bc48d
2009-05-18 The InnoDB Team
* btr/btr0cur.c:
Correctly estimate the space needed on the compressed page when
performing an update by delete-and-insert.
2009-05-14 The InnoDB Team 2009-05-14 The InnoDB Team
* handler/ha_innodb.cc, include/srv0srv.h, * handler/ha_innodb.cc, include/srv0srv.h,
......
...@@ -1631,6 +1631,8 @@ btr_cur_update_alloc_zip( ...@@ -1631,6 +1631,8 @@ btr_cur_update_alloc_zip(
buf_block_t* block, /* in/out: buffer page */ buf_block_t* block, /* in/out: buffer page */
dict_index_t* index, /* in: the index corresponding to the block */ dict_index_t* index, /* in: the index corresponding to the block */
ulint length, /* in: size needed */ ulint length, /* in: size needed */
ibool create, /* in: TRUE=delete-and-insert,
FALSE=update-in-place */
mtr_t* mtr) /* in: mini-transaction */ mtr_t* mtr) /* in: mini-transaction */
{ {
ut_a(page_zip == buf_block_get_page_zip(block)); ut_a(page_zip == buf_block_get_page_zip(block));
...@@ -1638,7 +1640,7 @@ btr_cur_update_alloc_zip( ...@@ -1638,7 +1640,7 @@ btr_cur_update_alloc_zip(
ut_ad(!dict_index_is_ibuf(index)); ut_ad(!dict_index_is_ibuf(index));
if (page_zip_available(page_zip, dict_index_is_clust(index), if (page_zip_available(page_zip, dict_index_is_clust(index),
length, 0)) { length, create)) {
return(TRUE); return(TRUE);
} }
...@@ -1665,7 +1667,7 @@ btr_cur_update_alloc_zip( ...@@ -1665,7 +1667,7 @@ btr_cur_update_alloc_zip(
the free space available on the page. */ the free space available on the page. */
if (!page_zip_available(page_zip, dict_index_is_clust(index), if (!page_zip_available(page_zip, dict_index_is_clust(index),
length, 0)) { length, create)) {
/* Out of space: reset the free bits. */ /* Out of space: reset the free bits. */
if (!dict_index_is_clust(index) if (!dict_index_is_clust(index)
&& page_is_leaf(buf_block_get_frame(block))) { && page_is_leaf(buf_block_get_frame(block))) {
...@@ -1730,7 +1732,7 @@ btr_cur_update_in_place( ...@@ -1730,7 +1732,7 @@ btr_cur_update_in_place(
/* Check that enough space is available on the compressed page. */ /* Check that enough space is available on the compressed page. */
if (UNIV_LIKELY_NULL(page_zip) if (UNIV_LIKELY_NULL(page_zip)
&& !btr_cur_update_alloc_zip(page_zip, block, index, && !btr_cur_update_alloc_zip(page_zip, block, index,
rec_offs_size(offsets), mtr)) { rec_offs_size(offsets), FALSE, mtr)) {
return(DB_ZIP_OVERFLOW); return(DB_ZIP_OVERFLOW);
} }
...@@ -1914,7 +1916,7 @@ btr_cur_optimistic_update( ...@@ -1914,7 +1916,7 @@ btr_cur_optimistic_update(
if (UNIV_LIKELY_NULL(page_zip) if (UNIV_LIKELY_NULL(page_zip)
&& !btr_cur_update_alloc_zip(page_zip, block, index, && !btr_cur_update_alloc_zip(page_zip, block, index,
new_rec_size, mtr)) { new_rec_size, TRUE, mtr)) {
err = DB_ZIP_OVERFLOW; err = DB_ZIP_OVERFLOW;
goto err_exit; goto err_exit;
} }
......
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