Bug #104573 tablespace is missing for table innodb_undo_002
Submitted: 9 Aug 2021 12:44 Modified: 20 Jan 2022 3:17
Reporter: dbcore woqu Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: InnoDB storage engine Severity:S2 (Serious)
Version:8.0.19 8.0.26 OS:Any (centos8, ubuntu20.04, docker)
Assigned to: CPU Architecture:Any (x86)

[9 Aug 2021 12:44] dbcore woqu
Description:
ON MySQL innodb cluster,One master and one standby instance,and set super_read_only = 1 on the standby machine.
When the standby machine triggers undo truncate, it always fails when updating dd。
And this problem occurs on multiple platforms,such as centos7,centos8,ubuntu20.04.docker。

select  FILE_ID, tablespace_name, file_name from information_schema.files where file_name like "%undo%";
result:
[Warning] [MY-012111] [InnoDB] Trying to access missing tablespace 4294967278

and The trunc.log left in the environment affects the normal use of the xtrabackup.

How to repeat:
# In a primary and one standby instance, if we set the standby database to super_read_only = 1, 
# then the standby database will fail to update DD when truncate occurs.
# As a result, we will execute the SQL :
#       "select  FILE_ID, tablespace_name, file_name from information_schema.files where file_name like "%undo%";"
# will appear "Tablespace is missing for table innodb_undo_002."
# and leave over trunc.log

--source include/master-slave.inc

--echo # 1: set slave parament
connection slave;
set global innodb_max_undo_log_size=11534336; 	
set global innodb_purge_rseg_truncate_frequency=1;	
set global super_read_only=1; 

--echo 
--echo # 2: Create database and insert data
connection master;
CREATE TABLE t (a INT);

BEGIN;
--echo let i=200000
--echo while (i)
--echo {
--echo INSERT INTO t(a) VALUES(1);
--echo dec i;
--echo }

--disable_query_log
--let $i=200000
while ($i)
{
    INSERT INTO t(a) VALUES(1);
    dec $i; 
}
--enable_query_log

commit;

--echo
--echo # 3: sync_slave_sql_with_master
--source include/sync_slave_sql_with_master.inc

--echo # 4: Verify that the truncation is successful. if failed, it will be undo missing tablespaces and Legacy trunc.log
connection slave;
--echo 
--echo trunc.log dir
--exec find $MYSQLTEST_VARDIR/ -name *trunc.log

--echo 
--echo undo tablespace missing
select  FILE_ID, tablespace_name, file_name from information_schema.files where file_name like "%undo%";

--echo 
connection master;
drop table t;
--source include/rpl_end.inc
[10 Aug 2021 11:16] dbcore woqu
change category
[16 Aug 2021 11:37] MySQL Verification Team
Hi,

Thanks for the report and the test case!

all best
Bogdan
[20 Jan 2022 2:56] zhijun long
Hi, does this bug have OS requirements? I have encountered the problem of undo_1_trunc.log residue at mysql-8.0.26, but there is no way to reproduce it stably. Referring to the above mtr case, I cannot reproduce it.
[20 Jan 2022 3:17] dbcore woqu
what's you environment.
We have verified on centos.
[20 Jan 2022 7:03] zhijun long
Environment:
centOS Linux release 7.9.2009 (Core); CPU Architecture:x86

I tried the debug and release versions, but it didn't reproduce.