Commit 9d620a85 authored by Marko Mäkelä's avatar Marko Mäkelä

Bug#13523839 ASSERTION FAILURES ON COMPRESSED INNODB TABLES

btr_cur_optimistic_insert(): Remove a bogus assertion. The insert may
fail after reorganizing the page.

btr_cur_optimistic_update(): Do not attempt to reorganize compressed pages,
because compression may fail after reorganization.

page_copy_rec_list_start(): Use page_rec_get_nth() to restore to the
ret_pos, which may also be the page infimum.

rb:1221
parent c6d8569d
2012-08-16 The InnoDB Team
* btr/btr0cur.c, page/page0page.c:
Fix Bug#13523839 ASSERTION FAILURES ON COMPRESSED INNODB TABLES
2012-08-07 The InnoDB Team 2012-08-07 The InnoDB Team
* btr/btr0pcur.c, row/row0merge.c: * btr/btr0pcur.c, row/row0merge.c:
......
...@@ -1220,7 +1220,12 @@ fail_err: ...@@ -1220,7 +1220,12 @@ fail_err:
if (UNIV_UNLIKELY(reorg)) { if (UNIV_UNLIKELY(reorg)) {
ut_a(zip_size); ut_a(zip_size);
ut_a(*rec); /* It's possible for rec to be NULL if the
page is compressed. This is because a
reorganized page may become incompressible. */
if (!*rec) {
goto fail;
}
} }
} }
...@@ -1973,8 +1978,12 @@ any_extern: ...@@ -1973,8 +1978,12 @@ any_extern:
goto err_exit; goto err_exit;
} }
max_size = old_rec_size /* We do not attempt to reorganize if the page is compressed.
+ page_get_max_insert_size_after_reorganize(page, 1); This is because the page may fail to compress after reorganization. */
max_size = page_zip
? page_get_max_insert_size(page, 1)
: (old_rec_size
+ page_get_max_insert_size_after_reorganize(page, 1));
if (!(((max_size >= BTR_CUR_PAGE_REORGANIZE_LIMIT) if (!(((max_size >= BTR_CUR_PAGE_REORGANIZE_LIMIT)
&& (max_size >= new_rec_size)) && (max_size >= new_rec_size))
......
...@@ -780,12 +780,18 @@ page_copy_rec_list_start( ...@@ -780,12 +780,18 @@ page_copy_rec_list_start(
if (UNIV_LIKELY_NULL(new_page_zip)) { if (UNIV_LIKELY_NULL(new_page_zip)) {
mtr_set_log_mode(mtr, log_mode); mtr_set_log_mode(mtr, log_mode);
DBUG_EXECUTE_IF("page_copy_rec_list_start_compress_fail",
goto zip_reorganize;);
if (UNIV_UNLIKELY if (UNIV_UNLIKELY
(!page_zip_compress(new_page_zip, new_page, index, mtr))) { (!page_zip_compress(new_page_zip, new_page, index, mtr))) {
ulint ret_pos;
#ifndef DBUG_OFF
zip_reorganize:
#endif /* DBUG_OFF */
/* Before trying to reorganize the page, /* Before trying to reorganize the page,
store the number of preceding records on the page. */ store the number of preceding records on the page. */
ulint ret_pos ret_pos = page_rec_get_n_recs_before(ret);
= page_rec_get_n_recs_before(ret);
/* Before copying, "ret" was the predecessor /* Before copying, "ret" was the predecessor
of the predefined supremum record. If it was of the predefined supremum record. If it was
the predefined infimum record, then it would the predefined infimum record, then it would
...@@ -806,15 +812,10 @@ page_copy_rec_list_start( ...@@ -806,15 +812,10 @@ page_copy_rec_list_start(
btr_blob_dbg_add(new_page, index, btr_blob_dbg_add(new_page, index,
"copy_start_reorg_fail"); "copy_start_reorg_fail");
return(NULL); return(NULL);
} else {
/* The page was reorganized:
Seek to ret_pos. */
ret = new_page + PAGE_NEW_INFIMUM;
do {
ret = rec_get_next_ptr(ret, TRUE);
} while (--ret_pos);
} }
/* The page was reorganized: Seek to ret_pos. */
ret = page_rec_get_nth(new_page, ret_pos);
} }
} }
......
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