Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bugfix] defer reconciling pebble layer for exporter #302

Merged
merged 1 commit into from Sep 6, 2023

Conversation

paulomach
Copy link
Contributor

Issue

COS relation creation/departure is reconciling the pebble layer, which will hinder the charm initialization in case it happens before other initial events (leader-election, pebble-ready).
This scenario will happens on relating with COS right from the deployment, e.g. in a bundle.

Solution

Defer handler to run after initialization.

Copy link

@phvalguima phvalguima left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That fix resolved the race condition between COS and mysql cluster

LGTM

logger.debug("Defer reconcile mysqld exporter")
event.defer()
return

self.current_event = event
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would be careful with current_event and deferring a relation broken event

In this situation, I don't think it will break anything unless there's a deferred event that runs in the same charm execution as the relation broken event. However, something that uses has_cos_relation or current_event in the future that is not aware that relation broken can be deferred could introduce issues

@paulomach paulomach merged commit 296362b into main Sep 6, 2023
15 checks passed
@paulomach paulomach deleted the fix/wait-initialization-before-cos-relation branch September 6, 2023 13:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants