Bug #114349 fail to run clone command on mysql8.0.31
Submitted: 14 Mar 2024 12:11 Modified: 15 Mar 2024 6:34
Reporter: Liang Cheng Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server: Clone Plugin Severity:S3 (Non-critical)
Version:8.0.31 OS:Any
Assigned to: MySQL Verification Team CPU Architecture:Any

[14 Mar 2024 12:11] Liang Cheng
Description:
Hi, 
   Firstly, the internal clone can work in the cluster. I.e. If I manually purge binary logs from primary and then start slave later, I can see slave can recovery by clone internally. Everything looks ok.
   However, I want to try clone command manually, so that I can recover or copy new instance later if I needed. I tried following case. 
   Setup one innodb cluster, one run as primary and another run as slave, make sure two nodes can work well as cluster.
   1. First, I create the one account named 'clone_user' for clone 
mysql> show grants for clone_user;
+-----------------------------------------------------------+
| Grants for clone_user@%                                   |
+-----------------------------------------------------------+
| GRANT USAGE ON *.* TO `clone_user`@`%`                    |
| GRANT BACKUP_ADMIN,CLONE_ADMIN ON *.* TO `clone_user`@`%` |
+-----------------------------------------------------------+
    2. While group_replication is running on slave, I run clone command. It failed 
mysql> clone instance from clone_user@10.50.10.249:3308 identified by '***';
ERROR 3875 (HY000): The clone operation cannot be executed when Group Replication is running.

   3. So I stop group_replication and reset slave 
     mysql> stop group_replication;
     Query OK, 0 rows affected (4.08 sec)

     mysql> reset slave;
     Query OK, 0 rows affected, 1 warning (0.03 sec)
   4. Run clone again, it fails again because the slave is on super-read-only mode

    mysql> clone instance from clone_user@10.50.10.249:3308 identified by '***';
ERROR 1290 (HY000): The MySQL server is running with the --super-read-only option so it cannot execute this statement

   Please help if you have any idea. Thank you very much

How to repeat:
1. setup one innodb cluter first, and make it can work
2. On primary db, run as root, create one user account, clone_user,  and grant both BACKUP_ADMIN and CLONE_ADMIN to it. Verify the permission
mysql> show grants for clone_user;
+-----------------------------------------------------------+
| Grants for clone_user@%                                   |
+-----------------------------------------------------------+
| GRANT USAGE ON *.* TO `clone_user`@`%`                    |
| GRANT BACKUP_ADMIN,CLONE_ADMIN ON *.* TO `clone_user`@`%` |
+-----------------------------------------------------------+
   3. On slave, set clone_valid_donor_list to primary ip:port
mysql>  set global clone_valid_donor_list='10.50.10.249:3308';
Query OK, 0 rows affected (0.00 sec)

   4. On slave, stop group_replication and reset slave first
     mysql> stop group_replication;
     Query OK, 0 rows affected (4.08 sec)
     mysql> reset slave;
     Query OK, 0 rows affected, 1 warning (0.03 sec)
   4. On slave, login as clone_user, and run clone command
    mysql> clone instance from clone_user@10.50.10.249:3308 identified by '***';
ERROR 1290 (HY000): The MySQL server is running with the --super-read-only option so it cannot execute this statement
[14 Mar 2024 12:23] Liang Cheng
The purpose to test clone command manually is that we want to control which donor the recipient can pick up. On our production environment, sometimes one MySQL instance is disconnected from cluster because of networking or other issue. To recover this slave, we perfor to cloning from another slave server instead of primary db, although I don't know if MySQL8 server itself would select slave db first. The benefit of this behavior we can imagine is that the clone process will not impact the primary db, so that the system performance is supposed not to be impacted during the clone/recovery process
[15 Mar 2024 6:34] Liang Cheng
After run following sql, I can run clone sql on slave now
set global read_only=0;