Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Duplicate
-
10.6, 10.7(EOL)
-
None
Description
--source include/have_innodb.inc
|
|
CREATE TABLE t (pk INT PRIMARY KEY) ENGINE=InnoDB; |
--error ER_ERROR_ON_RENAME
|
ALTER TABLE t ADD FOREIGN KEY (pk) REFERENCES t (pk); |
|
CHECK TABLE t; |
|
--let $shutdown_timeout= 0
|
--source include/restart_mysqld.inc
|
|
CHECK TABLE t; |
|
# Cleanup
|
DROP TABLE t; |
10.6 fdc4c3a2 |
ALTER TABLE t ADD FOREIGN KEY (pk) REFERENCES t (pk);
|
ERROR HY000: Error on rename of './test/#sql-alter-25dc40-4' to './test/t' (errno: 150 "Foreign key constraint is incorrectly formed")
|
CHECK TABLE t;
|
Table Op Msg_type Msg_text
|
test.t check status OK
|
# restart
|
CHECK TABLE t;
|
Table Op Msg_type Msg_text
|
test.t check Error Unknown storage engine 'InnoDB'
|
test.t check error Corrupt
|
DROP TABLE t;
|
bug.recovery2 'innodb' [ fail ] Found warnings/errors in server log file!
|
Test ended at 2021-11-02 01:18:32
|
line
|
2021-11-02 1:18:32 4 [ERROR] InnoDB: In ALTER TABLE `test`.`t` has or is referenced in foreign key constraints which are not compatible with the new table definition.
|
2021-11-02 1:18:32 0 [ERROR] InnoDB: Tablespace 5 was not found at ./test/t.ibd.
|
2021-11-02 1:18:32 0 [ERROR] InnoDB: Set innodb_force_recovery=1 to ignore this and to permanently lose all changes to the tablespace.
|
2021-11-02 1:18:32 0 [ERROR] InnoDB: Plugin initialization aborted at srv0start.cc[1447] with error Tablespace not found
|
2021-11-02 1:18:32 0 [ERROR] Plugin 'InnoDB' init function returned error.
|
2021-11-02 1:18:32 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
|
^ Found warnings in /mnt-hd8t/bld/10.6-debug-nightly/mysql-test/var/log/mysqld.1.err
|
So, after the failed ALTER the table still appears to be all right, but further crash recovery complains about a missing tablespace.
Reproducible on 10.6 (including 10.6.4), 10.7. Not reproducible on 10.5.
Reproducible every time for me, but since it's crash recovery imitated via MTR, it can well be non-deterministic.
Attachments
Issue Links
- is duplicated by
-
MDEV-27111 atomic.rename_table test case fails on bb-10.6-MDEV-27022 branch
-
- Closed
-
- relates to
-
MDEV-27234 InnoDB dictionary recovery wrongly uses READ UNCOMMITTED isolation level instead of READ COMMITTED
-
- Closed
-
UndoLog recovery test ends with a slightly different representation of the same problem.
The difference in the test flow is that after the induced "crash", the server is started with innodb_force_recovery=3, and then restarted normally.
In MTR terms, it is this (mind the "sleep", the test is for reproducing purposes only):
--source include/have_innodb.inc
--error ER_ERROR_ON_RENAME
--let $shutdown_timeout= 0
--let $restart_parameters= --innodb-force-recovery=3
--source include/restart_mysqld.inc
--sleep 5
--let $shutdown_timeout= 30
--let $restart_parameters= --innodb-force-recovery=0
--source include/restart_mysqld.inc
# Cleanup
So, the restart with force-recovery complains
bb-10.6-release 109fc67d4d
2021-11-06 14:43:09 0 [Note] InnoDB: Starting crash recovery from checkpoint LSN=43379,43379
2021-11-06 14:43:09 0 [Note] InnoDB: At LSN: 45922: unable to open file ./test/#sql-alter-136fdf-4.ibd for tablespace 6
2021-11-06 14:43:09 0 [Note] InnoDB: At LSN: 47831: unable to open file ./test/#sql-backup-136fdf-4.ibd for tablespace 5
2021-11-06 14:43:09 0 [Note] InnoDB: At LSN: 51738: unable to open file ./test/#sql-backup-136fdf-4.ibd for tablespace 5
2021-11-06 14:43:09 0 [Warning] InnoDB: Tablespace 5 was not found at ./test/t.ibd, and innodb_force_recovery was set. All redo log for this tablespace will be ignored!
and then the following normal restart says
2021-11-06 14:43:15 3 [ERROR] InnoDB: Expected tablespace id 5 but found 0 in the file ./test/t.ibd
2021-11-06 14:43:15 3 [ERROR] InnoDB: Table `test`.`t` is corrupted. Please drop the table and recreate.