Skip to content

Conversation

marceloneppel
Copy link
Member

@marceloneppel marceloneppel commented Aug 18, 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.

Port of #1054 for PG 16.

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]>
Copy link

codecov bot commented Aug 18, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 68.68%. Comparing base (31333b5) to head (1d60d9b).
⚠️ Report is 2 commits behind head on 16/edge.

❌ Your project status has failed because the head coverage (68.68%) is below the target coverage (70.00%). You can increase the head coverage or adjust the target coverage.

Additional details and impacted files
@@           Coverage Diff            @@
##           16/edge    #1061   +/-   ##
========================================
  Coverage    68.68%   68.68%           
========================================
  Files           15       15           
  Lines         4043     4043           
  Branches       582      582           
========================================
  Hits          2777     2777           
  Misses        1058     1058           
  Partials       208      208           

☔ 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.

@marceloneppel marceloneppel added the not bug or enhancement PR is not 'bug' or 'enhancement'. For release notes label Aug 18, 2025
…ion-initialisation

Signed-off-by: Marcelo Henrique Neppel <[email protected]>
@marceloneppel marceloneppel marked this pull request as ready for review August 22, 2025 11:39
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.

👍

@marceloneppel marceloneppel merged commit 5a8c5b7 into 16/edge Aug 25, 2025
185 of 196 checks passed
@marceloneppel marceloneppel deleted the fix-check-in-relation-initialisation branch August 25, 2025 11:41
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
Development

Successfully merging this pull request may close these issues.

3 participants