summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2022-03-03 11:51:25 +0200
committerMarko Mäkelä <marko.makela@mariadb.com>2022-03-03 11:51:25 +0200
commita92f07f4bd450f7368a998ce63443dd66374262a (patch)
treed34b1991d02de1dbd64ff5b8e66972222a7d8e47
parent3fd79a04b69af46eddcdef947bef07b4c139ac75 (diff)
downloadmariadb-git-a92f07f4bd450f7368a998ce63443dd66374262a.tar.gz
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.
-rw-r--r--mysql-test/suite/innodb/r/page_reorganize.result7
-rw-r--r--mysql-test/suite/innodb/t/page_reorganize.test8
-rw-r--r--storage/innobase/btr/btr0cur.cc3
3 files changed, 17 insertions, 1 deletions
diff --git a/mysql-test/suite/innodb/r/page_reorganize.result b/mysql-test/suite/innodb/r/page_reorganize.result
index 1059fc78531..20e1600bd0d 100644
--- a/mysql-test/suite/innodb/r/page_reorganize.result
+++ b/mysql-test/suite/innodb/r/page_reorganize.result
@@ -25,3 +25,10 @@ f1
disconnect con1;
connection default;
drop table t1;
+#
+# MDEV-27993 Assertion failed in btr_page_reorganize_low()
+#
+CREATE TABLE t1(a INT PRIMARY KEY, b INT UNIQUE) ENGINE=InnoDB;
+SET DEBUG_DBUG = '+d,do_page_reorganize';
+INSERT INTO t1 VALUES(0,0);
+DROP TABLE t1;
diff --git a/mysql-test/suite/innodb/t/page_reorganize.test b/mysql-test/suite/innodb/t/page_reorganize.test
index 7408353976d..c4e0160cb6d 100644
--- a/mysql-test/suite/innodb/t/page_reorganize.test
+++ b/mysql-test/suite/innodb/t/page_reorganize.test
@@ -53,4 +53,12 @@ connection default;
drop table t1;
+--echo #
+--echo # MDEV-27993 Assertion failed in btr_page_reorganize_low()
+--echo #
+CREATE TABLE t1(a INT PRIMARY KEY, b INT UNIQUE) ENGINE=InnoDB;
+SET DEBUG_DBUG = '+d,do_page_reorganize';
+INSERT INTO t1 VALUES(0,0);
+DROP TABLE t1;
+
--source include/wait_until_count_sessions.inc
diff --git a/storage/innobase/btr/btr0cur.cc b/storage/innobase/btr/btr0cur.cc
index 8d0a34d07a1..195edb65e5a 100644
--- a/storage/innobase/btr/btr0cur.cc
+++ b/storage/innobase/btr/btr0cur.cc
@@ -3,7 +3,7 @@
Copyright (c) 1994, 2019, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2008, Google Inc.
Copyright (c) 2012, Facebook Inc.
-Copyright (c) 2015, 2021, MariaDB Corporation.
+Copyright (c) 2015, 2022, MariaDB Corporation.
Portions of this file contain modifications contributed and copyrighted by
Google, Inc. Those modifications are gratefully acknowledged and are described
@@ -3212,6 +3212,7 @@ fail_err:
<< ib::hex(thr ? thr->graph->trx->id : 0)
<< ' ' << rec_printer(entry).str());
DBUG_EXECUTE_IF("do_page_reorganize",
+ if (n_recs)
btr_page_reorganize(page_cursor, index, mtr););
/* Now, try the insert */