Bug #88452 No Check for duplicatio @@server_uuid when joining group
Submitted: 13 Nov 2017 1:15 Modified: 13 Dec 2017 15:40
Reporter: Jesper wisborg Krogh Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Group Replication Severity:S2 (Serious)
Version:5.7.19 OS:Any
Assigned to: CPU Architecture:Any

[13 Nov 2017 1:15] Jesper wisborg Krogh
Description:
When a node joins a Group Replication group, there is no check whether there is already a node with the same server uuid.

Reproduced in 5.7.19 and 5.7.20.

How to repeat:
1. Setup node 1:

gr1> SELECT MEMBER_ID, MEMBER_PORT, MEMBER_STATE FROM performance_schema.replication_group_members;
+--------------------------------------+-------------+--------------+
| MEMBER_ID                            | MEMBER_PORT | MEMBER_STATE |
+--------------------------------------+-------------+--------------+
| 8aae05e9-c80c-11e7-9c44-08002715584a |       33508 | ONLINE       |
+--------------------------------------+-------------+--------------+
1 row in set (0.00 sec)

2. Setup node 2 (using new UUID):

gr1> SELECT MEMBER_ID, MEMBER_PORT, MEMBER_STATE FROM performance_schema.replication_group_members;
+--------------------------------------+-------------+--------------+
| MEMBER_ID                            | MEMBER_PORT | MEMBER_STATE |
+--------------------------------------+-------------+--------------+
| 8aae05e9-c80c-11e7-9c44-08002715584a |        3306 | ONLINE       |
| a567acf2-c80c-11e7-9535-08002715584a |        3307 | ONLINE       |
+--------------------------------------+-------------+--------------+
2 rows in set (0.00 sec)

gr2> SELECT MEMBER_ID, MEMBER_PORT, MEMBER_STATE FROM performance_schema.replication_group_members;
+--------------------------------------+-------------+--------------+
| MEMBER_ID                            | MEMBER_PORT | MEMBER_STATE |
+--------------------------------------+-------------+--------------+
| 8aae05e9-c80c-11e7-9c44-08002715584a |        3306 | ONLINE       |
| a567acf2-c80c-11e7-9535-08002715584a |        3307 | ONLINE       |
+--------------------------------------+-------------+--------------+
2 rows in set (0.00 sec)

3. Install node 3 using a copy of the datadir from node 1 (including the same auto.cnf file), and enable Group Replication.
4. Node 3 joins without errors, but the nodes do not have the same view of which of the nodes are part of the group. Nodes 1 and 2 will have the same content of performance_schema.replication_group_members as before, but node 3 has:

gr3> SELECT MEMBER_ID, MEMBER_PORT, MEMBER_STATE FROM performance_schema.replication_group_members;
+--------------------------------------+-------------+--------------+
| MEMBER_ID                            | MEMBER_PORT | MEMBER_STATE |
+--------------------------------------+-------------+--------------+
| 8aae05e9-c80c-11e7-9c44-08002715584a |        3308 | ONLINE       |
| a567acf2-c80c-11e7-9535-08002715584a |        3307 | ONLINE       |
+--------------------------------------+-------------+--------------+
2 rows in set (0.00 sec)

Suggested fix:
Fail with an error, when a node attempts to connect to a group where there is already a member with the server @@server_uuid as itself.
[13 Nov 2017 1:19] Jesper wisborg Krogh
Posted by developer:
 
Result of START GROUP_REPLICATION:

Node 1:
-------
gr1> SET GLOBAL group_replication_bootstrap_group = ON;
Query OK, 0 rows affected (0.00 sec)

gr1> START GROUP_REPLICATION;
Query OK, 0 rows affected (2.07 sec)

gr1)> SET GLOBAL group_replication_bootstrap_group = OFF;
Query OK, 0 rows affected (0.00 sec)

Node 2:
-------
gr2> START GROUP_REPLICATION;
Query OK, 0 rows affected (6.57 sec)

Node 3:
-------
(Has the duplicate UUID)

gr3> START GROUP_REPLICATION;
Query OK, 0 rows affected (3.16 sec)
[13 Dec 2017 15:40] David Moss
Posted by developer:
 
Thank you for your feedback, this has been fixed in upcoming versions and the following was added to the 5.7.21 / 8.0.4 change logs:
All servers that belong to a group must have unique UUIDs set by server_uuid, but this was not being enforced by Group Replication and it was possible to add members with duplicated UUIDs.
[1 Feb 2018 14:03] David Moss
Now published.