Comment 3 for bug 2048789

Revision history for this message
Alex Kavanagh (ajkavanagh) wrote :

So the bug output is this:

unit-keystone-mysql-router-1: 16:16:00 WARNING unit.keystone-mysql-router/1.upgrade-charm self._action(*args)
unit-keystone-mysql-router-1: 16:16:00 WARNING unit.keystone-mysql-router/1.upgrade-charm TypeError: db_router_request() missing 1 required positional argument: 'db_router'

and the (joint) code in question is:

@reactive.when('charm.installed')
@reactive.when('db-router.connected')
def db_router_request(db_router):
    """Send DB Router request to MySQL InnoDB Cluster.

    Using the db-router interface send connection request.

    :param db_router: DB-Router interface
    :type db_router_interface: MySQLRouterRequires object
    """

So, basically, charms.reactive is calling db_router_request() without the db_router arg which is supposed to come from "@reactive.when('db-router.connected')"

So it looks like a bug in charms.reactive.

Typically, 'easy' fixes are to do:

@reactive.when('charm.installed')
@reactive.when('db-router.connected')
def db_router_request():
    db_router = reactive.relations.endpoint_from_flag('db-router.connected')
    if not db_router:
        return
    with charm.provide_charm_instance() as instance:

As to why it is doing this; I guess we'd need to look at charms.reactive. It could be due to either a race in the interface (https://github.com/juju-solutions/charms.reactive/issues/231#issuecomment-775325418) or something not quite right during the upgrade in the sqlite db: https://github.com/juju-solutions/charms.reactive/issues/221

Either way, it looks like the current pattern in the code isn't robust enough to work around the issue in charms.openstack.

Note: charms.reactive is unlikely to be updated, particularly when we can work around it.

re:

> Alex, can you help me show me the latest commits of rev108 and rev111 in the https://opendev.org/openstack/charm-mysql-router/ repository? Or those two versions are coming from different branches during charm release?

So latest/edge is build from the "master" branch, whereas 8.0/stable is built from the stable/jammy branch.

But I don't think this error is due to the mysql-router code, per se, but rather something odd going on in charms.reactive when doing the juju switch.