Package: backupninja
Version: 0.9.6-3
Tags: patch

It would be great in backupninja supported customising mysqldump options
without having to 'fork' the supplied handler.

The defaults supplied are somewhat understandable but unfortunate - for
example, adopting extended inserts reduces the time taken to dump and
insert, as well as I/O space and time. For regular snapshot backups, I
may also wish to not lock the tables so that the service is not paused.
(etc.)

My current solution is simply to apply:

 -  DUMP_BASE="$MYSQLDUMP $defaultsfile --lock-tables --complete-insert
                                               --add-drop-table [..]"
 +  DUMP_BASE="$MYSQLDUMP $defaultsfile"

to /usr/share/backupninja/mysql and specify my desired settings in the
backup user's ~/.my.cf -- the command line arguments would otherwise
override this file.

However, adding an option to the mysql helper to modify the mysqldump
options is probably a cleaner way. First stab at a patch attached.


Regards,

-- 
      ,''`.
     : :'  :     Chris Lamb
     `. `'`      [EMAIL PROTECTED]
       `-
diff -urNd backupninja-0.9.6.orig/handlers/mysql.helper.in 
backupninja-0.9.6/handlers/mysql.helper.in
--- backupninja-0.9.6.orig/handlers/mysql.helper.in     2008-10-21 
12:03:51.000000000 +0100
+++ backupninja-0.9.6/handlers/mysql.helper.in  2008-10-21 12:26:23.000000000 
+0100
@@ -53,6 +53,9 @@
 }
 
 do_mysql_final() {
+   default_mysqldump_options="--lock-tables --complete-insert --add-drop-table 
--quick --quote-names"
+   sqldumpoptions="$default_mysqldump_options"
+
    if [ -z "$_DISABLE_HOTCOPY" ]; then
       checkBox "$mysql_title" "check options" \
          "sqldump" "create a backup using mysqldump (more compat)." no \
@@ -98,6 +101,10 @@
 # if yes, compress the sqldump output.
 $compress
 
+# mysqldumpoptions = <options> (default = $default_mysqldump_options)
+# arguments to pass to mysqldump
+$mysqldumpoptions
+
 # dbhost      = <host> (default = localhost)
 
 EOF
diff -urNd backupninja-0.9.6.orig/handlers/mysql.in 
backupninja-0.9.6/handlers/mysql.in
--- backupninja-0.9.6.orig/handlers/mysql.in    2008-10-21 12:03:51.000000000 
+0100
+++ backupninja-0.9.6/handlers/mysql.in 2008-10-21 12:10:06.000000000 +0100
@@ -10,6 +10,7 @@
 getconf dbhost localhost
 getconf hotcopy no
 getconf sqldump no
+getconf sqldumpoptions
 getconf compress yes
 getconf vsname
 
@@ -245,7 +246,7 @@
 
        for db in $databases
        do
-           DUMP_BASE="$MYSQLDUMP $defaultsfile --lock-tables --complete-insert 
--add-drop-table --quick --quote-names"
+           DUMP_BASE="$MYSQLDUMP $defaultsfile $sqldumpoptions"
 
            # Dumping structure and data
            DUMP="$DUMP_BASE $ignore $db"

Attachment: signature.asc
Description: PGP signature

Reply via email to