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

Stop the running log backup when deleting CR #5754

Merged
merged 29 commits into from
Oct 16, 2024
Merged

Conversation

RidRisR
Copy link
Contributor

@RidRisR RidRisR commented Sep 26, 2024

What problem does this PR solve?

In the previous operator version, delete backup CR will do no clean up on running log backup.
Users may mis-operator and find it hard to running task.

Closes #5249

What is changed and how does it work?

  1. Add enum for cleanPolicy, make input standardized.
    Now, only Retain;OnFailure;Delete are accepted as cleanPolicy input, and default is Retain.
    (This is actually no change to user behavior.)

  2. Add finalizer and clean logic check for on-going log backup
    All log backup will have finalizer now. Operator will check if the log backup "on track". If so, a new task to stop log backup will run.
    The "on track" state is BackupScheduled || BackupPrepare || BackupRunning || BackupPaused || BackupStop. We lack the ability to check whether the log backup should be stopped if it failed. If the task is on fail states, we do not provide auto cleaning.

Code changes

  • Has Go code change
  • Has CI related scripts change

Tests

  • Unit test
  • E2E test
  • Manual test
  • No code

Side effects

  • Breaking backward compatibility
  • Other side effects:

Related changes

  • Need to cherry-pick to the release branch
  • Need to update the documentation

Release Notes

Please refer to Release Notes Language Style Guide before writing the release note.


1. Add enum for cleanPolicy, make input standardized.
   Now, only Retain;OnFailure;Delete are accepted as cleanPolicy input, and Retain is default.
   This is actually no change to user behavior.
2. Add finalizer and clean logic check for on-going log backup
    All log backup will have finalizer now. Operator will check if the log backup "on track". If so, a new task to stop log backup will run.
    The "on track" state is `BackupScheduled || BackupPrepare || BackupRunning || BackupPaused`. 
    We lack the ability to check whether the log backup should be stopped if it failed. If the task is on states, we do not provide auto cleaning.

@RidRisR RidRisR marked this pull request as ready for review October 8, 2024 10:14
@RidRisR
Copy link
Contributor Author

RidRisR commented Oct 8, 2024

/run-pull-e2e-kind-br

@RidRisR RidRisR changed the title Log stop Stop the running log backup when deleting CR Oct 8, 2024
@RidRisR
Copy link
Contributor Author

RidRisR commented Oct 9, 2024

/run-pull-e2e-kind-br

@ti-chi-bot ti-chi-bot bot added size/XL and removed size/XXL labels Oct 9, 2024
@codecov-commenter
Copy link

codecov-commenter commented Oct 9, 2024

Codecov Report

Attention: Patch coverage is 63.07692% with 96 lines in your changes missing coverage. Please review.

Project coverage is 20.78%. Comparing base (9ef26f8) to head (be29feb).
Report is 29 commits behind head on master.

❗ There is a different number of reports uploaded between BASE (9ef26f8) and HEAD (be29feb). Click for more details.

HEAD has 1 upload less than BASE
Flag BASE (9ef26f8) HEAD (be29feb)
unittest 1 0
Additional details and impacted files
@@             Coverage Diff             @@
##           master    #5754       +/-   ##
===========================================
- Coverage   61.47%   20.78%   -40.69%     
===========================================
  Files         235      219       -16     
  Lines       30653    30965      +312     
===========================================
- Hits        18843     6436    -12407     
- Misses       9920    23616    +13696     
+ Partials     1890      913      -977     
Flag Coverage Δ
e2e 20.78% <63.07%> (?)
unittest ?

@RidRisR
Copy link
Contributor Author

RidRisR commented Oct 9, 2024

/run-pull-e2e-kind-br

@RidRisR
Copy link
Contributor Author

RidRisR commented Oct 9, 2024

/run-pull-e2e-kind-br

1 similar comment
@RidRisR
Copy link
Contributor Author

RidRisR commented Oct 9, 2024

/run-pull-e2e-kind-br

@BornChanger BornChanger requested review from csuzhangxc and WangLe1321 and removed request for howardlau1999 October 10, 2024 04:23
@RidRisR
Copy link
Contributor Author

RidRisR commented Oct 14, 2024

/run-pull-e2e-kind-br

pkg/controller/backup_status_updater.go Outdated Show resolved Hide resolved
pkg/controller/backup_status_updater.go Outdated Show resolved Hide resolved
tests/e2e/br/br.go Outdated Show resolved Hide resolved
@csuzhangxc
Copy link
Member

/run-pull-e2e-kind-br

@RidRisR
Copy link
Contributor Author

RidRisR commented Oct 14, 2024

/run-pull-e2e-kind-br

@ti-chi-bot ti-chi-bot bot added the lgtm label Oct 16, 2024
Copy link
Contributor

ti-chi-bot bot commented Oct 16, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-10-16 07:07:35.665684613 +0000 UTC m=+427652.814594437: ☑️ agreed by WangLe1321.

@ti-chi-bot ti-chi-bot bot added the approved label Oct 16, 2024
Copy link
Contributor

ti-chi-bot bot commented Oct 16, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: csuzhangxc, WangLe1321

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:
  • OWNERS [WangLe1321,csuzhangxc]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@csuzhangxc csuzhangxc merged commit e42cb3b into pingcap:master Oct 16, 2024
7 checks passed
@csuzhangxc
Copy link
Member

/cherry-pick release-1.6

@csuzhangxc
Copy link
Member

/cherry-pick release-1.5

ti-chi-bot pushed a commit to ti-chi-bot/tidb-operator that referenced this pull request Oct 16, 2024
Co-authored-by: csuzhangxc <csuzhangxc@gmail.com>
@ti-chi-bot
Copy link
Member

@csuzhangxc: new pull request created to branch release-1.6: #5765.

In response to this:

/cherry-pick release-1.6

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository.

ti-chi-bot pushed a commit to ti-chi-bot/tidb-operator that referenced this pull request Oct 16, 2024
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
@ti-chi-bot
Copy link
Member

@csuzhangxc: new pull request created to branch release-1.5: #5766.

In response to this:

/cherry-pick release-1.5

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository.

csuzhangxc added a commit that referenced this pull request Oct 16, 2024
Co-authored-by: ris <79858083+RidRisR@users.noreply.github.com>
Co-authored-by: csuzhangxc <csuzhangxc@gmail.com>
@RidRisR RidRisR deleted the logStop branch October 18, 2024 08:06
csuzhangxc added a commit that referenced this pull request Nov 6, 2024
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
Co-authored-by: ris <79858083+RidRisR@users.noreply.github.com>
Co-authored-by: Xuecheng Zhang <csuzhangxc@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

br: logStop not working
6 participants