We got the same issue of missing primary keys running MySQL8 with group replication.
Back at the time when we migrated, we thought adding a UNIQUE-KEY constraint will solve the issue:
mysql> show create table changeset_parents
-> ;
+-------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Table | Create Table |
+-------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| changeset_parents | CREATE TABLE `changeset_parents` (
`changeset_id` int(11) NOT NULL,
`parent_id` int(11) NOT NULL,
KEY `changeset_parents_changeset_ids` (`changeset_id`),
KEY `changeset_parents_parent_ids` (`parent_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 |
+-------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0,00 sec)
mysql> ALTER TABLE changeset_parents ADD CONSTRAINT UNIQUE(changeset_id, parent_id);
ERROR 1062 (23000): Duplicate entry '89630-89615' for key 'changeset_id'
mysql> SELECT * FROM changeset_parents GROUP BY changeset_id, parent_id HAVING COUNT(*) > 1;
+--------------+-----------+
| changeset_id | parent_id |
+--------------+-----------+
| 89630 | 89615 |
+--------------+-----------+
1 row in set (0,05 sec)
mysql> DELETE FROM changeset_parents WHERE changeset_id=89630 AND parent_id=89615;
Query OK, 2 rows affected (0,07 sec)
mysql> INSERT INTO changeset_parents VALUES (89630, 89615);
Query OK, 1 row affected (0,00 sec)
mysql> ALTER TABLE changeset_parents ADD CONSTRAINT UNIQUE(changeset_id, parent_id);
Query OK, 0 rows affected (0,40 sec)
Records: 0 Duplicates: 0 Warnings: 0
Unfortunately not every repository obeys to this rule, so we now got stuck with one Git repository which is not updated within Redmine.