Bug #95010 custer.setOption("clusterName","myNewClusterName") breaks InnoDb Cluster
Submitted: 12 Apr 2019 15:41 Modified: 12 Apr 2019 17:22
Reporter: Pedro Pinheiro Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Router Severity:S2 (Serious)
Version:8.0.15 OS:Any
Assigned to: CPU Architecture:Any

[12 Apr 2019 15:41] Pedro Pinheiro
Description:
While performing a simple cluster rename, the InnoDB Cluster solution was broken.

In the application host we could not connect to InnoDB Cluster:
----
 mysqlsh -h localhost --port 6446  -u nRoot
Please provide the password for 'nRoot@localhost:6446': ***************
MySQL Shell 8.0.15-commercial
Creating a session to 'nRoot@localhost:6446'
ERROR: MySQL Error 2003 (HY000): Can't connect to remote MySQL server for client connected to '0.0.0.0:6446'
----

How to repeat:
using mysql shell

1 -\c root@127.0.0.1
2 - c=dba.getCluster()
3 -  c.setOption("clusterName","myNewClusterName")
----
  Successfully set the value of 'clusterName' to 'myNewClusterName' in the Cluster: 'DBCluster'.
----
4- Cant connect to cluster using 6446 port provided by mysql router

router error log:
-----
2019-04-12 15:47:57 metadata_cache ERROR [7fd52da37700] Failed fetching metadata from any of the 3 metadata servers.
2019-04-12 15:47:58 metadata_cache WARNING [7fd52da37700] No replicasets defined for cluster 'DBCluster'
2019-04-12 15:47:58 metadata_cache WARNING [7fd52da37700] Tried node ee16e5b4-57e3-11e9-96fb-005056b4f3fe on host 10.21.175.74, port 3306 as a metadata server, it does not contan metadata for replication group 494b2bb0-57e4-11e9-836a-005056b4f3fe
2019-04-12 15:47:58 metadata_cache WARNING [7fd52da37700] No replicasets defined for cluster 'DBCluster'
2019-04-12 15:47:58 metadata_cache WARNING [7fd52da37700] Tried node ece976cc-57e3-11e9-9351-005056b4d74f on host 10.21.175.75, port 3306 as a metadata server, it does not contan metadata for replication group 494b2bb0-57e4-11e9-836a-005056b4f3fe
2019-04-12 15:47:58 metadata_cache WARNING [7fd52da37700] No replicasets defined for cluster 'DBCluster'
2019-04-12 15:47:58 metadata_cache WARNING [7fd52da37700] Tried node ed9541e0-57e3-11e9-ba44-005056b491b4 on host 10.21.175.76, port 3306 as a metadata server, it does not contan metadata for replication group 494b2bb0-57e4-11e9-836a-005056b4f3fe

-----

Suggested fix:
Performing a custer.setOption("clusterName","myNewClusterName") should not break cluster functionality

As summary of the performed actions:
Scenario A
cluster rename->router error->cluster rename original name->router ok

Scenario B
cluster rename->router error->router restart>router error->cluster rename original name->router error

Scenario C
cluster rename->router error->router restart>router error->cluster rename original name->router error>router bootstrap>router error>router restart>router ok
[12 Apr 2019 15:48] Pedro Pinheiro
The bug https://bugs.mysql.com/bug.php?id=94057 covers some of this use case, but not all.

Does not make sense that a cluster rename involving a router bootstraping and restart in order to work.