Skip to content

Commit a2fbbba

Browse files
MDEV-24832 Root page AHI removal fails during rollback of bulk insert
This failure is caused by commit 43ca605 (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ä
1 parent 786bc31 commit a2fbbba

File tree

3 files changed

+19
-5
lines changed

3 files changed

+19
-5
lines changed

mysql-test/suite/innodb/r/insert_into_empty.result

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,12 @@ ROLLBACK;
2525
CHECK TABLE t1;
2626
Table Op Msg_type Msg_text
2727
test.t1 check status OK
28+
#
29+
# MDEV-24832 Root page AHI Removal fails fails during
30+
# bulk index rollback
31+
#
32+
BEGIN;
33+
INSERT INTO t1 SELECT * FROM seq_1_to_500;
34+
ROLLBACK;
2835
DROP TABLE t1;
2936
SET GLOBAL innodb_adaptive_hash_index = @save_ahi;

mysql-test/suite/innodb/t/insert_into_empty.test

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,12 @@ BEGIN;
2424
INSERT INTO t1 SELECT * FROM seq_1_to_65536;
2525
ROLLBACK;
2626
CHECK TABLE t1;
27+
--echo #
28+
--echo # MDEV-24832 Root page AHI Removal fails fails during
29+
--echo # bulk index rollback
30+
--echo #
31+
BEGIN;
32+
INSERT INTO t1 SELECT * FROM seq_1_to_500;
33+
ROLLBACK;
2734
DROP TABLE t1;
2835
SET GLOBAL innodb_adaptive_hash_index = @save_ahi;

storage/innobase/btr/btr0btr.cc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1209,16 +1209,16 @@ void dict_index_t::clear(que_thr_t *thr)
12091209
#endif
12101210
);
12111211

1212-
mtr.memset(root_block, PAGE_HEADER + PAGE_BTR_SEG_LEAF,
1213-
FSEG_HEADER_SIZE, 0);
1214-
if (fseg_create(table->space, PAGE_HEADER + PAGE_BTR_SEG_LEAF, &mtr, false,
1215-
root_block))
1216-
btr_root_page_init(root_block, id, this, &mtr);
12171212
#ifdef BTR_CUR_HASH_ADAPT
12181213
if (root_block->index)
12191214
btr_search_drop_page_hash_index(root_block);
12201215
ut_ad(n_ahi_pages() == 0);
12211216
#endif
1217+
mtr.memset(root_block, PAGE_HEADER + PAGE_BTR_SEG_LEAF,
1218+
FSEG_HEADER_SIZE, 0);
1219+
if (fseg_create(table->space, PAGE_HEADER + PAGE_BTR_SEG_LEAF, &mtr, false,
1220+
root_block))
1221+
btr_root_page_init(root_block, id, this, &mtr);
12221222
}
12231223

12241224
mtr.commit();

0 commit comments

Comments
 (0)