Bug #119312 `start replica` command adds an invalid record to mysql.slave_master_info
Submitted: 5 Nov 17:30
Reporter: Aaditya Dubey Email Updates:
Status: Open Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:8.4.x OS:Any
Assigned to: CPU Architecture:Any

[5 Nov 17:30] Aaditya Dubey
Description:
If no threads are configured, the following behaviour happens. The error is the expected behaviour, but it should not write a record in mysql.slave_master_info

How to repeat:
Set up 8.4 classic replication and run the following set of queries on the replica.

mysql> select @@version;
+-----------+
| @@version |
+-----------+
| 8.4.5-5   |
+-----------+
1 row in set (0.00 sec)

mysql> reset replica all;
Query OK, 0 rows affected (0.01 sec)

mysql> select * from slave_master_info\G
Empty set (0.00 sec)

mysql> start replica;
ERROR 1200 (HY000): The server is not configured as replica; fix in config file or with CHANGE REPLICATION SOURCE TO
mysql> select * from slave_master_info\G
*************************** 1. row ***************************
                Number_of_lines: 33
                Master_log_name:
                 Master_log_pos: 4
                           Host:
                      User_name:
                  User_password:
                           Port: 3306
                  Connect_retry: 60
                    Enabled_ssl: 0
                         Ssl_ca:
                     Ssl_capath:
                       Ssl_cert:
                     Ssl_cipher:
                        Ssl_key:
         Ssl_verify_server_cert: 0
                      Heartbeat: 0
                           Bind:
             Ignored_server_ids: 0
                           Uuid:
                    Retry_count: 10
                        Ssl_crl:
                    Ssl_crlpath:
          Enabled_auto_position: 0
                   Channel_name:
                    Tls_version:
                Public_key_path:
                 Get_public_key: 0
              Network_namespace:
   Master_compression_algorithm: uncompressed
  Master_zstd_compression_level: 3
               Tls_ciphersuites: NULL
Source_connection_auto_failover: 0
                      Gtid_only: 0
1 row in set (0.00 sec)

Suggested fix:
It should not log any entry to mysql.slave_master_info when it fails.