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

Fail VTBackup early when replication or MySQL is failing #17356

Merged
merged 12 commits into from
Jan 21, 2025

Conversation

frouioui
Copy link
Member

@frouioui frouioui commented Dec 9, 2024

Description

As described in #17355 and #17043, vtbackup "ignores" replication failures and fatal mysql error. Leading to vtbackup processes undesirably running for longer than needed, or worse, stalling.

This Pull Request brings two new enhancements to vtbackup to solve both issues:

  • When the mysqld instance created by vtbackup fails, vtbackup will now be aware of it (thanks to mysqld.OnFailure()) and will cancel its context which will make the process exit faster.
  • The vtbackup process is now limiting the number of sequential replication errors it had to avoid waiting forever when replication is not working. If there are only transient errors, the process will not fail. Unless it reaches the limit of sequential errors, which I have set to 60 for now. As we try to get the replication status every second, this means we will be allowing a minimum of 60 seconds of sequential errors before failing.

Related Issue(s)

Copy link
Contributor

vitess-bot bot commented Dec 9, 2024

Review Checklist

Hello reviewers! 👋 Please follow this checklist when reviewing this Pull Request.

General

  • Ensure that the Pull Request has a descriptive title.
  • Ensure there is a link to an issue (except for internal cleanup and flaky test fixes), new features should have an RFC that documents use cases and test cases.

Tests

  • Bug fixes should have at least one unit or end-to-end test, enhancement and new features should have a sufficient number of tests.

Documentation

  • Apply the release notes (needs details) label if users need to know about this change.
  • New features should be documented.
  • There should be some code comments as to why things are implemented the way they are.
  • There should be a comment at the top of each new or modified test to explain what the test does.

New flags

  • Is this flag really necessary?
  • Flag names must be clear and intuitive, use dashes (-), and have a clear help text.

If a workflow is added or modified:

  • Each item in Jobs should be named in order to mark it as required.
  • If the workflow needs to be marked as required, the maintainer team must be notified.

Backward compatibility

  • Protobuf changes should be wire-compatible.
  • Changes to _vt tables and RPCs need to be backward compatible.
  • RPC changes should be compatible with vitess-operator
  • If a flag is removed, then it should also be removed from vitess-operator and arewefastyet, if used there.
  • vtctl command output order should be stable and awk-able.

@vitess-bot vitess-bot bot added NeedsBackportReason If backport labels have been applied to a PR, a justification is required NeedsDescriptionUpdate The description is not clear or comprehensive enough, and needs work NeedsIssue A linked issue is missing for this Pull Request NeedsWebsiteDocsUpdate What it says labels Dec 9, 2024
@frouioui frouioui changed the title Fail VTBackup when MySQL fails or when we can't check the replication status Fail VTBackup early when we cannot check replication status or when MySQL has failed Dec 9, 2024
@github-actions github-actions bot added this to the v22.0.0 milestone Dec 9, 2024
Copy link

codecov bot commented Dec 9, 2024

Codecov Report

Attention: Patch coverage is 0% with 21 lines in your changes missing coverage. Please review.

Project coverage is 67.69%. Comparing base (4370a48) to head (5f21d18).
Report is 6 commits behind head on main.

Files with missing lines Patch % Lines
go/cmd/vtbackup/cli/vtbackup.go 0.00% 21 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #17356      +/-   ##
==========================================
- Coverage   67.69%   67.69%   -0.01%     
==========================================
  Files        1585     1585              
  Lines      254904   254918      +14     
==========================================
+ Hits       172565   172574       +9     
- Misses      82339    82344       +5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

This PR is being marked as stale because it has been open for 30 days with no activity. To rectify, you may do any of the following:

  • Push additional commits to the associated branch.
  • Remove the stale label.
  • Add a comment indicating why it is not stale.

If no action is taken within 7 days, this PR will be closed.

@github-actions github-actions bot added Stale Marks PRs as stale after a period of inactivity, which are then closed after a grace period. and removed Stale Marks PRs as stale after a period of inactivity, which are then closed after a grace period. labels Jan 10, 2025
@frouioui frouioui removed NeedsDescriptionUpdate The description is not clear or comprehensive enough, and needs work NeedsWebsiteDocsUpdate What it says NeedsIssue A linked issue is missing for this Pull Request NeedsBackportReason If backport labels have been applied to a PR, a justification is required labels Jan 13, 2025
Signed-off-by: Florent Poinsard <[email protected]>
@frouioui frouioui added Type: Enhancement Logical improvement (somewhere between a bug and feature) Component: Backup and Restore labels Jan 13, 2025
@frouioui frouioui marked this pull request as ready for review January 13, 2025 21:50
@frouioui frouioui removed the request for review from ajm188 January 13, 2025 21:52
@frouioui frouioui changed the title Fail VTBackup early when we cannot check replication status or when MySQL has failed Fail VTBackup early when replication or MySQL is failing Jan 13, 2025
Signed-off-by: Florent Poinsard <[email protected]>
Copy link
Contributor

@shlomi-noach shlomi-noach left a comment

Choose a reason for hiding this comment

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

Use LastError as Matt suggested elsewhere.

go/cmd/vtbackup/cli/vtbackup.go Outdated Show resolved Hide resolved
go/cmd/vtbackup/cli/vtbackup.go Outdated Show resolved Hide resolved
Signed-off-by: Florent Poinsard <[email protected]>
@mattlord mattlord self-requested a review January 21, 2025 21:02
Copy link
Contributor

@mattlord mattlord left a comment

Choose a reason for hiding this comment

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

Nice and simple and clean, I love it! ❤️

go/cmd/vtbackup/cli/vtbackup.go Outdated Show resolved Hide resolved
Signed-off-by: Florent Poinsard <[email protected]>
Signed-off-by: Florent Poinsard <[email protected]>
@frouioui frouioui merged commit bf2423f into vitessio:main Jan 21, 2025
103 checks passed
@frouioui frouioui deleted the fail-backup-early branch January 21, 2025 22:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Backup and Restore Type: Enhancement Logical improvement (somewhere between a bug and feature)
Projects
None yet
3 participants