summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2022-09-01 10:40:27 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2022-09-01 10:40:27 +0300
commit40aa94df356cfa000fc43c92ff0061212d1b161d (patch)
tree96f848db516330534b89da4e9265c927dc83e2a3
parent92032499874259bae7455130958ea7f38c4d53a3 (diff)
downloadmariadb-git-40aa94df356cfa000fc43c92ff0061212d1b161d.tar.gz
MDEV-29435 CHECK TABLE forgets to release latches after reporting failure
btr_validate_level(): Invoke mtr.commit() after a failure. This omission was introduced in commit 0b47c126e31cddda1e94588799599e138400bcf8 (MDEV-13542).
-rw-r--r--mysql-test/suite/innodb/r/leaf_page_corrupted_during_recovery.result4
-rw-r--r--mysql-test/suite/innodb/t/leaf_page_corrupted_during_recovery.test2
-rw-r--r--storage/innobase/btr/btr0btr.cc1
3 files changed, 7 insertions, 0 deletions
diff --git a/mysql-test/suite/innodb/r/leaf_page_corrupted_during_recovery.result b/mysql-test/suite/innodb/r/leaf_page_corrupted_during_recovery.result
index 37ddb0a9348..ca010d663fa 100644
--- a/mysql-test/suite/innodb/r/leaf_page_corrupted_during_recovery.result
+++ b/mysql-test/suite/innodb/r/leaf_page_corrupted_during_recovery.result
@@ -17,4 +17,8 @@ pk c
1 sql
SELECT * FROM t1 WHERE pk = 12;
ERROR HY000: Index for table 't1' is corrupt; try to repair it
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check Warning InnoDB: The B-tree of index PRIMARY is corrupted.
+test.t1 check error Corrupt
DROP TABLE t1;
diff --git a/mysql-test/suite/innodb/t/leaf_page_corrupted_during_recovery.test b/mysql-test/suite/innodb/t/leaf_page_corrupted_during_recovery.test
index d28712fec5c..ddf0090c9e2 100644
--- a/mysql-test/suite/innodb/t/leaf_page_corrupted_during_recovery.test
+++ b/mysql-test/suite/innodb/t/leaf_page_corrupted_during_recovery.test
@@ -11,6 +11,7 @@ call mtr.add_suppression("\\[ERROR\\] InnoDB: We detected index corruption");
call mtr.add_suppression("\\[ERROR\\] (mysqld|mariadbd).*: Index for table 't1' is corrupt; try to repair it");
call mtr.add_suppression("InnoDB: btr_pcur_open_low level: 0 table: `test`\\.`t1` index: `PRIMARY`");
call mtr.add_suppression("InnoDB: File '.*test/t1\\.ibd' is corrupted");
+call mtr.add_suppression("InnoDB: In page .* of index `PRIMARY` of table `test`\\.`t1`");
--enable_query_log
CREATE TABLE t1 (pk INT PRIMARY KEY, c CHAR(255))ENGINE=InnoDB STATS_PERSISTENT=0;
@@ -54,6 +55,7 @@ let $restart_parameters=--innodb-force-recovery=2;
SELECT * FROM t1 WHERE PK = 1;
--error ER_NOT_KEYFILE
SELECT * FROM t1 WHERE pk = 12;
+CHECK TABLE t1;
DROP TABLE t1;
let $restart_parameters=;
diff --git a/storage/innobase/btr/btr0btr.cc b/storage/innobase/btr/btr0btr.cc
index 772ac99a5d5..3e48955e85a 100644
--- a/storage/innobase/btr/btr0btr.cc
+++ b/storage/innobase/btr/btr0btr.cc
@@ -4879,6 +4879,7 @@ corrupted:
loop:
if (!block) {
invalid_page:
+ mtr.commit();
func_exit:
mem_heap_free(heap);
return err;