Bug #97060 dba.createCluster('myCluster', {adoptFromGR: true}) failed

Submitted: 30 Sep 2019 4:58 Modified: 30 Sep 2019 10:37
Reporter: chen chen (OCA) Email Updates:
Status: Verified Impact on me:
None 
Category:Shell AdminAPI InnoDB Cluster / ReplicaSet Severity:S2 (Serious)
Version:8.0.17 OS:CentOS (7.3)
Assigned to: CPU Architecture:x86

[30 Sep 2019 4:58] chen chen
Description:
Proceed as follows:

mysql-js> var cluster = dba.createCluster('myCluster', {adoptFromGR: true});
A new InnoDB cluster will be created based on the existing replication group on instance '127.0.0.1:3306'.

Creating InnoDB cluster 'myCluster' on '127.0.0.1:3306'...

Adding Seed Instance...
Adding Instance '192.168.244.10.:3306'...
Dba.createCluster: The table does not comply with the requirements by an external plugin. (MySQL Error 3098)

then i checked the mysqlsh debug log

2019-09-30 03:27:49: Info: Adopting member 192.168.244.10.:3306 from existing group
2019-09-30 03:27:49: Debug: Adding instance to metadata
2019-09-30 03:27:49: Debug: Connecting to '192.168.244.10.:3306' to query for metadata information...
2019-09-30 03:27:49: Debug: DBA: execute_sql('SELECT host_id, host_name, ip_address FROM mysql_innodb_cluster_metadata.hosts WHERE host_name = '192.168.244.10.' OR (ip_address <> '' AND ip_
address = '')')2019-09-30 03:27:49: Debug: DBA: execute_sql('INSERT INTO mysql_innodb_cluster_metadata.hosts (host_name, ip_address, location) VALUES ('192.168.244.10.', '', '')')
2019-09-30 03:27:49: Debug: DBA: execute_sql('INSERT INTO mysql_innodb_cluster_metadata.instances (host_id, replicaset_id, mysql_server_uuid, instance_name, role, addresses, attributes) VAL
UES (1, 1, '1c0b5286-b659-11e9-9082-000c29f66609', '192.168.244.10.:3306', 'HA', json_object('mysqlClassic', '192.168.244.10.:3306', 'mysqlX', '192.168.244.10.:33060', 'grLocal', '10.101.34.92:33061'), '{}')')2019-09-30 03:27:49: Debug: MySQL Error-3098 (HY000): The table does not comply with the requirements by an external plugin.

2019-09-30 03:27:49: Debug: Dba.createCluster: The table does not comply with the requirements by an external plugin. (MySQL Error 3098)

It seemed the insert failed.

then i repeated this insert in Group Replicaiton, it still failed

mysql> INSERT INTO mysql_innodb_cluster_metadata.instances (host_id, replicaset_id, mysql_server_uuid, instance_name, role, addresses, attributes) VALUES (1, 1, '1c0b5286-b659-11e9-9082-000
c29f66609', '192.168.244.10.:3306', 'HA', json_object('mysqlClassic', '192.168.244.10.:3306', 'mysqlX', '192.168.244.10.:33060', 'grLocal', '10.101.34.92:33061'), '{}');ERROR 3098 (HY000): The table does not comply with the requirements by an external plugin.

It seems Foreign Keys with Cascading Constraints is not allowed in  multi-primary mode when group_replication_enforce_update_everywhere_checks is on.

mysql> show create table mysql_innodb_cluster_metadata.instances\G
*************************** 1. row ***************************
       Table: instances
Create Table: CREATE TABLE `instances` (
  `instance_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `host_id` int(10) unsigned NOT NULL,
  `replicaset_id` int(10) unsigned DEFAULT NULL,
  `mysql_server_uuid` varchar(40) NOT NULL,
  `instance_name` varchar(256) NOT NULL,
  `role` enum('HA','readScaleOut') NOT NULL,
  `weight` float DEFAULT NULL,
  `addresses` json NOT NULL,
  `attributes` json DEFAULT NULL,
  `version_token` int(10) unsigned DEFAULT NULL,
  `description` text,
  PRIMARY KEY (`instance_id`),
  UNIQUE KEY `mysql_server_uuid` (`mysql_server_uuid`),
  UNIQUE KEY `instance_name` (`instance_name`),
  KEY `host_id` (`host_id`),
  KEY `replicaset_id` (`replicaset_id`),
  CONSTRAINT `instances_ibfk_1` FOREIGN KEY (`host_id`) REFERENCES `hosts` (`host_id`) ON DELETE RESTRICT,
  CONSTRAINT `instances_ibfk_2` FOREIGN KEY (`replicaset_id`) REFERENCES `replicasets` (`replicaset_id`) ON DELETE SET NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
1 row in set (0.01 sec)

mysql> select * from performance_schema.replication_group_members;
+---------------------------+--------------------------------------+-----------------+-------------+--------------+-------------+----------------+
| CHANNEL_NAME              | MEMBER_ID                            | MEMBER_HOST     | MEMBER_PORT | MEMBER_STATE | MEMBER_ROLE | MEMBER_VERSION |
+---------------------------+--------------------------------------+-----------------+-------------+--------------+-------------+----------------+
| group_replication_applier | 1c0b5286-b659-11e9-9082-000c29f66609 | 192.168.244.10. |        3306 | ONLINE       | PRIMARY     | 8.0.17         |
| group_replication_applier | 404df93e-b659-11e9-9d75-000c297b8a24 | 192.168.244.20. |        3306 | ONLINE       | PRIMARY     | 8.0.17         |
| group_replication_applier | b8fe3d17-b658-11e9-9cdf-000c2901d210 | 192.168.244.30. |        3306 | ONLINE       | PRIMARY     | 8.0.17         |
+---------------------------+--------------------------------------+-----------------+-------------+--------------+-------------+----------------+
3 rows in set (0.00 sec)

mysql> show variables like '%group_replication_enforce_update_everywhere_checks%';
+----------------------------------------------------+-------+
| Variable_name                                      | Value |
+----------------------------------------------------+-------+
| group_replication_enforce_update_everywhere_checks | ON    |
+----------------------------------------------------+-------+
1 row in set (0.00 sec)

How to repeat:
as the above shows
[30 Sep 2019 10:37] MySQL Verification Team
Hello Chen,

Thank you for the report.

regards,
Umesh

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.049 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.