Bug #97784 clone plugin misunderstanding UNDO table-space file name
Submitted: 26 Nov 2019 9:44 Modified: 9 Dec 2019 19:33
Reporter: Tsubasa Tanaka (OCA) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Clone Plugin Severity:S3 (Non-critical)
Version:8.0.18 OS:CentOS (7.6)
Assigned to: CPU Architecture:x86

[26 Nov 2019 9:44] Tsubasa Tanaka
Description:
CLONE INSTANCE fails "Can't open file ./undo001" by following steps.

1. Initialize datadir by 5.7 with --innodb-undo-tablespaces=2.
2. Upgrade 5.7 to 8.0
3. Start "CLONE INSTANCE" at fresh-install server to upgraded server.
4. "CLONE INSTANCE" fails.

UNDO table-space filename is changed "./undo_001" during upgrade, but clone plugin doesn't recognize it.

See "How to repeat" in detail.

Workaround is restarting mysqld after upgrade.

How to repeat:
### Setup 5.7 Server on SERVER1(Doner)

yum install -y https://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm
yum install -y --disablerepo="mysql80-community" --enablerepo="mysql57-community" mysql-community-server
echo -e "\n\n[mysqld]\nloose-innodb_undo_tablespaces=2" >> /etc/my.cnf
mysqld --initialize-insecure --user=mysql
systemctl start mysqld

### Confirm undo-tablespace name (there's no "_")

ls -l /var/lib/mysql/undo*
-rw-r----- 1 mysql mysql 10485760 Nov 26 09:33 /var/ilb/mysql/undo001
-rw-r----- 1 mysql mysql 10485760 Nov 26 09:33 /var/lib/mysql/undo002

### Upgrade to 8.0 and CREATE USER for CLONE on SERVER1

systemctl stop mysqld
yum update -y mysql-community-server
systemctl start mysqld
mysql -e "INSTALL PLUGIN clone SONAME 'mysql_clone.so';"
mysql -e "CREATE USER cloner;" -e "GRANT BACKUP_ADMIN ON *.* TO cloner;"

### Re-confirm undo-tablespace name (there IS "_" character)

ls -l /var/lib/mysql/undo*
-rw-r----- 1 mysql mysql 12582912 Nov 26 09:37 /var/lib/mysql/undo_001
-rw-r----- 1 mysql mysql 12582912 Nov 26 09:37 /var/lib/mysql/undo_002

### Setup 8.0 Server on SERVER2(Recipient)

yum install -y https://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm
yum install -y mysql-community-server
mysqld --initialize-insecure --user=mysql
systemctl start mysqld
mysql -e "INSTALL PLUGIN clone SONAME 'mysql_clone.so';"

### Start clone on SERVER2(Recipient) to SERVER1(Doner)

mysql> SET GLOBAL clone_valid_donor_list = '172.17.0.4:3306';
mysql> CLONE INSTANCE FROM cloner@172.17.0.3:3306 IDENTIFIED BY '';
ERROR 3862 (HY000): Clone Donor Error: 1016 : Can't open file: './undo001' (errno: 2 - No such file or directory).

### Restart mysqld on SERVER1 and CLONE get to be working.
systemctl restart mysqld # on SERVER1

mysql> CLONE INSTANCE FROM cloner@172.17.0.3:3306 IDENTIFIED BY ''; -- on SERVER2
Query OK, 0 rows affected (1.26 sec) -- SUCCESS
[28 Nov 2019 6:28] MySQL Verification Team
Hello Tanaka-San,

Thank you for the report and feedback.
Verified as described.

regards,
Umesh
[9 Dec 2019 19:33] Daniel Price
Posted by developer:
 
Fixed as of the upcoming 8.2.0  release, and here's the changelog entry:

After upgrading from MySQL 5.7 to MySQL 8.0 with an
innodb_undo_tablespaces=2 setting, a CLONE INSTANCE operation failed with
the following error: ERROR 3862 (HY000): Clone Donor Error: 1016 : Can't
open filc: './undo001'. The upgrade process left behind orphaned in-memory
undo tablespaces. 

Thanks to Satya Bodapati for the contribution.
[9 Dec 2019 19:40] Daniel Price
Posted by developer:
 
Changelog entry revised:

"After upgrading from MySQL 5.7 to MySQL 8.0, a CLONE INSTANCE operation
failed with the following error: ERROR 3862 (HY000): Clone Donor Error:
1016 : Can't open file: './undo001'. The upgrade process left behind
orphaned in-memory undo tablespaces. 

Thanks to Satya Bodapati for the contribution."
[18 Dec 2019 15:17] Daniel Price
Posted by developer:
 
Changelog entry moved to 8.0.19 release notes.