Merge branch 'mysql-5.1' into mysql-5.5

parents 9cbd6d74 641ab6f3
/***************************************************************************** /*****************************************************************************
Copyright (c) 1994, 2013, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 1994, 2015, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2008, Google Inc. Copyright (c) 2008, Google Inc.
Portions of this file contain modifications contributed and copyrighted by Portions of this file contain modifications contributed and copyrighted by
...@@ -1995,6 +1995,7 @@ btr_cur_optimistic_update( ...@@ -1995,6 +1995,7 @@ btr_cur_optimistic_update(
ulint max_size; ulint max_size;
ulint new_rec_size; ulint new_rec_size;
ulint old_rec_size; ulint old_rec_size;
ulint max_ins_size = 0;
dtuple_t* new_entry; dtuple_t* new_entry;
roll_ptr_t roll_ptr; roll_ptr_t roll_ptr;
trx_t* trx; trx_t* trx;
...@@ -2105,6 +2106,11 @@ btr_cur_optimistic_update( ...@@ -2105,6 +2106,11 @@ btr_cur_optimistic_update(
: (old_rec_size : (old_rec_size
+ page_get_max_insert_size_after_reorganize(page, 1)); + page_get_max_insert_size_after_reorganize(page, 1));
if (!page_zip) {
max_ins_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))
|| (page_get_n_recs(page) <= 1))) { || (page_get_n_recs(page) <= 1))) {
...@@ -2156,10 +2162,14 @@ btr_cur_optimistic_update( ...@@ -2156,10 +2162,14 @@ btr_cur_optimistic_update(
rec = btr_cur_insert_if_possible(cursor, new_entry, 0/*n_ext*/, mtr); rec = btr_cur_insert_if_possible(cursor, new_entry, 0/*n_ext*/, mtr);
ut_a(rec); /* <- We calculated above the insert would fit */ ut_a(rec); /* <- We calculated above the insert would fit */
if (page_zip && !dict_index_is_clust(index) if (!dict_index_is_clust(index)
&& page_is_leaf(page)) { && page_is_leaf(page)) {
/* Update the free bits in the insert buffer. */ /* Update the free bits in the insert buffer. */
ibuf_update_free_bits_zip(block, mtr); if (page_zip) {
ibuf_update_free_bits_zip(block, mtr);
} else {
ibuf_update_free_bits_low(block, max_ins_size, mtr);
}
} }
/* Restore the old explicit lock state on the record */ /* Restore the old explicit lock state on the record */
...@@ -2268,6 +2278,7 @@ btr_cur_pessimistic_update( ...@@ -2268,6 +2278,7 @@ btr_cur_pessimistic_update(
ulint n_reserved; ulint n_reserved;
ulint n_ext; ulint n_ext;
ulint* offsets = NULL; ulint* offsets = NULL;
ulint max_ins_size = 0;
*big_rec = NULL; *big_rec = NULL;
...@@ -2405,6 +2416,11 @@ btr_cur_pessimistic_update( ...@@ -2405,6 +2416,11 @@ btr_cur_pessimistic_update(
ut_ad(flags & BTR_KEEP_POS_FLAG); ut_ad(flags & BTR_KEEP_POS_FLAG);
} }
if (!page_zip) {
max_ins_size = page_get_max_insert_size_after_reorganize(
page, 1);
}
/* Store state of explicit locks on rec on the page infimum record, /* Store state of explicit locks on rec on the page infimum record,
before deleting rec. The page infimum acts as a dummy carrier of the before deleting rec. The page infimum acts as a dummy carrier of the
locks, taking care also of lock releases, before we can move the locks locks, taking care also of lock releases, before we can move the locks
...@@ -2450,10 +2466,15 @@ btr_cur_pessimistic_update( ...@@ -2450,10 +2466,15 @@ btr_cur_pessimistic_update(
big_rec_vec != NULL && (flags & BTR_KEEP_POS_FLAG), big_rec_vec != NULL && (flags & BTR_KEEP_POS_FLAG),
mtr); mtr);
if (page_zip && !dict_index_is_clust(index) if (!dict_index_is_clust(index)
&& page_is_leaf(page)) { && page_is_leaf(page)) {
/* Update the free bits in the insert buffer. */ /* Update the free bits in the insert buffer. */
ibuf_update_free_bits_zip(block, mtr); if (page_zip) {
ibuf_update_free_bits_zip(block, mtr);
} else {
ibuf_update_free_bits_low(block, max_ins_size,
mtr);
}
} }
err = DB_SUCCESS; err = DB_SUCCESS;
......
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