Bug #103147 tablespace id is missing for innodb_undo_001
Submitted: 30 Mar 2021 6:04 Modified: 31 Mar 2021 12:29
Reporter: dbcore woqu Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server: Errors Severity:S3 (Non-critical)
Version:8.0.19 OS:CentOS (Linux release 7.5.1804 (Core) )
Assigned to: CPU Architecture:x86 (x86_64)

[30 Mar 2021 6:04] dbcore woqu
Description:
When the database is being backed up, it happens to encounter the truncate of the undo tablespace, which will cause an exception

My program can get the correct result by running the query " SELECT * FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME LIKE '%undo%'; ", but it will report an error when running the query " SELECT FILE_ID, tablespace_name, file_name from information_schema.files where file_name like '%undo%'; ".And an error will be reported in the error log [InnoDB] trying to access missing tablespace 423280320.

root@localhost : (none) 11:50:19> SELECT * FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME LIKE '%undo%';
+------------+-----------------+------+------------+-----------+---------------+------------+---------------+-----------+----------------+----------------+---------------+------------+--------+
| SPACE      | NAME            | FLAG | ROW_FORMAT | PAGE_SIZE | ZIP_PAGE_SIZE | SPACE_TYPE | FS_BLOCK_SIZE | FILE_SIZE | ALLOCATED_SIZE | SERVER_VERSION | SPACE_VERSION | ENCRYPTION | STATE  |
+------------+-----------------+------+------------+-----------+---------------+------------+---------------+-----------+----------------+----------------+---------------+------------+--------+
| 4294966390 | innodb_undo_001 |    0 | Undo       |     16384 |             0 | Undo       |             0 |         0 |              0 | 8.0.19         |             1 | N          | active |
| 4294966262 | innodb_undo_002 |    0 | Undo       |     16384 |             0 | Undo       |             0 |         0 |              0 | 8.0.19         |             1 | N          | active |
+------------+-----------------+------+------------+-----------+---------------+------------+---------------+-----------+----------------+----------------+---------------+------------+--------+
2 rows in set (0.02 sec)

root@localhost : (none) 11:50:27> SELECT FILE_ID, tablespace_name, file_name from information_schema.files where file_name like '%undo%';
+---------+-----------------+-----------------------------------+
| FILE_ID | TABLESPACE_NAME | FILE_NAME                         |
+---------+-----------------+-----------------------------------+
|    NULL | innodb_undo_001 | /var/lib/mysql/data/undo/undo_001 |
|    NULL | innodb_undo_002 | /var/lib/mysql/data/undo/undo_002 |
+---------+-----------------+-----------------------------------+
2 rows in set, 2 warnings (0.01 sec)

Warning (Code 1812): Tablespace is missing for table innodb_undo_001.
Warning (Code 1812): Tablespace is missing for table innodb_undo_002.

error.logļ¼š
   2021-03-30T11:50:58.507146+08:00 8 [Warning] [MY-012111] [InnoDB] Trying to access missing tablespace 4294966390
   2021-03-30T11:50:58.507391+08:00 8 [Warning] [MY-012111] [InnoDB] Trying to access missing tablespace 4294966262

How to repeat:
When MySQL 8.0.19 uses xtrabackup to back up, it occasionally reports an error " Cannot recover a truncated undo tablespace in read-only mode ".

At this time, MySQL query information_schema.file will cause the above error
[31 Mar 2021 12:29] MySQL Verification Team
Hi Mr. db,

Thank you for your bug report.

However, it is not a bug.

First of all, you are reporting a bug on a very old release.

Second and MUCH more important, you are reporting a bug in the products that we do not make nor do we support them.

Not a bug.
[31 Mar 2022 12:05] MySQL Verification Team
The backup tool reported is not our product.
[4 Apr 2022 10:31] Alexandr Ivanov
It is not a problem of backup tool when MySQL server loses its undo files. Undo files are physically present in file system, but in database metadata they do not have file_id, although they are listed. Do you think it's normal that there is no file_id in the file table?
[4 Apr 2022 12:14] MySQL Verification Team
Hi,

You are using an old release of 8.0, while the problem you described is fixed in the latest release.

Not a bug.