Skip to content
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

pods are deleted without waiting for completion when switchover takes a long time #751

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

Conversation

shunki-fujita
Copy link
Contributor

@shunki-fujita shunki-fujita force-pushed the issue-747 branch 5 times, most recently from 6c8c8cc to 2c800d7 Compare November 6, 2024 09:47
@shunki-fujita shunki-fujita marked this pull request as ready for review November 12, 2024 07:46
if _, exists := primary.Annotations[constants.AnnPreventDelete]; !exists {
logFromContext(ctx).Info("replication delay detected, prevent pod deletion", "instance", ss.Primary)
primary.Annotations[constants.AnnPreventDelete] = "true"
p.client.Update(ctx, primary)
Copy link
Contributor

Choose a reason for hiding this comment

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

I think Patch method is better here like below.

if err := p.client.Patch(ctx, newPod, client.MergeFrom(ppod)); err != nil {

@@ -235,6 +235,46 @@ func (p *managerProcess) GatherStatus(ctx context.Context) (*StatusSet, error) {
ss.ExecutedGTID = pst.GlobalVariables.ExecutedGTID
}

// detect replication delay
if cluster.Spec.MaxDelaySecondsForPodDeletion > 0 {
Copy link
Contributor

Choose a reason for hiding this comment

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

GatherStatus function should only collect status and return as StatusSet.
Updating the resource should not be done here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants