summaryrefslogtreecommitdiff
path: root/storage/xtradb/ibuf
diff options
context:
space:
mode:
authorSergei Golubchik <sergii@pisem.net>2013-07-16 19:30:39 +0200
committerSergei Golubchik <sergii@pisem.net>2013-07-16 19:30:39 +0200
commita5b534a08e5c666da6f1e909e24e40f5d6d626c0 (patch)
tree401798af6dda2e1952d57c5f91296348bd10293e /storage/xtradb/ibuf
parent005c7e54214546584c8dc67a746e215f8dbe4b58 (diff)
parent6bd24f07d4357d32a4bc7208654dc8bd0df30b76 (diff)
downloadmariadb-git-a5b534a08e5c666da6f1e909e24e40f5d6d626c0.tar.gz
merge Percona-Server-5.5.32-rel31.0.tar.gz
Diffstat (limited to 'storage/xtradb/ibuf')
-rw-r--r--storage/xtradb/ibuf/ibuf0ibuf.c28
1 files changed, 20 insertions, 8 deletions
diff --git a/storage/xtradb/ibuf/ibuf0ibuf.c b/storage/xtradb/ibuf/ibuf0ibuf.c
index 96c264b32b4..c79740a947d 100644
--- a/storage/xtradb/ibuf/ibuf0ibuf.c
+++ b/storage/xtradb/ibuf/ibuf0ibuf.c
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1997, 2012, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1997, 2013, Oracle and/or its affiliates. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -4319,7 +4319,7 @@ Deletes from ibuf the record on which pcur is positioned. If we have to
resort to a pessimistic delete, this function commits mtr and closes
the cursor.
@return TRUE if mtr was committed and pcur closed in this operation */
-static
+static __attribute__((warn_unused_result))
ibool
ibuf_delete_rec(
/*============*/
@@ -4625,6 +4625,12 @@ ibuf_merge_or_delete_for_page(
loop:
ibuf_mtr_start(&mtr);
+ /* Position pcur in the insert buffer at the first entry for this
+ index page */
+ btr_pcur_open_on_user_rec(
+ ibuf->index, search_tuple, PAGE_CUR_GE, BTR_MODIFY_LEAF,
+ &pcur, &mtr);
+
if (block) {
ibool success;
@@ -4643,12 +4649,6 @@ loop:
buf_block_dbg_add_level(block, SYNC_IBUF_TREE_NODE);
}
- /* Position pcur in the insert buffer at the first entry for this
- index page */
- btr_pcur_open_on_user_rec(
- ibuf->index, search_tuple, PAGE_CUR_GE, BTR_MODIFY_LEAF,
- &pcur, &mtr);
-
if (!btr_pcur_is_on_user_rec(&pcur)) {
ut_ad(btr_pcur_is_after_last_in_tree(&pcur, &mtr));
@@ -4733,6 +4733,16 @@ loop:
== page_no);
ut_ad(ibuf_rec_get_space(&mtr, rec) == space);
+ /* Mark the change buffer record processed,
+ so that it will not be merged again in case
+ the server crashes between the following
+ mtr_commit() and the subsequent mtr_commit()
+ of deleting the change buffer record. */
+
+ btr_cur_set_deleted_flag_for_ibuf(
+ btr_pcur_get_rec(&pcur), NULL,
+ TRUE, &mtr);
+
btr_pcur_store_position(&pcur, &mtr);
ibuf_btr_pcur_commit_specify_mtr(&pcur, &mtr);
@@ -4781,6 +4791,7 @@ loop:
/* Deletion was pessimistic and mtr was committed:
we start from the beginning again */
+ ut_ad(mtr.state == MTR_COMMITTED);
goto loop;
} else if (btr_pcur_is_after_last_on_page(&pcur)) {
ibuf_mtr_commit(&mtr);
@@ -4911,6 +4922,7 @@ loop:
/* Deletion was pessimistic and mtr was committed:
we start from the beginning again */
+ ut_ad(mtr.state == MTR_COMMITTED);
goto loop;
}