Skip to content

Commit a92f07f

Browse files
committed
MDEV-27993 Assertion failed in btr_page_reorganize_low()
btr_cur_optimistic_insert(): Disregard DEBUG_DBUG injection to invoke btr_page_reorganize() if the page (and the table) is empty. Otherwise, an assertion would fail in btr_page_reorganize_low() because PAGE_MAX_TRX_ID is 0 in an empty secondary index leaf page.
1 parent 3fd79a0 commit a92f07f

File tree

3 files changed

+17
-1
lines changed

3 files changed

+17
-1
lines changed

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,10 @@ f1
2525
disconnect con1;
2626
connection default;
2727
drop table t1;
28+
#
29+
# MDEV-27993 Assertion failed in btr_page_reorganize_low()
30+
#
31+
CREATE TABLE t1(a INT PRIMARY KEY, b INT UNIQUE) ENGINE=InnoDB;
32+
SET DEBUG_DBUG = '+d,do_page_reorganize';
33+
INSERT INTO t1 VALUES(0,0);
34+
DROP TABLE t1;

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,4 +53,12 @@ connection default;
5353

5454
drop table t1;
5555

56+
--echo #
57+
--echo # MDEV-27993 Assertion failed in btr_page_reorganize_low()
58+
--echo #
59+
CREATE TABLE t1(a INT PRIMARY KEY, b INT UNIQUE) ENGINE=InnoDB;
60+
SET DEBUG_DBUG = '+d,do_page_reorganize';
61+
INSERT INTO t1 VALUES(0,0);
62+
DROP TABLE t1;
63+
5664
--source include/wait_until_count_sessions.inc

storage/innobase/btr/btr0cur.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
Copyright (c) 1994, 2019, Oracle and/or its affiliates. All Rights Reserved.
44
Copyright (c) 2008, Google Inc.
55
Copyright (c) 2012, Facebook Inc.
6-
Copyright (c) 2015, 2021, MariaDB Corporation.
6+
Copyright (c) 2015, 2022, MariaDB Corporation.
77
88
Portions of this file contain modifications contributed and copyrighted by
99
Google, Inc. Those modifications are gratefully acknowledged and are described
@@ -3212,6 +3212,7 @@ btr_cur_optimistic_insert(
32123212
<< ib::hex(thr ? thr->graph->trx->id : 0)
32133213
<< ' ' << rec_printer(entry).str());
32143214
DBUG_EXECUTE_IF("do_page_reorganize",
3215+
if (n_recs)
32153216
btr_page_reorganize(page_cursor, index, mtr););
32163217

32173218
/* Now, try the insert */

0 commit comments

Comments
 (0)