Support same-named database with different ports, hosts, or hooks (#418). #952

Merged
witten merged 17 commits from same-named-databases into main 2024-12-26 23:17:59 +00:00
Owner

This is a refactor of the create and restore action logic to support backing up and restoring databases with different ports, hosts, or hooks (e.g. PostgreSQL vs. MariaDB) that happen to share the same database name. The main changes are:

  • If a port is configured for a database, store that metadata into its path in the backup archive. E.g. .../myhost:1234/... in the path instead of just .../myhost/...
  • When restoring a database dump, match databases by the combination of hook name + database name + hostname + port rather than just database name.
  • When restoring, error if multiple dumps within an archive match the requested restore flags. E.g. if you ask to borgmatic restore --data-source test and there are two database dumps in the archive with the name test, error.
  • Support additional disambiguation flags on the restore command-line like --original-port, --original-hostname, and --hook so the user can pick out exactly which database dump they'd like to restore even if several have the same name.

Still to do

  • documentation
  • do an organizational pass on the code
  • get existing unit tests passing again
  • add tests to cover new/changed code
  • audit branch diff for missing test coverage
  • additional error handling
  • lots more manual testing
This is a refactor of the `create` and `restore` action logic to support backing up and restoring databases with different ports, hosts, or hooks (e.g. PostgreSQL vs. MariaDB) that happen to share the same database name. The main changes are: * If a port is configured for a database, store that metadata into its path in the backup archive. E.g. `.../myhost:1234/...` in the path instead of just `.../myhost/...` * When restoring a database dump, match databases by the combination of hook name + database name + hostname + port rather than just database name. * When restoring, error if multiple dumps within an archive match the requested `restore` flags. E.g. if you ask to `borgmatic restore --data-source test` and there are two database dumps in the archive with the name `test`, error. * Support additional disambiguation flags on the `restore` command-line like `--original-port`, `--original-hostname`, and `--hook` so the user can pick out exactly which database dump they'd like to restore even if several have the same name. ### Still to do * [x] documentation * [x] do an organizational pass on the code * [x] get existing unit tests passing again * [x] add tests to cover new/changed code * [x] audit branch diff for missing test coverage * [x] additional error handling * [x] lots more manual testing
witten added 1 commit 2024-12-09 16:57:33 +00:00
witten added 1 commit 2024-12-17 16:51:36 +00:00
witten added 1 commit 2024-12-17 20:02:50 +00:00
witten added 1 commit 2024-12-20 05:05:35 +00:00
witten added 1 commit 2024-12-20 05:08:11 +00:00
witten added 1 commit 2024-12-21 06:41:12 +00:00
witten added 1 commit 2024-12-21 21:35:20 +00:00
witten added 2 commits 2024-12-24 06:13:18 +00:00
witten added 1 commit 2024-12-24 17:14:24 +00:00
witten added 1 commit 2024-12-24 23:24:33 +00:00
witten added 1 commit 2024-12-24 23:26:12 +00:00
witten added 1 commit 2024-12-25 07:10:05 +00:00
witten added 1 commit 2024-12-25 07:25:47 +00:00
witten added 1 commit 2024-12-26 05:59:37 +00:00
witten added 1 commit 2024-12-26 07:04:54 +00:00
witten added 1 commit 2024-12-26 23:16:56 +00:00
witten changed title from WIP: Support same-named database with different ports, hosts, or hooks (#418). to Support same-named database with different ports, hosts, or hooks (#418). 2024-12-26 23:17:11 +00:00
witten merged commit d3c7279dad into main 2024-12-26 23:17:59 +00:00
witten deleted branch same-named-databases 2024-12-26 23:19:22 +00:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: borgmatic-collective/borgmatic#952
No description provided.