summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThirunarayanan Balathandayuthapani <thiru@mariadb.com>2021-02-10 15:27:25 +0530
committerThirunarayanan Balathandayuthapani <thiru@mariadb.com>2021-02-10 15:27:25 +0530
commita2fbbba2e3f2ee291163d74f3f4246e259a5cffe (patch)
treefca04018eab188d4f0fea5300cfffa0295a099f6
parent786bc312b85e58857cb26a24ab6e997ba0fdfc32 (diff)
downloadmariadb-git-a2fbbba2e3f2ee291163d74f3f4246e259a5cffe.tar.gz
MDEV-24832 Root page AHI removal fails during rollback of bulk insert
This failure is caused by commit 43ca6059cae8225e72fbd9495d20a6ce1c0f31b8 (MDEV-24720). InnoDB fails to remove the ahi entries during rollback of bulk insert operation. InnoDB should remove the AHI entries of root page before reinitialising it. Reviewed-by: Marko Mäkelä
-rw-r--r--mysql-test/suite/innodb/r/insert_into_empty.result7
-rw-r--r--mysql-test/suite/innodb/t/insert_into_empty.test7
-rw-r--r--storage/innobase/btr/btr0btr.cc10
3 files changed, 19 insertions, 5 deletions
diff --git a/mysql-test/suite/innodb/r/insert_into_empty.result b/mysql-test/suite/innodb/r/insert_into_empty.result
index 02d9549886d..2fd351c3f47 100644
--- a/mysql-test/suite/innodb/r/insert_into_empty.result
+++ b/mysql-test/suite/innodb/r/insert_into_empty.result
@@ -25,5 +25,12 @@ ROLLBACK;
CHECK TABLE t1;
Table Op Msg_type Msg_text
test.t1 check status OK
+#
+# MDEV-24832 Root page AHI Removal fails fails during
+# bulk index rollback
+#
+BEGIN;
+INSERT INTO t1 SELECT * FROM seq_1_to_500;
+ROLLBACK;
DROP TABLE t1;
SET GLOBAL innodb_adaptive_hash_index = @save_ahi;
diff --git a/mysql-test/suite/innodb/t/insert_into_empty.test b/mysql-test/suite/innodb/t/insert_into_empty.test
index af067cbd02d..6d5cb2119a2 100644
--- a/mysql-test/suite/innodb/t/insert_into_empty.test
+++ b/mysql-test/suite/innodb/t/insert_into_empty.test
@@ -24,5 +24,12 @@ BEGIN;
INSERT INTO t1 SELECT * FROM seq_1_to_65536;
ROLLBACK;
CHECK TABLE t1;
+--echo #
+--echo # MDEV-24832 Root page AHI Removal fails fails during
+--echo # bulk index rollback
+--echo #
+BEGIN;
+INSERT INTO t1 SELECT * FROM seq_1_to_500;
+ROLLBACK;
DROP TABLE t1;
SET GLOBAL innodb_adaptive_hash_index = @save_ahi;
diff --git a/storage/innobase/btr/btr0btr.cc b/storage/innobase/btr/btr0btr.cc
index 96fe35362d5..c8c49a27a59 100644
--- a/storage/innobase/btr/btr0btr.cc
+++ b/storage/innobase/btr/btr0btr.cc
@@ -1209,16 +1209,16 @@ void dict_index_t::clear(que_thr_t *thr)
#endif
);
- mtr.memset(root_block, PAGE_HEADER + PAGE_BTR_SEG_LEAF,
- FSEG_HEADER_SIZE, 0);
- if (fseg_create(table->space, PAGE_HEADER + PAGE_BTR_SEG_LEAF, &mtr, false,
- root_block))
- btr_root_page_init(root_block, id, this, &mtr);
#ifdef BTR_CUR_HASH_ADAPT
if (root_block->index)
btr_search_drop_page_hash_index(root_block);
ut_ad(n_ahi_pages() == 0);
#endif
+ mtr.memset(root_block, PAGE_HEADER + PAGE_BTR_SEG_LEAF,
+ FSEG_HEADER_SIZE, 0);
+ if (fseg_create(table->space, PAGE_HEADER + PAGE_BTR_SEG_LEAF, &mtr, false,
+ root_block))
+ btr_root_page_init(root_block, id, this, &mtr);
}
mtr.commit();