Commit 9b264370 authored by marko's avatar marko

branches/zip: btr_cur_optimistic_insert(): After dtuple_convert_big_rec(),

invoke btr_cur_add_ext() so that rec_size will be computed correctly.
Prepare to free the memory heap when handling errors.
parent 75cf6705
...@@ -1098,6 +1098,7 @@ btr_cur_optimistic_insert( ...@@ -1098,6 +1098,7 @@ btr_cur_optimistic_insert(
return(DB_TOO_BIG_RECORD); return(DB_TOO_BIG_RECORD);
} }
ext = btr_cur_add_ext(ext, &n_ext, big_rec_vec, &heap);
rec_size = rec_get_converted_size(index, entry, ext, n_ext); rec_size = rec_get_converted_size(index, entry, ext, n_ext);
} }
...@@ -1112,11 +1113,18 @@ btr_cur_optimistic_insert( ...@@ -1112,11 +1113,18 @@ btr_cur_optimistic_insert(
&& (btr_page_get_split_rec_to_right(cursor, &dummy_rec) && (btr_page_get_split_rec_to_right(cursor, &dummy_rec)
|| btr_page_get_split_rec_to_left(cursor, &dummy_rec))) { || btr_page_get_split_rec_to_left(cursor, &dummy_rec))) {
fail: fail:
err = DB_FAIL;
fail_err:
if (big_rec_vec) { if (big_rec_vec) {
dtuple_convert_back_big_rec(index, entry, big_rec_vec); dtuple_convert_back_big_rec(index, entry, big_rec_vec);
} }
return(DB_FAIL); if (UNIV_LIKELY_NULL(heap)) {
mem_heap_free(heap);
}
return(err);
} }
if (UNIV_UNLIKELY(max_size < BTR_CUR_PAGE_REORGANIZE_LIMIT if (UNIV_UNLIKELY(max_size < BTR_CUR_PAGE_REORGANIZE_LIMIT
...@@ -1130,23 +1138,15 @@ fail: ...@@ -1130,23 +1138,15 @@ fail:
/* Check locks and write to the undo log, if specified */ /* Check locks and write to the undo log, if specified */
err = btr_cur_ins_lock_and_undo(flags, cursor, entry, thr, &inherit); err = btr_cur_ins_lock_and_undo(flags, cursor, entry, thr, &inherit);
if (err != DB_SUCCESS) { if (UNIV_UNLIKELY(err != DB_SUCCESS)) {
if (big_rec_vec) { goto fail_err;
dtuple_convert_back_big_rec(index, entry, big_rec_vec);
}
return(err);
} }
page_cursor = btr_cur_get_page_cur(cursor); page_cursor = btr_cur_get_page_cur(cursor);
reorg = FALSE; reorg = FALSE;
/* Add externally stored records, if needed */
if (UNIV_LIKELY_NULL(big_rec_vec)) {
ext = btr_cur_add_ext(ext, &n_ext, big_rec_vec, &heap);
}
/* Now, try the insert */ /* Now, try the insert */
*rec = page_cur_tuple_insert(page_cursor, entry, index, *rec = page_cur_tuple_insert(page_cursor, entry, index,
......
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