-
Notifications
You must be signed in to change notification settings - Fork 252
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
fix: replica cluster should restart after promotion #4399
Conversation
❗ By default, the pull request is configured to backport to all release branches.
|
/test limit=local |
@jsilvela, here's the link to the E2E on CNPG workflow run: https://github.com/cloudnative-pg/cloudnative-pg/actions/runs/9014692079 |
@@ -1114,7 +1113,7 @@ func (r *InstanceReconciler) reconcilePrimary(ctx context.Context, cluster *apiv | |||
if err := r.handlePromotion(ctx, cluster); err != nil { | |||
return false, err | |||
} | |||
restarted = true | |||
promoted = true |
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.
This is not your PR but the existing code.
This is asymmetric. We decide that the instance is a primary with IsPrimary, which checks for the existence of "recovery.conf"
Let's say we:
- successfully promote the instace
- when trying to update the Status or drop the connections, we fail
Then the next time around we'll see the instance is a primary, and we won't retry.
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 we don't update the status, the Status patch step is retried.
The drop connection is not vital. It is there only to prevent a long-running session through the read-only service from silently becoming a read-write one.
update the pr by removing the unused variable |
/test level=4 |
@fcanovai, here's the link to the E2E on CNPG workflow run: https://github.com/cloudnative-pg/cloudnative-pg/actions/runs/9173885815 |
Signed-off-by: Tao Li <tao.li@enterprisedb.com>
Signed-off-by: Jaime Silvela <jaime.silvela@enterprisedb.com>
Signed-off-by: Tao Li <tao.li@enterprisedb.com>
Co-authored-by: Jaime Silvela <jaime.silvela@enterprisedb.com> Signed-off-by: Tao Li <tao.li@enterprisedb.com>
When a replica cluster is promoted, the `archive_mode` is changed from `always` to `on`. This change requires a restart because Postgres does not reload the configuration during the promotion. Closes: #4172 Signed-off-by: Tao Li <tao.li@enterprisedb.com> Signed-off-by: Jaime Silvela <jaime.silvela@enterprisedb.com> Co-authored-by: Jaime Silvela <jaime.silvela@enterprisedb.com> (cherry picked from commit 33d7b65)
When a replica cluster is promoted, the `archive_mode` is changed from `always` to `on`. This change requires a restart because Postgres does not reload the configuration during the promotion. Closes: #4172 Signed-off-by: Tao Li <tao.li@enterprisedb.com> Signed-off-by: Jaime Silvela <jaime.silvela@enterprisedb.com> Co-authored-by: Jaime Silvela <jaime.silvela@enterprisedb.com> (cherry picked from commit 33d7b65)
When a replica cluster is promoted, the `archive_mode` is changed from `always` to `on`. This change requires a restart because Postgres does not reload the configuration during the promotion. Closes: #4172 Signed-off-by: Tao Li <tao.li@enterprisedb.com> Signed-off-by: Jaime Silvela <jaime.silvela@enterprisedb.com> Co-authored-by: Jaime Silvela <jaime.silvela@enterprisedb.com> (cherry picked from commit 33d7b65)
) When a replica cluster is promoted, the `archive_mode` is changed from `always` to `on`. This change requires a restart because Postgres does not reload the configuration during the promotion. Closes: cloudnative-pg#4172 Signed-off-by: Tao Li <tao.li@enterprisedb.com> Signed-off-by: Jaime Silvela <jaime.silvela@enterprisedb.com> Co-authored-by: Jaime Silvela <jaime.silvela@enterprisedb.com> Signed-off-by: Douglass Kirkley <dkirkley@eitccorp.com>
When a replica cluster is promoted, the
archive_mode
is changed fromalways
toon
. This change requires a restart because Postgresdoes not reload the configuration during the promotion.
Closes: #4172