From 61e00db6ad5d74ca167267a954712a9c3973c518 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Mon, 22 Mar 2021 15:22:59 +0200 Subject: [PATCH] MDEV-24796 Assertion `page_has_next... failed in btr_pcur_store_position() In commit eaeb8ec4b87882711ecb8e1c7476a6e410d5d2a9 (MDEV-24653) an incorrect debug assertion was introduced. btr_pcur_store_position(): If the only record in the page is the instant ALTER TABLE metadata record, we cannot expect there to be a successor page. The situation could be improved by MDEV-24673 later. --- .../suite/innodb/r/instant_alter_debug.result | 14 ++++++++++++++ .../suite/innodb/t/instant_alter_debug.test | 16 ++++++++++++++++ storage/innobase/btr/btr0pcur.cc | 3 --- 3 files changed, 30 insertions(+), 3 deletions(-) diff --git a/mysql-test/suite/innodb/r/instant_alter_debug.result b/mysql-test/suite/innodb/r/instant_alter_debug.result index fb298a84efa..3b85be1ef1c 100644 --- a/mysql-test/suite/innodb/r/instant_alter_debug.result +++ b/mysql-test/suite/innodb/r/instant_alter_debug.result @@ -303,5 +303,19 @@ SELECT * FROM t1; a b c DROP TABLE t1; SET GLOBAL innodb_limit_optimistic_insert_debug = @saved_limit; +# +# MDEV-24796 Assertion page_has_next... failed +# in btr_pcur_store_position() +# +CREATE TABLE t1 (c INT KEY) ENGINE=InnoDB; +INSERT INTO t1 VALUES(1),(2); +SET GLOBAL innodb_limit_optimistic_insert_debug=2; +ALTER TABLE t1 ADD COLUMN d INT; +DELETE FROM t1; +InnoDB 0 transactions not purged +SELECT * FROM t1 WHERE c<>1 ORDER BY c DESC; +c d +DROP TABLE t1; +SET GLOBAL innodb_limit_optimistic_insert_debug = @saved_limit; # End of 10.3 tests SET GLOBAL innodb_purge_rseg_truncate_frequency = @save_frequency; diff --git a/mysql-test/suite/innodb/t/instant_alter_debug.test b/mysql-test/suite/innodb/t/instant_alter_debug.test index 3d3bb7d3e57..0431177a130 100644 --- a/mysql-test/suite/innodb/t/instant_alter_debug.test +++ b/mysql-test/suite/innodb/t/instant_alter_debug.test @@ -348,6 +348,22 @@ SELECT * FROM t1; DROP TABLE t1; SET GLOBAL innodb_limit_optimistic_insert_debug = @saved_limit; +--echo # +--echo # MDEV-24796 Assertion page_has_next... failed +--echo # in btr_pcur_store_position() +--echo # + +CREATE TABLE t1 (c INT KEY) ENGINE=InnoDB; +INSERT INTO t1 VALUES(1),(2); +SET GLOBAL innodb_limit_optimistic_insert_debug=2; +ALTER TABLE t1 ADD COLUMN d INT; +DELETE FROM t1; +--source include/wait_all_purged.inc +SELECT * FROM t1 WHERE c<>1 ORDER BY c DESC; +DROP TABLE t1; + +SET GLOBAL innodb_limit_optimistic_insert_debug = @saved_limit; + --echo # End of 10.3 tests SET GLOBAL innodb_purge_rseg_truncate_frequency = @save_frequency; diff --git a/storage/innobase/btr/btr0pcur.cc b/storage/innobase/btr/btr0pcur.cc index 8faa6c626ff..9c6189acbce 100644 --- a/storage/innobase/btr/btr0pcur.cc +++ b/storage/innobase/btr/btr0pcur.cc @@ -169,9 +169,6 @@ before_first: ut_ad(!page_has_prev(block->frame)); rec = page_rec_get_next(rec); if (page_rec_is_supremum(rec)) { - ut_ad(page_has_next(block->frame) - || block->page.id.page_no() - != index->page); goto before_first; } }