-
Notifications
You must be signed in to change notification settings - Fork 20
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
[DPE-3562] Don't block on missing Postgresql version #626
Conversation
application_relation_databag.update(updates) | ||
unit_relation_databag.update(updates) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So that that mccabe doesn't complain.
except ( | ||
PostgreSQLCreateDatabaseError, | ||
PostgreSQLCreateUserError, | ||
PostgreSQLGetPostgreSQLVersionError, | ||
): | ||
self.charm.unit.status = BlockedStatus( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should most probably defer here. Should I change this as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think a defer
would be good here. We just need to ensure that we can change the status to Active
later when the database/user creation succeeds (which is what we are already missing today).
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #626 +/- ##
==========================================
- Coverage 70.71% 70.66% -0.05%
==========================================
Files 11 11
Lines 2926 2932 +6
Branches 511 512 +1
==========================================
+ Hits 2069 2072 +3
- Misses 748 750 +2
- Partials 109 110 +1 ☔ View full report in Codecov by Sentry. |
postgresql_version = None | ||
try: | ||
postgresql_version = self.charm.postgresql.get_postgresql_version() | ||
except PostgreSQLGetPostgreSQLVersionError: | ||
logger.exception( | ||
"Failed to retrieve the PostgreSQL version to initialise/update %s relation" | ||
% self.relation_name | ||
) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
K8S charm will not update the endpoints as aggressively as VM. This will be reran only on config change. Should I try add something to update status?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it a time for Pebble Notices and stop relying update-status?
Up 2 Marcelo here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it's possible to avoid calls to sleep
or similar things on the notice event received by the charm (if we need to notify again from inside that event handler because the database version couldn't still be retrieved), I'm fine with using Pebble notices for that. Otherwise, I'd keep it on update status for now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Up 2 Marcelo...
postgresql_version = None | ||
try: | ||
postgresql_version = self.charm.postgresql.get_postgresql_version() | ||
except PostgreSQLGetPostgreSQLVersionError: | ||
logger.exception( | ||
"Failed to retrieve the PostgreSQL version to initialise/update %s relation" | ||
% self.relation_name | ||
) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it a time for Pebble Notices and stop relying update-status?
Up 2 Marcelo here.
except ( | ||
PostgreSQLCreateDatabaseError, | ||
PostgreSQLCreateUserError, | ||
PostgreSQLGetPostgreSQLVersionError, | ||
): | ||
self.charm.unit.status = BlockedStatus( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think a defer
would be good here. We just need to ensure that we can change the status to Active
later when the database/user creation succeeds (which is what we are already missing today).
if ( | ||
not self.set_up_relation(event.relation) | ||
and self.charm.unit.status.message | ||
== f"Failed to initialize {self.relation_name} relation" | ||
): | ||
event.defer() | ||
return |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Charm should be unblocked by _update_unit_status
if set_up_relation succeeds.
Port of canonical/postgresql-operator#578
Don't block the relation if Postgresql can't get the database version.