Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
10.6
-
None
Description
The following patch tries to do extra checkpoint in fil_rename_tablespace(). This lead
to fail to write few tablespace file name during fil_names_clear().
diff --git a/storage/innobase/fil/fil0fil.cc b/storage/innobase/fil/fil0fil.cc
|
index 681cee32fd5..0b6e4764d98 100644
|
--- a/storage/innobase/fil/fil0fil.cc
|
+++ b/storage/innobase/fil/fil0fil.cc
|
@@ -1918,6 +1918,7 @@ fil_rename_tablespace(
|
ut_ad(strchr(new_file_name, '/'));
|
|
if (!recv_recovery_is_on()) {
|
+ log_make_checkpoint();
|
mysql_mutex_lock(&log_sys.mutex);
|
}
|
The following test case were failing in 10.6:
innodb.innodb-alter-tempfile
|
CURRENT_TEST: innodb.innodb-alter-tempfile
|
mysqltest: At line 45: query 'show create table t1' failed: ER_GET_ERRNO (1030): Got error 194 "Tablespace is missing for a table" from storage engine InnoDB
|
|
innodb.alter_crash 'innodb' w4 [ fail ]
|
Test ended at 2021-12-12 10:22:42
|
|
CURRENT_TEST: innodb.alter_crash
|
mysqltest: At line 125: query 'INSERT INTO t2 VALUES (5,6),(7,8)' failed: ER_GET_ERRNO (1030): Got error 194 "Tablespace is missing for a table" from storage engine InnoDB
|
|
innodb.instant_alter_crash 'innodb' w5 [ fail ]
|
Test ended at 2021-12-12 10:23:28
|
|
CURRENT_TEST: innodb.instant_alter_crash
|
mysqltest: At line 200: query 'SHOW CREATE TABLE t3' failed: ER_GET_ERRNO (1030): Got error 194 "Tablespace is missing for a table" from storage engine InnoDB
|
|
innodb.truncate_crash 'innodb' w4 [ fail ]
|
Test ended at 2021-12-12 10:24:16
|
|
CURRENT_TEST: innodb.truncate_crash
|
mysqltest: At line 21: query 'SELECT COUNT(*) FROM t1' failed: ER_GET_ERRNO (1030): Got error 194 "Tablespace is missing for a table" from storage engine InnoDB
|
|
Attachments
Issue Links
- blocks
-
MDEV-27836 Assertion `n_fields <= ulint(index->n_fields) + 1' failed
-
- Closed
-
- causes
-
MDEV-29440 InnoDB instant ALTER TABLE recovery wrongly uses READ COMMITTED isolation level instead of READ UNCOMMITTED
-
- Closed
-
- is caused by
-
MDEV-25506 Atomic DDL: .frm file is removed and orphan InnoDB tablespace is left behind upon crash recovery
-
- Closed
-
- relates to
-
MDEV-23721 Assertion ‘node->table->is_temporary() || lock_table_has_locks(node->table)’ failed in row_undo_ins
-
- Closed
-
-
MDEV-26954 Failed ALTER causes table corruption after recovery - Tablespace not found
-
- Closed
-
-
MDEV-27111 atomic.rename_table test case fails on bb-10.6-MDEV-27022 branch
-
- Closed
-
let datadir= `select @@datadir`;
--let $_server_id= `SELECT @@server_id`
--let $_expect_file_name=$MYSQLTEST_VARDIR/tmp/mysqld.$_server_id.expect
CREATE TABLE t1 (f1 INT NOT NULL, f2 INT NOT NULL) ENGINE=innodb;
SET debug_dbug='+d,innodb_alter_commit_crash_before_commit';
--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--error 2013
ALTER TABLE t1 ADD PRIMARY KEY (f2, f1);
--source include/start_mysqld.inc
show create table t1;
Before crashing:
================
InnoDB does the following:
1) create a table t1(table id is 18)
2) create a table #sql-alter-10b0-4.ibd(table id is 19) as part of alter operation
3) InnoDB renames t1.ibd to #sql-ib19.ibd
4) InnoDB renames #sql-alter-10b0-4.ibd to t1.ibd
5) InnoDB drops #sql-ib19.ibd
6) Kills the server before alter finishes.
Data directory has the following:
=================================
'#sql-alter-10b0-4.frm' '#sql-ib19.ibd' t1.frm t1.ibd
InnoDB sys tables
===================
2 entries for table id (18). one is test/t1, other is #sql-ibd19.ibd
Both entries are deleted.
2 entries for table id (19). one is #sql-alter-10b0-4.ibd, other is test/t1.
first one is deleted, 2nd one exist.
Recovery:
=========
InnoDB tries to load the table during trx_resurrect():
Undo log processing done by InnoDB:
InnoDB does removal of new entries in SYS_TABLES.
InnoDB does undo of rename operation (t1 to #sql-alter-10b0-4.ibd).
During opening of table, InnoDB fails to re-load the tablespace for #sql-alter-10b04.ibd
due to the following code in dict_load_tablespace():
/* The tablespace may already be open. */
table->space = fil_space_for_table_exists_in_mem(table->space_id,
table->flags);
if (table->space) {
return;
}
and it does rename successfully as well. Now the data directory has
'#sql-alter-10b0-4.frm' '#sql-ib19.ibd' t1.frm '#sql-alter-10b0-4.ibd'
InnoDB tries to undo the rename operation (#sql-ib19.ibd to t1)
and it leads to skipping the rename operation. Now, InnoDB doesn't have table t1.