Implement a per-file retry mechanism in the BuiltinBackupEngine#17271
Implement a per-file retry mechanism in the BuiltinBackupEngine#17271frouioui merged 28 commits intovitessio:mainfrom
BuiltinBackupEngine#17271Conversation
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 <florent.poinsard@outlook.fr>
Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr>
Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr>
Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr>
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 <florent.poinsard@outlook.fr>
e306633 to
7db26bc
Compare
Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr>
c3cf5c9 to
48938fa
Compare
Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr>
Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr>
Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr>
Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr>
Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr>
Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr>
…iltin-engine Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr>
Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr>
Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr>
Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr>
Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr>
Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr>
655d878 to
82d9baa
Compare
82d9baa to
655d878
Compare
655d878 to
82d9baa
Compare
Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr>
Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr>
Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr>
BuiltinBackupEngineBuiltinBackupEngine
deepthi
left a comment
There was a problem hiding this comment.
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 <florent.poinsard@outlook.fr>
Done via 25791d8.
I have updated the Pull Request description @deepthi. |
Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr>
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 implementationPerFileErrorRecordergroups 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
EndBackupbefore returning frombackupFilesfunction and before backing up theMANIFEST. CallingEndBackupensures 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 onEndBackupto 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 theMANIFESTfile: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
EndBackupvery 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