Description:
The command "SHOW SLAVE HOSTS" can display a wrong Slave_UUID after a slave has disconnected.
How to repeat:
1. Start the master (server_id=10)
2. Start a first slave (server_id=11)
3. Execute "SHOW SLAVE HOSTS" on the master. I.E.:
+-----------+-------+------+-----------+--------------------------------------+
| Server_id | Host | Port | Master_id | Slave_UUID |
+-----------+-------+------+-----------+--------------------------------------+
| 11 | flyos | 0 | 10 | 11111111-dd07-4109-bf79-925fdbc50000 |
+-----------+-------+------+-----------+--------------------------------------+
4. Stop the first slave. "SHOW SLAVE HOSTS" now display something like:
+-----------+-------+------+-----------+------------+
| Server_id | Host | Port | Master_id | Slave_UUID |
+-----------+-------+------+-----------+------------+
| 11 | flyos | 0 | 10 | |
+-----------+-------+------+-----------+------------+
5. Start a second slave (server_id=12)
6. Execute "SHOW SLAVE HOSTS" on the master. I.E.:
+-----------+-------+------+-----------+--------------------------------------+
| Server_id | Host | Port | Master_id | Slave_UUID |
+-----------+-------+------+-----------+--------------------------------------+
| 11 | flyos | 0 | 10 | 00000000-dd07-4109-bf79-925fdbc50000 |
| 12 | flyos | 0 | 10 | 00000000-dd07-4109-bf79-925fdbc50000 |
+-----------+-------+------+-----------+--------------------------------------+
Note that the first and second slave are both displayed with the UUID of the second slave.
7. Stop the second slave
8. Start the first slave again.
9. Execute "SHOW SLAVE HOSTS" on the master. I.E:
+-----------+-------+------+-----------+--------------------------------------+
| Server_id | Host | Port | Master_id | Slave_UUID |
+-----------+-------+------+-----------+--------------------------------------+
| 11 | flyos | 0 | 10 | 11111111-dd07-4109-bf79-925fdbc50000 |
| 12 | flyos | 0 | 10 | 11111111-dd07-4109-bf79-925fdbc50000 |
+-----------+-------+------+-----------+--------------------------------------+
Now both slaves are displayed with the UUID of the first slave.
Suggested fix:
rpl_master.cc: remove the THD in slave_list when a slave disconnects.