-
Notifications
You must be signed in to change notification settings - Fork 27
[DPE-3380] Handle S3 relation in primary non-leader unit #340
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
Conversation
Signed-off-by: Marcelo Henrique Neppel <marcelo.neppel@canonical.com>
Signed-off-by: Marcelo Henrique Neppel <marcelo.neppel@canonical.com>
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #340 +/- ##
==========================================
+ Coverage 80.00% 80.05% +0.04%
==========================================
Files 10 10
Lines 2176 2206 +30
Branches 344 354 +10
==========================================
+ Hits 1741 1766 +25
- Misses 368 371 +3
- Partials 67 69 +2 ☔ View full report in Codecov by Sentry. |
…tanza-on-primary Signed-off-by: Marcelo Henrique Neppel <marcelo.neppel@canonical.com>
Signed-off-by: Marcelo Henrique Neppel <marcelo.neppel@canonical.com>
Signed-off-by: Marcelo Henrique Neppel <marcelo.neppel@canonical.com>
Signed-off-by: Marcelo Henrique Neppel <marcelo.neppel@canonical.com>
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.
Great!
* Handle S3 relation in primary non-leader unit Signed-off-by: Marcelo Henrique Neppel <marcelo.neppel@canonical.com> * Fix replication after restore Signed-off-by: Marcelo Henrique Neppel <marcelo.neppel@canonical.com> * Fix unit name Signed-off-by: Marcelo Henrique Neppel <marcelo.neppel@canonical.com> * Speed up events Signed-off-by: Marcelo Henrique Neppel <marcelo.neppel@canonical.com> * Change fast_interval parameter Signed-off-by: Marcelo Henrique Neppel <marcelo.neppel@canonical.com> --------- Signed-off-by: Marcelo Henrique Neppel <marcelo.neppel@canonical.com>
Issue
The stanza can only be initialised in the PostgreSQL primary unit if it's the Juju leader unit.
Otherwise, the unit fails with an error, as shown in canonical/postgresql-k8s-operator#370.
Solution
Ported from canonical/postgresql-k8s-operator#375.
Allow the non-leader unit (when it's the PostgreSQL primary) to initialise the stanza.
For that, all checks for the unit being the Juju leader unit were changed to check whether the unit is the PostgreSQL primary.
Also, some coordination is now made in the relation databags to share the stanza name and the
init-pgbackrest
flag.The current flow doesn't change if the PostgreSQL primary unit is also the Juju leader unit.
If they are different units, then:
init-pgbackres
flag are set in the primary unit relation databag.pgbackrest check
command is executed in the primary unit, which clears theinit-pgbackrest
flag from the unit relation databag.init-pgbackrest
flag from the application relation databag.Both unit and integration tests were added/updated to ensure we keep this flow intact.
Also, the fix from canonical/postgresql-k8s-operator#273 was added through this PR, as it was not applied to the VM charm.