Skip to content

[DPE-7603][DPE-6990] Fix check in relation initialisation #1054

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

marceloneppel
Copy link
Member

@marceloneppel marceloneppel commented Aug 11, 2025

Issue

The handler for the database_requested event creates a new user through the primary, but checks if the current unit is has started PostgreSQL. The current unit may be the leader but not the primary, which may lead to errors when trying to access the database.

There is also the case where, for some reason, the K8s PG primary service stops redirecting traffic to the unit for a short period. This makes the charm understand that the cluster has initialised completely and can create users (but it may not due to that weird situation). This still needs further investigation.

Solution

Use the right condition (primary endpoint being ready) in the check.

Fixes #1011
Fixes #927

Checklist

  • I have added or updated any relevant documentation.
  • I have cleaned any remaining cloud resources from my accounts.

Signed-off-by: Marcelo Henrique Neppel <[email protected]>
Signed-off-by: Marcelo Henrique Neppel <[email protected]>
@marceloneppel marceloneppel added the not bug or enhancement PR is not 'bug' or 'enhancement'. For release notes label Aug 11, 2025
Copy link

codecov bot commented Aug 11, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 73.33%. Comparing base (fa52899) to head (39eb2b9).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1054   +/-   ##
=======================================
  Coverage   73.33%   73.33%           
=======================================
  Files          15       15           
  Lines        3919     3919           
  Branches      573      573           
=======================================
  Hits         2874     2874           
  Misses        831      831           
  Partials      214      214           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Signed-off-by: Marcelo Henrique Neppel <[email protected]>
@marceloneppel marceloneppel marked this pull request as ready for review August 11, 2025 20:11
@dragomirp
Copy link
Contributor

We'll most probably need to remove the old cla-check to be able to merge.

Copy link
Contributor

@taurus-forever taurus-forever left a comment

Choose a reason for hiding this comment

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

Wow, this is a nice catch!

@marceloneppel marceloneppel changed the title [DPE-7603] Fix check in relation initialisation [DPE-7603][DPE-6990] Fix check in relation initialisation Aug 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Libraries: Out of sync not bug or enhancement PR is not 'bug' or 'enhancement'. For release notes
Projects
None yet
3 participants