You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ops 2.10 introduced a breaking change that excludes breaking relations from Model.relations: #1091
In order to access relation data for the breaking relation, we need to use event.relation—but this doesn't work in deferred ops events, custom ops events, or collect status ops events.
With ops, it is no longer possible to access the breaking relation data in those ops events during the relation-broken Juju event
Example of impact:
mysql-router-k8s is currently written with no deferred events, no custom events during the relation-broken event, and no ops collect status events (because of limitations with status prioritization)—so it is not currently affected
However, if mysql-router-k8s were to use deferred events in the future, or one of the charm libs it depends on were to use a deferred event or a custom event during relation-broken, it would be affected as following:
Juju agent executes charm with relation-broken event
Current state: MySQL Router is disabled, but relation data in database_provides relations is still populated—mysql-router-k8s charm is giving consuming charms an endpoint and telling them that it should be accessible when Router is disabled & unreachable—this causes a poor UX (consuming applications will probably display incorrect status message) and could cause issues with exponential backoffs (i.e. a delay in service restoration) when MySQL Router is re-enabled
4. ops emits relation broken event
5. If charm encounters issue (uncaught exception in charm code, transient network failure with MySQL Server, etc.) it will fail to execute this code
ifself._database_requires.is_relation_breaking(event):
ifself._upgrade.in_progress:
logger.warning(
"Modifying relations during an upgrade is not supported. The charm may be in a broken, unrecoverable state. Re-deploy the charm"
)
self._database_provides.delete_all_databags()
potentially for an extended period of time—which causes the aforementioned issues with UX & exponential backoff
The text was updated successfully, but these errors were encountered:
ops 2.10 introduced a breaking change that excludes breaking relations from Model.relations: #1091
In order to access relation data for the breaking relation, we need to use
event.relation
—but this doesn't work in deferred ops events, custom ops events, or collect status ops events.With ops, it is no longer possible to access the breaking relation data in those ops events during the relation-broken Juju event
Example of impact:
mysql-router-k8s is currently written with no deferred events, no custom events during the relation-broken event, and no ops collect status events (because of limitations with status prioritization)—so it is not currently affected
However, if mysql-router-k8s were to use deferred events in the future, or one of the charm libs it depends on were to use a deferred event or a custom event during relation-broken, it would be affected as following:
if self._database_requires.is_relation_breaking(event):
evaluates toif False
and is skippedevaluates to
elif False
because relation data for database_requires is missing (trace: workload_ is not AuthenticatedWorkload because relation is missing)workload_.reconcile()
disables MySQL Router because workload_ is not AuthenticatedWorkload because relation is missingCurrent state: MySQL Router is disabled, but relation data in database_provides relations is still populated—mysql-router-k8s charm is giving consuming charms an endpoint and telling them that it should be accessible when Router is disabled & unreachable—this causes a poor UX (consuming applications will probably display incorrect status message) and could cause issues with exponential backoffs (i.e. a delay in service restoration) when MySQL Router is re-enabled
4. ops emits relation broken event
5. If charm encounters issue (uncaught exception in charm code, transient network failure with MySQL Server, etc.) it will fail to execute this code
potentially for an extended period of time—which causes the aforementioned issues with UX & exponential backoff
The text was updated successfully, but these errors were encountered: