-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Implement a per-file retry mechanism in the BuiltinBackupEngine
#17271
Implement a per-file retry mechanism in the BuiltinBackupEngine
#17271
Conversation
Signed-off-by: Florent Poinsard <[email protected]>
Review ChecklistHello reviewers! 👋 Please follow this checklist when reviewing this Pull Request. General
Tests
Documentation
New flags
If a workflow is added or modified:
Backward compatibility
|
Signed-off-by: Florent Poinsard <[email protected]>
Signed-off-by: Florent Poinsard <[email protected]>
Signed-off-by: Florent Poinsard <[email protected]>
Signed-off-by: Florent Poinsard <[email protected]>
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #17271 +/- ##
==========================================
+ Coverage 67.40% 67.50% +0.09%
==========================================
Files 1574 1580 +6
Lines 253221 253805 +584
==========================================
+ Hits 170690 171336 +646
+ Misses 82531 82469 -62 ☔ View full report in Codecov by Sentry. |
Signed-off-by: Florent Poinsard <[email protected]>
e306633
to
7db26bc
Compare
Signed-off-by: Florent Poinsard <[email protected]>
c3cf5c9
to
48938fa
Compare
Signed-off-by: Florent Poinsard <[email protected]>
Signed-off-by: Florent Poinsard <[email protected]>
Signed-off-by: Florent Poinsard <[email protected]>
Signed-off-by: Florent Poinsard <[email protected]>
Signed-off-by: Florent Poinsard <[email protected]>
Signed-off-by: Florent Poinsard <[email protected]>
…iltin-engine Signed-off-by: Florent Poinsard <[email protected]>
Signed-off-by: Florent Poinsard <[email protected]>
Signed-off-by: Florent Poinsard <[email protected]>
Signed-off-by: Florent Poinsard <[email protected]>
Signed-off-by: Florent Poinsard <[email protected]>
Signed-off-by: Florent Poinsard <[email protected]>
655d878
to
82d9baa
Compare
82d9baa
to
655d878
Compare
655d878
to
82d9baa
Compare
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.
Thanks for working on this, @frouioui ! I only had some minor notes/comments/suggestions.
Signed-off-by: Florent Poinsard <[email protected]>
Signed-off-by: Florent Poinsard <[email protected]>
Signed-off-by: Florent Poinsard <[email protected]>
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.
Nice work on this! ❤️
BuiltinBackupEngine
BuiltinBackupEngine
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.
Nice work! I have just one more cosmetic change request:
s/errorsbackup/errors
Also regarding
The changes made on this PR have the side-effect of fixing #16825 for the builtin engine.
Can you call out the specific bug /race condition at the code level that is being fixed? That will allow people to backport a small change to their forks if they want to.
Signed-off-by: Florent Poinsard <[email protected]>
Done via 25791d8.
I have updated the Pull Request description @deepthi. |
Signed-off-by: Florent Poinsard <[email protected]>
Description
This Pull Request adds a retry mechanism to the builtin backup engine, following what was described in #17259.
I have modified how we record errors in the backup engine, to use a new interface named
BackupErrorRecorder
, the implementationPerFileErrorRecorder
groups each error by their filename. It enables the builtin backup engine to figure out which files have failed and restart them.We retry every file maximum once (set by a constant), if a file fails during its retry we will cancel everything and fail fast.
I also went ahead and changed the cosmetics of our logs a bit to make them more human readable and easier to follow. The attempt number is added to most log lines, the format used if more consistent, filenames are spelled out in more places to ease debugging.
The builtin blackbox tests were changed to include a new set of restore and backup tests that exercise this retry mechanism. Additionally, I added some integration tests for the S3 backups and restores. These tests use Minio so we don't have to manage AWS secrets in our repository and the security burden that goes with it; However, I made it easily possible to run these tests against AWS S3, for local testing.
The changes made on this PR have the side-effect of fixing #16825 for the builtin engine. This was fixed by specifically calling
EndBackup
before returning frombackupFiles
function and before backing up theMANIFEST
. CallingEndBackup
ensures that the backup is 100% complete both locally and on the remote storage, which is an important thing to check as errors can happen asynchronously when writing to the remote storage. The new logic introduced in this PR relies heavily onEndBackup
to define if we need to retry any file or if we need to fail the backup process, this has the side-effect of fixing #16825. Below are the snippets that fix the issue for both normal file entries and also for theMANIFEST
file:vitess/go/vt/mysqlctl/builtinbackupengine.go
Lines 718 to 721 in 19d6e28
vitess/go/vt/mysqlctl/builtinbackupengine.go
Lines 1045 to 1048 in 19d6e28
We do call
EndBackup
very late in the backup process, once we have finished going through all the files, the manifest, restarted mysql, etc. This was bad as we were catching errors only at the very end after having uploaded the MANIFEST and other files.Related Issue(s)
BuiltinBackupEngine
: Retry failed files #17259Checklist