mirror of
https://github.com/borgmatic-collective/borgmatic.git
synced 2026-07-22 02:03:01 +02:00
For the MariaDB and MySQL database hooks, creates a consistent snapshot by dumping all tables in a single transaction (#1193).
This commit is contained in:
@@ -10,6 +10,8 @@
|
||||
command-line flags for database commands.
|
||||
* #1193: For the MariaDB and MySQL database hooks, add a "socket_path" option for Unix socket
|
||||
database connections.
|
||||
* #1193: For the MariaDB and MySQL database hooks, creates a consistent snapshot by dumping all
|
||||
tables in a single transaction.
|
||||
* #1194: Fix for an incorrect diff command shown when running the "generate config" action with a
|
||||
source configuration file.
|
||||
* #1195: Fix a regression in the ZFS, LVM, and Btrfs hooks in which snapshotted paths ignored
|
||||
|
||||
@@ -227,6 +227,7 @@ def execute_dump_command(
|
||||
)
|
||||
+ extra_options
|
||||
+ (('--add-drop-database',) if database.get('add_drop_database', True) else ())
|
||||
+ ('--single-transaction',)
|
||||
+ (('--host', hostname) if hostname else ())
|
||||
+ (('--port', str(database['port'])) if 'port' in database else ())
|
||||
+ (('--protocol', 'tcp') if hostname or 'port' in database else ())
|
||||
|
||||
@@ -158,6 +158,7 @@ def execute_dump_command(
|
||||
)
|
||||
+ extra_options
|
||||
+ (('--add-drop-database',) if database.get('add_drop_database', True) else ())
|
||||
+ ('--single-transaction',)
|
||||
+ (('--host', hostname) if hostname else ())
|
||||
+ (('--port', str(database['port'])) if 'port' in database else ())
|
||||
+ (('--protocol', 'tcp') if hostname or 'port' in database else ())
|
||||
|
||||
@@ -659,9 +659,14 @@ configuration. Here's an example with MariaDB:
|
||||
```yaml
|
||||
mariadb_databases:
|
||||
- name: posts
|
||||
options: "--single-transaction --quick"
|
||||
options: "--single-transaction"
|
||||
```
|
||||
|
||||
<span class="minilink minilink-addedin">New in version 2.0.13</span> borgmatic
|
||||
passes `--single-transaction` to MariaDB/MySQL by default, and you no longer
|
||||
need to set that in `options:`.
|
||||
|
||||
|
||||
### borgmatic hangs during backup
|
||||
|
||||
See Limitations above about `read_special`. You may need to exclude certain
|
||||
|
||||
@@ -837,6 +837,7 @@ def test_execute_dump_command_runs_mariadb_dump():
|
||||
'mariadb-dump',
|
||||
'--defaults-extra-file=/dev/fd/99',
|
||||
'--add-drop-database',
|
||||
'--single-transaction',
|
||||
'--databases',
|
||||
'foo',
|
||||
'--result-file',
|
||||
@@ -880,6 +881,7 @@ def test_execute_dump_command_with_environment_password_transport_skips_defaults
|
||||
(
|
||||
'mariadb-dump',
|
||||
'--add-drop-database',
|
||||
'--single-transaction',
|
||||
'--user',
|
||||
'root',
|
||||
'--databases',
|
||||
@@ -929,6 +931,7 @@ def test_execute_dump_command_runs_mariadb_dump_without_add_drop_database():
|
||||
(
|
||||
'mariadb-dump',
|
||||
'--defaults-extra-file=/dev/fd/99',
|
||||
'--single-transaction',
|
||||
'--databases',
|
||||
'foo',
|
||||
'--result-file',
|
||||
@@ -979,6 +982,7 @@ def test_execute_dump_command_runs_mariadb_dump_with_hostname_and_port():
|
||||
'mariadb-dump',
|
||||
'--defaults-extra-file=/dev/fd/99',
|
||||
'--add-drop-database',
|
||||
'--single-transaction',
|
||||
'--host',
|
||||
'database.example.org',
|
||||
'--port',
|
||||
@@ -1033,6 +1037,7 @@ def test_execute_dump_command_runs_mariadb_dump_with_tls():
|
||||
'mariadb-dump',
|
||||
'--defaults-extra-file=/dev/fd/99',
|
||||
'--add-drop-database',
|
||||
'--single-transaction',
|
||||
'--ssl',
|
||||
'--databases',
|
||||
'foo',
|
||||
@@ -1082,6 +1087,7 @@ def test_execute_dump_command_runs_mariadb_dump_without_tls():
|
||||
'mariadb-dump',
|
||||
'--defaults-extra-file=/dev/fd/99',
|
||||
'--add-drop-database',
|
||||
'--single-transaction',
|
||||
'--skip-ssl',
|
||||
'--databases',
|
||||
'foo',
|
||||
@@ -1131,6 +1137,7 @@ def test_execute_dump_command_runs_mariadb_dump_with_username_and_password():
|
||||
'mariadb-dump',
|
||||
'--defaults-extra-file=/dev/fd/99',
|
||||
'--add-drop-database',
|
||||
'--single-transaction',
|
||||
'--databases',
|
||||
'foo',
|
||||
'--result-file',
|
||||
@@ -1180,6 +1187,7 @@ def test_execute_dump_command_runs_mariadb_dump_with_options():
|
||||
'--defaults-extra-file=/dev/fd/99',
|
||||
'--stuff=such',
|
||||
'--add-drop-database',
|
||||
'--single-transaction',
|
||||
'--databases',
|
||||
'foo',
|
||||
'--result-file',
|
||||
@@ -1229,6 +1237,7 @@ def test_execute_dump_command_runs_non_default_mariadb_dump_with_options():
|
||||
'--defaults-extra-file=/dev/fd/99',
|
||||
'--stuff=such',
|
||||
'--add-drop-database',
|
||||
'--single-transaction',
|
||||
'--databases',
|
||||
'foo',
|
||||
'--result-file',
|
||||
|
||||
@@ -717,6 +717,7 @@ def test_execute_dump_command_runs_mysqldump():
|
||||
'mysqldump',
|
||||
'--defaults-extra-file=/dev/fd/99',
|
||||
'--add-drop-database',
|
||||
'--single-transaction',
|
||||
'--databases',
|
||||
'foo',
|
||||
'--result-file',
|
||||
@@ -764,6 +765,7 @@ def test_execute_dump_command_with_environment_password_transport_skips_defaults
|
||||
(
|
||||
'mysqldump',
|
||||
'--add-drop-database',
|
||||
'--single-transaction',
|
||||
'--user',
|
||||
'root',
|
||||
'--databases',
|
||||
@@ -813,6 +815,7 @@ def test_execute_dump_command_runs_mysqldump_without_add_drop_database():
|
||||
(
|
||||
'mysqldump',
|
||||
'--defaults-extra-file=/dev/fd/99',
|
||||
'--single-transaction',
|
||||
'--databases',
|
||||
'foo',
|
||||
'--result-file',
|
||||
@@ -863,6 +866,7 @@ def test_execute_dump_command_runs_mysqldump_with_hostname_and_port():
|
||||
'mysqldump',
|
||||
'--defaults-extra-file=/dev/fd/99',
|
||||
'--add-drop-database',
|
||||
'--single-transaction',
|
||||
'--host',
|
||||
'database.example.org',
|
||||
'--port',
|
||||
@@ -917,6 +921,7 @@ def test_execute_dump_command_runs_mysqldump_with_tls():
|
||||
'mysqldump',
|
||||
'--defaults-extra-file=/dev/fd/99',
|
||||
'--add-drop-database',
|
||||
'--single-transaction',
|
||||
'--ssl',
|
||||
'--databases',
|
||||
'foo',
|
||||
@@ -966,6 +971,7 @@ def test_execute_dump_command_runs_mysqldump_without_tls():
|
||||
'mysqldump',
|
||||
'--defaults-extra-file=/dev/fd/99',
|
||||
'--add-drop-database',
|
||||
'--single-transaction',
|
||||
'--skip-ssl',
|
||||
'--databases',
|
||||
'foo',
|
||||
@@ -1015,6 +1021,7 @@ def test_execute_dump_command_runs_mysqldump_with_username_and_password():
|
||||
'mysqldump',
|
||||
'--defaults-extra-file=/dev/fd/99',
|
||||
'--add-drop-database',
|
||||
'--single-transaction',
|
||||
'--databases',
|
||||
'foo',
|
||||
'--result-file',
|
||||
@@ -1064,6 +1071,7 @@ def test_execute_dump_command_runs_mysqldump_with_options():
|
||||
'--defaults-extra-file=/dev/fd/99',
|
||||
'--stuff=such',
|
||||
'--add-drop-database',
|
||||
'--single-transaction',
|
||||
'--databases',
|
||||
'foo',
|
||||
'--result-file',
|
||||
@@ -1112,6 +1120,7 @@ def test_execute_dump_command_runs_non_default_mysqldump():
|
||||
'custom_mysqldump', # Custom MySQL dump command
|
||||
'--defaults-extra-file=/dev/fd/99',
|
||||
'--add-drop-database',
|
||||
'--single-transaction',
|
||||
'--databases',
|
||||
'foo',
|
||||
'--result-file',
|
||||
|
||||
Reference in New Issue
Block a user