Changes in flags need a update-status for later actions
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
MySQL InnoDB Cluster Charm |
Fix Committed
|
High
|
Unassigned |
Bug Description
When running actions such as remove-instance with force=true, the following flags are removed for the specified instance address:
cluster-
cluster-
Then, if an action such as add-instance is run for same instance, the charm code does not recognize the updated flags, as can be seen in the logs:
2023-05-29 14:34:07 INFO unit.mysql/
2023-05-29 14:34:09 WARNING unit.mysql/
2023-05-29 14:34:11 WARNING unit.mysql/
2023-05-29 14:34:11 WARNING unit.mysql/
2023-05-29 14:34:11 WARNING unit.mysql/
Even if the action is repeated multiple times, the result seen in the above logs is the same, despite the flags not existing anymore in leader-get.
Later, whenever an update-status hook runs (or is manually run using juju run -u mysql/leader -- ./hooks/
2023-05-29 14:34:55 INFO unit.mysql/
2023-05-29 14:34:57 WARNING unit.mysql/
2023-05-29 14:34:59 WARNING unit.mysql/
2023-05-29 14:35:00 INFO unit.mysql/
Therefore it is clear that the actions do not really set the flags as they are currently being read by the code using reactive.
This variation of behavior when update-status has or hasn't run is very misleading when performing those actions because the results end up being not what we expect them to be when we run the action.
I have tried hacking the code and inserting the method "update_
description: | updated |
Changed in charm-mysql-innodb-cluster: | |
status: | New → Triaged |
importance: | Undecided → High |
tags: | added: sts |
mysql-innodb- cluster is a charms.reactive charm; thus there is a function that sets the flags at the end of the hook depending on whether the hook succeeds or not. This function needs to also be called at the end of an action if the action changes the flags. I've not dug into it, but I think that the charmhelpers hookenv_ run_atexit( ) needs to be called at the end of the action handling code.