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 0b47c126e3 (MDEV-13542).
This commit is contained in:
Marko Mäkelä 2022-09-01 10:40:27 +03:00
parent 9203249987
commit 40aa94df35
3 changed files with 7 additions and 0 deletions

View file

@ -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;

View file

@ -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=;

View file

@ -4879,6 +4879,7 @@ corrupted:
loop:
if (!block) {
invalid_page:
mtr.commit();
func_exit:
mem_heap_free(heap);
return err;