-
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
fix releasing the global read lock when mysqlshell backup fails #17000
Conversation
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
|
I am adding the |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #17000 +/- ##
==========================================
- Coverage 69.34% 67.09% -2.25%
==========================================
Files 1571 1571
Lines 204180 251763 +47583
==========================================
+ Hits 141582 168915 +27333
- Misses 62598 82848 +20250 ☔ View full report in Codecov by Sentry. |
Signed-off-by: Renan Rangel <[email protected]>
Signed-off-by: Renan Rangel <[email protected]>
ae1f7dd
to
a221b2e
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.
Nice work, @rvrangel ! I only had some minor comments. Let me know what you think and I'll come back to this quickly.
@@ -56,6 +56,8 @@ var ( | |||
// disable redo logging and double write buffer | |||
mysqlShellSpeedUpRestore = false | |||
|
|||
mysqlShellBackupBinaryName = "mysqlsh" |
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.
Nit, but any reason for this not to remain a const?
Looks like it's only changed for the test, the value used is passed in as a parameter to generate the new file:
generateTestFile(t, mysqlShellBackupBinaryName, "#!/bin/bash\nexit 1")
And we've told the engine to use this other file instead of mysqlsh
. This is OK, but couldn't we instead set and unset a shell alias
for mysqlsh
so that the shell calls our test script? It feels a little less bad than allowing the binary name to be changed although it's the same effect.
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.
Indeed, this is only changed for the test. I am not sure setting an alias would work, as the exec documentation says:
Unlike the "system" library call from C and other languages, the os/exec package intentionally does not invoke the system shell and does not expand any glob patterns or handle other expansions, pipelines, or redirections typically done by shells.
I would imagine the above also means that setting an alias wouldn't work
Signed-off-by: Renan Rangel <[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.
Thank you, @rvrangel ! ❤️
Signed-off-by: Renan Rangel <[email protected]>
…kup fails (#17000) (#17012) Signed-off-by: Renan Rangel <[email protected]> Co-authored-by: vitess-bot[bot] <108069721+vitess-bot[bot]@users.noreply.github.com>
…ssio#17000) Signed-off-by: Renan Rangel <[email protected]> Signed-off-by: 'Renan Rangel' <[email protected]>
Description
This fixes an issue we noticed during testing where if the backup process (
mysqlsh
) fails, be it because of incorrect parameters, missing binary, etc, it won't release the global read lock we are holding on the instance. This ensures we are releasing the lock even if we hit an error early on.I also added unit tests to capture when those particular scenarios happen.
Related Issue(s)
Fixes #17011, an issue introduced that only affects the new
mysqlshell
backup engine introduced in #16295Checklist