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

fixing issue with xtrabackup and long gtids #16304

Merged
merged 1 commit into from
Jul 16, 2024

Conversation

rvrangel
Copy link
Contributor

@rvrangel rvrangel commented Jul 1, 2024

Description

Instead of reading the GTIDs from the xtrabackup output, this will make use of the --extra-lsndir flag to output a copy of the xtrabackup_info file which has the full GTID information, instead of reading it from the STDERR where it eventually gets truncated after the line size gets close to ~8KB

Related Issue(s)

Fixes #16303

Checklist

  • "Backport to:" labels have been added if this change should be back-ported to release branches
  • If this change is to be back-ported to previous releases, a justification is included in the PR description
  • Tests were added or are not required
  • Did the new or modified tests pass consistently locally and on CI?
  • Documentation was added or is not required

Deployment Notes

Copy link
Contributor

vitess-bot bot commented Jul 1, 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 Jul 1, 2024
@github-actions github-actions bot added this to the v21.0.0 milestone Jul 1, 2024
Copy link

codecov bot commented Jul 1, 2024

Codecov Report

Attention: Patch coverage is 75.00000% with 3 lines in your changes missing coverage. Please review.

Project coverage is 68.68%. Comparing base (bb76046) to head (fa9969f).
Report is 48 commits behind head on main.

Files Patch % Lines
go/vt/mysqlctl/xtrabackupengine.go 75.00% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #16304      +/-   ##
==========================================
- Coverage   68.71%   68.68%   -0.04%     
==========================================
  Files        1544     1548       +4     
  Lines      198011   199094    +1083     
==========================================
+ Hits       136064   136738     +674     
- Misses      61947    62356     +409     

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

@@ -300,6 +312,7 @@ func (be *XtrabackupEngine) backupFiles(
"--slave-info",
"--user=" + xtrabackupUser,
"--target-dir=" + params.Cnf.TmpDir,
"--extra-lsndir=" + tempDir,
Copy link
Contributor

Choose a reason for hiding this comment

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

@rvrangel will this flag exist in "most" recent versions of xtrabackup?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good question, it is present since the 2.4 EOL version, so any recent version should have it I imagine.

Copy link
Member

Choose a reason for hiding this comment

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

Where will the temporary directory be created by default? Are we sure to have the necessary permissions?
I'm wondering why not use params.Cnf.TmpDir and just write the file there.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it will default to the system's $TMPDIR (usually /tmp) which we should almost always have permissions, the idea was that we could just remove it once we are done. but if we want to create it under params.Cnf.TmpDir, seems like the --target-dir is mostly unused because we stream the backup to STDOUT.

we could also use that path directly and instead of creating the temporary subdirectory and we either delete the files separately (it is just xtrabackup_info and xtrabackup_checkpoints) or we could just leave them there as the result of the last xtrabackup taken. @deepthi do you have a preference?

Copy link
Member

Choose a reason for hiding this comment

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

What are the pros and cons of leaving the files behind versus deleting them? The next backup would overwrite them anyway, right?
Beyond this one decisions, almost any of the options would work. It's probably a bit simpler to not create a new temporary directory and just use one of the existing ones.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

leaving them is mostly for investigation (if needed), I guess we can just not remove them so there is a copy in the temp folder of the files from the last backup attempt in case an operator wants to look at it, otherwise it will just get overwritten the next time a backup is taken. I will update the PR tomorrow

Copy link
Contributor Author

Choose a reason for hiding this comment

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

PR has been updated 🙌

@deepthi deepthi 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 Jul 11, 2024
Copy link
Member

@deepthi deepthi left a comment

Choose a reason for hiding this comment

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

This will be a good change. The original implementation was definitely somewhat naive :)

@@ -300,6 +312,7 @@ func (be *XtrabackupEngine) backupFiles(
"--slave-info",
"--user=" + xtrabackupUser,
"--target-dir=" + params.Cnf.TmpDir,
"--extra-lsndir=" + tempDir,
Copy link
Member

Choose a reason for hiding this comment

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

Where will the temporary directory be created by default? Are we sure to have the necessary permissions?
I'm wondering why not use params.Cnf.TmpDir and just write the file there.

@deepthi deepthi requested a review from frouioui July 11, 2024 00:18
Copy link
Member

@deepthi deepthi left a comment

Choose a reason for hiding this comment

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

The DCO check needs to be fixed before we can merge this.
The actual changes look good.

Signed-off-by: Renan Rangel <rrangel@slack-corp.com>
@deepthi deepthi merged commit 921aa29 into vitessio:main Jul 16, 2024
127 checks passed
venkatraju pushed a commit to slackhq/vitess that referenced this pull request Aug 29, 2024
Signed-off-by: Renan Rangel <rrangel@slack-corp.com>
tanjinx pushed a commit to slackhq/vitess that referenced this pull request Sep 11, 2024
Signed-off-by: Renan Rangel <rrangel@slack-corp.com>
tanjinx pushed a commit to slackhq/vitess that referenced this pull request Sep 11, 2024
Signed-off-by: Renan Rangel <rrangel@slack-corp.com>
tanjinx pushed a commit to slackhq/vitess that referenced this pull request Sep 11, 2024
Signed-off-by: Renan Rangel <rrangel@slack-corp.com>
tanjinx pushed a commit to slackhq/vitess that referenced this pull request Sep 11, 2024
Signed-off-by: Renan Rangel <rrangel@slack-corp.com>
timvaillancourt added a commit to slackhq/vitess that referenced this pull request Sep 18, 2024
Signed-off-by: Renan Rangel <rrangel@slack-corp.com>
Co-authored-by: Renan Rangel <rvrangel@users.noreply.github.com>
Co-authored-by: Tim Vaillancourt <tim@timvaillancourt.com>
timvaillancourt added a commit to slackhq/vitess that referenced this pull request Oct 10, 2024
#510)

* fixing issue with xtrabackup and long gtids (vitessio#16304)

Signed-off-by: Renan Rangel <rrangel@slack-corp.com>

* fix file format

* fix format

---------

Signed-off-by: Renan Rangel <rrangel@slack-corp.com>
Co-authored-by: Renan Rangel <rvrangel@users.noreply.github.com>
Co-authored-by: Tim Vaillancourt <tim@timvaillancourt.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.

Bug Report: long GTIDs cause xtrabackup backups to fail
4 participants