Commit 34cdc006 authored by Marko Mäkelä's avatar Marko Mäkelä

MDEV-13542 fixup: Improve page reorganize

btr_page_reorganize_low(): Restore mtr->set_log_mode() before returning.

innobase_instant_try(): Do not invoke rec_get_offsets() if
btr_cur_pessimistic_update() failed. The cursor position may be
invalid.
parent 84d26f98
......@@ -1246,8 +1246,6 @@ btr_write_autoinc(dict_index_t* index, ib_uint64_t autoinc, bool reset)
static dberr_t btr_page_reorganize_low(page_cur_t *cursor, dict_index_t *index,
mtr_t *mtr)
{
const mtr_log_t log_mode= mtr->set_log_mode(MTR_LOG_NO_REDO);
buf_block_t *const block= cursor->block;
ut_ad(mtr->memo_contains_flagged(block, MTR_MEMO_PAGE_X_FIX));
......@@ -1271,6 +1269,8 @@ static dberr_t btr_page_reorganize_low(page_cur_t *cursor, dict_index_t *index,
memcpy_aligned<UNIV_PAGE_SIZE_MIN>(old->page.frame, block->page.frame,
srv_page_size);
const mtr_log_t log_mode= mtr->set_log_mode(MTR_LOG_NO_REDO);
page_create(block, mtr, index->table->not_redundant());
if (index->is_spatial())
block->page.frame[FIL_PAGE_TYPE + 1]= byte(FIL_PAGE_RTREE);
......@@ -1281,10 +1281,13 @@ static dberr_t btr_page_reorganize_low(page_cur_t *cursor, dict_index_t *index,
/* Copy the records from the temporary space to the recreated page;
do not copy the lock bits yet */
if (dberr_t err=
page_copy_rec_list_end_no_locks(block, old,
page_get_infimum_rec(old->page.frame),
index, mtr))
dberr_t err=
page_copy_rec_list_end_no_locks(block, old,
page_get_infimum_rec(old->page.frame),
index, mtr);
mtr->set_log_mode(log_mode);
if (UNIV_UNLIKELY(err != DB_SUCCESS))
return err;
/* Copy the PAGE_MAX_TRX_ID or PAGE_ROOT_AUTO_INC. */
......@@ -1329,8 +1332,6 @@ static dberr_t btr_page_reorganize_low(page_cur_t *cursor, dict_index_t *index,
else if (!(cursor->rec= page_rec_get_nth(block->page.frame, pos)))
return DB_CORRUPTION;
mtr->set_log_mode(log_mode);
if (block->page.id().page_no() != index->page ||
fil_page_get_type(old->page.frame) != FIL_PAGE_TYPE_INSTANT)
ut_ad(!memcmp(old->page.frame, block->page.frame, PAGE_HEADER));
......
......@@ -6119,10 +6119,13 @@ static bool innobase_instant_try(
&offsets, &offsets_heap, ctx->heap,
&big_rec, update, UPD_NODE_NO_ORD_CHANGE,
thr, trx->id, &mtr);
if (err == DB_SUCCESS) {
offsets = rec_get_offsets(
btr_pcur_get_rec(&pcur), index, offsets,
index->n_core_fields, ULINT_UNDEFINED,
&offsets_heap);
}
offsets = rec_get_offsets(
btr_pcur_get_rec(&pcur), index, offsets,
index->n_core_fields, ULINT_UNDEFINED, &offsets_heap);
if (big_rec) {
if (err == DB_SUCCESS) {
err = btr_store_big_rec_extern_fields(
......
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