Bug #120762 MySQL Shell 8.2+ cannot update Router option in cluster-set
Submitted: 24 Jun 15:00 Modified: 24 Jun 15:07
Reporter: Sinclert Pérez Email Updates:
Status: Verified Impact on me:
None 
Category:Shell AdminAPI InnoDB Cluster / ReplicaSet Severity:S3 (Non-critical)
Version:8.2+ OS:Any
Assigned to: CPU Architecture:Any
Tags: mysql-router, mysql-shell

[24 Jun 15:00] Sinclert Pérez
Description:
For MySQL Routers that belong to a MySQL Server cluster-set setup (using InnoDB), the MySQL Shell 8.2+ `cluster.setRoutingOption()` function introduced to tweak the `unreachable_quorum_allowed_traffic` Router setting, crash with "Router is not part of this topology" error.

The crash was noticed in a setup with:
- Three MySQL Server 8.4.8 instances cluster, belonging to a cluster-set.
- One MySQL Router 8.4.8 instance.
- One MySQL Shell 8.4.8 session.

However, we are relatively confident that this problem will be visible in all MySQL Router / Shell versions between 8.2.X and 8.4.X, probably even in 9.7.X.

---

In a MySQL Shell session:

```python
> cluster = dba.get_cluster()
> cluster.list_routers()

RuntimeError: Cluster.list_routers: Function not available for ClusterSet members

> cluster.set_routing_option('mysql-router-k8s-0.mysql-router-k8s-endpoints.testing.svc.cluster.local::system', 'unreachable_quorum_allowed_traffic', 'ALL')

ValueError: Cluster.set_routing_option: Router 'mysql-router-k8s-0.mysql-router-k8s-endpoints.testing.svc.cluster.local::system' is not part of this topology
```

```python
> cs = dba.get_cluster_set()
> cs.list_routers()

{
    "domainName": "cluster-set-56a15125e1b063355823e0c5845d4f80", 
    "routers": {
        "mysql-router-k8s-0.mysql-router-k8s-endpoints.testing.svc.cluster.local::system": {
            ...
        }
    }
}

> cs.set_routing_option('mysql-router-k8s-0.mysql-router-k8s-endpoints.testing.svc.cluster.local::system', 'unreachable_quorum_allowed_traffic', 'ALL')

ValueError: ClusterSet.set_routing_option: Unsupported routing option, 'unreachable_quorum_allowed_traffic' supported options: ...
```

How to repeat:
1. Deploy three MySQL Server 8.4.8 instance cluster.
2. Bootstrap a MySQL Server cluster-set.
3. Deploy one MySQL Router 8.4.8 instance.
4. Bootstrap the Router into the cluster-set.
5. Start a MySQL Shell 8.4.8 python shell
6. Issue the following commands:

```python
cluster = dba.get_cluster()
cluster.set_routing_option('<router-name>::system', 'unreachable_quorum_allowed_traffic', 'ALL')
```

Suggested fix:
According to Miguel Araújo, MySQL Shell should be able to tweak all Router settings at the cluster-set level as well. Therefore, the list of possible options that can be tweaked in the `ClusterSet.setRoutingOption()` needs to be expanded to account for the MySQL Router 8.2+ ones, namely `unreachable_quorum_allowed_traffic`.