Skip to content

Fix backup/rotation with multiple excluded databases#1610

Merged
bastelfreak merged 1 commit into
puppetlabs:mainfrom
synyx:backup-fix-excluded-dbs
Oct 1, 2024
Merged

Fix backup/rotation with multiple excluded databases#1610
bastelfreak merged 1 commit into
puppetlabs:mainfrom
synyx:backup-fix-excluded-dbs

Conversation

@BuJo

@BuJo BuJo commented Dec 11, 2023

Copy link
Copy Markdown
Contributor

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 a team, alexjfisher and bastelfreak as code owners December 11, 2023 10:08
@CLAassistant

CLAassistant commented Dec 11, 2023

Copy link
Copy Markdown

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

BuJo commented Jan 4, 2024

Copy link
Copy Markdown
Contributor Author

Branch is working in production without problems.

@BuJo

BuJo commented Jun 12, 2024

Copy link
Copy Markdown
Contributor Author

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
Comment thread spec/classes/mysql_backup_mysqldump_spec.rb
@bastelfreak

Copy link
Copy Markdown
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

BuJo commented Aug 20, 2024

Copy link
Copy Markdown
Contributor Author

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

BuJo commented Oct 1, 2024

Copy link
Copy Markdown
Contributor Author

@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
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