Commit abc7f6c9 authored by marko's avatar marko

btr_cur_optimistic_insert(): When inserting into a compressed page,

pass max_ins_size=UNIV_PAGE_SIZE and increase=ULINT_UNDEFINED to
ibuf_update_free_bits_if_full().  Otherwise, a bogus assertion failure
may occur when the page is recompressed and there is more space available
in the modification log after inserting the record.
parent d32cd964
...@@ -1156,21 +1156,6 @@ btr_cur_optimistic_insert( ...@@ -1156,21 +1156,6 @@ btr_cur_optimistic_insert(
/* Now, try the insert */ /* Now, try the insert */
if (zip_size
&& !dict_index_is_clust(index) && UNIV_LIKELY(0 == level)) {
/* Compute the reduced max_size for the insert buffer
before inserting the record. */
lint zip_max_ins = page_zip_max_ins_size(
buf_block_get_page_zip(block), FALSE);
if (UNIV_UNLIKELY(zip_max_ins < 0)) {
max_size = 0;
} else if (UNIV_LIKELY(max_size > (ulint) zip_max_ins)) {
max_size = (ulint) zip_max_ins;
}
}
{ {
const rec_t* page_cursor_rec = page_cur_get_rec(page_cursor); const rec_t* page_cursor_rec = page_cur_get_rec(page_cursor);
*rec = page_cur_tuple_insert(page_cursor, entry, index, *rec = page_cur_tuple_insert(page_cursor, entry, index,
...@@ -1191,7 +1176,8 @@ btr_cur_optimistic_insert( ...@@ -1191,7 +1176,8 @@ btr_cur_optimistic_insert(
goto fail; goto fail;
} }
ut_ad(page_get_max_insert_size(page, 1) == max_size); ut_ad(zip_size
|| page_get_max_insert_size(page, 1) == max_size);
reorg = TRUE; reorg = TRUE;
...@@ -1241,9 +1227,15 @@ btr_cur_optimistic_insert( ...@@ -1241,9 +1227,15 @@ btr_cur_optimistic_insert(
#endif #endif
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 */
ibuf_update_free_bits_if_full(cursor->index, zip_size, if (zip_size) {
block, max_size, ibuf_update_free_bits_if_full(
rec_size + PAGE_DIR_SLOT_SIZE); cursor->index, zip_size, block,
UNIV_PAGE_SIZE, ULINT_UNDEFINED);
} else {
ibuf_update_free_bits_if_full(
cursor->index, zip_size, block, max_size,
rec_size + PAGE_DIR_SLOT_SIZE);
}
} }
*big_rec = big_rec_vec; *big_rec = big_rec_vec;
......
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