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

Fix backup/rotation with multiple excluded databases #1610

Merged
merged 1 commit into from
Oct 1, 2024

Conversation

BuJo
Copy link
Contributor

@BuJo BuJo commented Dec 11, 2023

Summary

Right now, excluding multiple databases does not work.
This MR aims to fix excluding multiple databases, by revising the respective regular expression.

Additional Context

  • When using multiple excluded databases, the list of databases is filtered using grep -v. i.e. grep -v '^\(information_schema|performance_schema\)$
  • When using Basic vs Extended Regular Expressions, the characters ( and | lose their special meaning, the backslashed versions have to be used. For the group (()) the escaping has been done, however the alternation is unescaped.

Leading to:

  • All the excluded databases will be backed up.
  • In case a database is not backuppable (which is why it had been excluded), this leads to the cleanup not being run at all, as it depends on the backup having been successful.

Checklist

  • 🟢 Spec tests.
  • 🟢 Acceptance tests.
  • Manually verified.

@BuJo BuJo requested review from alexjfisher, bastelfreak and a team as code owners December 11, 2023 10:08
@CLAassistant
Copy link

CLAassistant commented Dec 11, 2023

CLA assistant check
All committers have signed the CLA.

@BuJo BuJo force-pushed the backup-fix-excluded-dbs branch from 5a8b607 to 45a2a45 Compare January 4, 2024 11:24
@BuJo
Copy link
Contributor Author

BuJo commented Jan 4, 2024

Branch is working in production without problems.

@BuJo
Copy link
Contributor Author

BuJo commented Jun 12, 2024

Should I rebase this branch on top of the current main?

@BuJo BuJo force-pushed the backup-fix-excluded-dbs branch from 019f8f0 to 8f61315 Compare July 24, 2024 11:03
@bastelfreak
Copy link
Collaborator

I was wondering why no tests catched the issue you described. Turns out there's a test, but only for ancient mysql: #1642.

@BuJo
Copy link
Contributor Author

BuJo commented Aug 20, 2024

Should I try and port the test forward before merging @bastelfreak ?

@bastelfreak bastelfreak reopened this Sep 20, 2024
* When using multiple excluded databases, the list of databases
  is filtered using `grep -v`.
  i.e. `grep -v '^\(information_schema|performance_schema\)$`
* When using Basic vs Extended Regular Expressions, the characters
  `(` and `|` lose their special meaning, the backslashed versions
  have to be used.
  For the group (`()`) the escaping has been done, however the
  alternation is unescaped.

Leading to:

* All the excluded databases will be backed up.
* In case a database is not backuppable (which is why it had been
  excluded), this leads to the cleanup not being run at all, as it
  depends on the backup having been successful.

This MR aims to fix this issue, by revising the regular expression
and specifying that behaviour in the respective class spec.
@BuJo BuJo force-pushed the backup-fix-excluded-dbs branch from 8f61315 to 7d90921 Compare October 1, 2024 14:00
@BuJo
Copy link
Contributor Author

BuJo commented Oct 1, 2024

@bastelfreak I rebased the branch on top of current main, hopefully the tests go through.

@bastelfreak bastelfreak merged commit 6ffe520 into puppetlabs:main Oct 1, 2024
37 of 38 checks passed
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.

4 participants