Commit 1b6e5143 authored by marko's avatar marko

branches/zip: Note that page_cur_tuple_insert() can fail without attempting

to reorganize a compressed page.  This mistake was made in r1308.
parent 2b060715
......@@ -1962,13 +1962,10 @@ btr_page_split_and_insert(
goto func_exit;
}
/* 8. If insert did not fit, try page reorganization.
For compressed pages, that is already attempted in
page_cur_tuple_insert(). */
/* 8. If insert did not fit, try page reorganization */
if (UNIV_UNLIKELY
(buf_block_get_page_zip(insert_block)
|| !btr_page_reorganize(insert_block, cursor->index, mtr))) {
(!btr_page_reorganize(insert_block, cursor->index, mtr))) {
goto insert_failed;
}
......
......@@ -883,18 +883,8 @@ btr_cur_insert_if_possible(
rec = page_cur_tuple_insert(page_cursor, tuple,
cursor->index, ext, n_ext, mtr);
if (buf_block_get_page_zip(block)) {
if (!dict_index_is_clust(cursor->index)) {
/* 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);
}
} else if (UNIV_UNLIKELY(!rec)) {
/* If record did not fit, reorganize.
For compressed pages, this is attempted already in
page_cur_tuple_insert(). */
if (UNIV_UNLIKELY(!rec)) {
/* If record did not fit, reorganize */
if (btr_page_reorganize(block, cursor->index, mtr)) {
......@@ -907,6 +897,14 @@ btr_cur_insert_if_possible(
}
}
if (buf_block_get_page_zip(block)
&& !dict_index_is_clust(cursor->index)) {
/* 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);
}
return(rec);
}
......@@ -1185,15 +1183,12 @@ btr_cur_optimistic_insert(
}
}
if (UNIV_LIKELY(*rec != NULL)) {
} else if (zip_size) {
/* If the record did not fit on a compressed page, fail. */
goto fail;
} else {
/* If the record did not fit, reorganize. For compressed
pages, this is attempted already in page_cur_tuple_insert(). */
if (UNIV_UNLIKELY(!*rec) && UNIV_LIKELY(!reorg)) {
/* If the record did not fit, reorganize */
if (UNIV_UNLIKELY(!btr_page_reorganize(block, index, mtr))) {
ut_error;
ut_a(zip_size);
goto fail;
}
ut_ad(page_get_max_insert_size(page, 1) == max_size);
......@@ -1206,6 +1201,11 @@ btr_cur_optimistic_insert(
ext, n_ext, mtr);
if (UNIV_UNLIKELY(!*rec)) {
if (UNIV_LIKELY(zip_size != 0)) {
goto fail;
}
fputs("InnoDB: Error: cannot insert tuple ", stderr);
dtuple_print(stderr, entry);
fputs(" into ", stderr);
......
......@@ -2929,13 +2929,6 @@ ibuf_insert_to_index_page(
return;
}
if (UNIV_LIKELY_NULL(buf_block_get_page_zip(block))) {
/* For compressed pages, reorganization was
attempted (in vain) in page_cur_tuple_insert(). */
goto ibuf_fail;
}
/* If the record did not fit, reorganize */
btr_page_reorganize(block, index, mtr);
......@@ -2949,7 +2942,6 @@ ibuf_insert_to_index_page(
ulint page_no;
ulint zip_size;
ibuf_fail:
ut_print_timestamp(stderr);
fprintf(stderr,
......@@ -3162,7 +3154,7 @@ ibuf_merge_or_delete_for_page(
return;
}
if (update_ibuf_bitmap) {
if (UNIV_LIKELY(update_ibuf_bitmap)) {
ut_a(ut_is_2pow(zip_size));
if (ibuf_fixed_addr_page(space, zip_size, page_no)
......@@ -3177,7 +3169,7 @@ ibuf_merge_or_delete_for_page(
tablespace_being_deleted = fil_inc_pending_ibuf_merges(space);
if (tablespace_being_deleted) {
if (UNIV_UNLIKELY(tablespace_being_deleted)) {
/* Do not try to read the bitmap page from space;
just delete the ibuf records for the page */
......@@ -3377,7 +3369,7 @@ ibuf_merge_or_delete_for_page(
ibuf_print(); */
}
#endif
if (update_ibuf_bitmap) {
if (UNIV_LIKELY(update_ibuf_bitmap)) {
bitmap_page = ibuf_bitmap_get_map_page(space, page_no,
zip_size, &mtr);
ibuf_bitmap_page_set_bits(bitmap_page, page_no, zip_size,
......
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