Commit b7364399 authored by marko's avatar marko

branches/zip: btr_compress(): Do not modify the node pointer until the

records have successfully been copied.
parent 6748a82b
......@@ -2247,27 +2247,6 @@ btr_compress(
/* Remove the page from the level list */
btr_level_list_remove(tree, page, mtr);
if (is_left) {
btr_node_ptr_delete(tree, page, mtr);
} else {
mem_heap_t* heap = NULL;
ulint offsets_[REC_OFFS_NORMAL_SIZE];
*offsets_ = (sizeof offsets_) / sizeof *offsets_;
/* Replace the address of the old child node (= page) with the
address of the merge page to the right */
btr_node_ptr_set_child_page_no(node_ptr,
buf_block_get_page_zip(
buf_block_align(node_ptr)),
rec_get_offsets(node_ptr, cursor->index,
offsets_, ULINT_UNDEFINED, &heap),
right_page_no, mtr);
if (UNIV_LIKELY_NULL(heap)) {
mem_heap_free(heap);
}
btr_node_ptr_delete(tree, merge_page, mtr);
}
/* Move records to the merge page */
if (is_left) {
rec_t* orig_pred = page_rec_get_prev(
......@@ -2280,10 +2259,15 @@ btr_compress(
return(FALSE);
}
btr_node_ptr_delete(tree, page, mtr);
lock_update_merge_left(merge_page, orig_pred, page);
} else {
rec_t* orig_succ = page_rec_get_next(
mem_heap_t* heap = NULL;
ulint offsets_[REC_OFFS_NORMAL_SIZE];
rec_t* orig_succ = page_rec_get_next(
page_get_infimum_rec(merge_page));
*offsets_ = (sizeof offsets_) / sizeof *offsets_;
if (UNIV_UNLIKELY(!page_copy_rec_list_end(
merge_page, buf_block_get_page_zip(
buf_block_align(merge_page)),
......@@ -2292,6 +2276,20 @@ btr_compress(
return(FALSE);
}
/* Replace the address of the old child node (= page) with the
address of the merge page to the right */
btr_node_ptr_set_child_page_no(node_ptr,
buf_block_get_page_zip(
buf_block_align(node_ptr)),
rec_get_offsets(node_ptr, cursor->index,
offsets_, ULINT_UNDEFINED, &heap),
right_page_no, mtr);
if (UNIV_LIKELY_NULL(heap)) {
mem_heap_free(heap);
}
btr_node_ptr_delete(tree, merge_page, mtr);
lock_update_merge_right(orig_succ, page);
}
......
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