Skip to content
Snippets Groups Projects
Commit b5130c49 authored by micah's avatar micah :speech_balloon:
Browse files

Added in-line compression to pgsql and mysql handlers, appears to work fine in tests

parent 489e294c
Branches
Tags
No related merge requests found
...@@ -15,11 +15,13 @@ version 0.9.4 -- unreleased ...@@ -15,11 +15,13 @@ version 0.9.4 -- unreleased
. Fixed erroneous removal of tmpfile when it didn't exit . Fixed erroneous removal of tmpfile when it didn't exit
. Fixed inversed vsname emptiness check . Fixed inversed vsname emptiness check
. Fixed su quote usage to be more posixy . Fixed su quote usage to be more posixy
. compress for sqldumps now happens in-line to save some disk space (Closes: #370778)
pgsql: pgsql:
. Fixed inversed vsname emptiness check . Fixed inversed vsname emptiness check
. Fixed su quote usage to be more posixy . Fixed su quote usage to be more posixy
. Fixed shell expansion, thanks Thomas Kotzian (Closes: #363297) . Fixed shell expansion, thanks Thomas Kotzian (Closes: #363297)
. postgres user UID is now the one from inside the vserver if necessary . postgres user UID is now the one from inside the vserver if necessary
. compress now happens in-line to save some disk space (Closes: #370778)
svn: svn:
. Fixed inversed vsname emptiness check . Fixed inversed vsname emptiness check
rdiff: rdiff:
......
...@@ -249,9 +249,17 @@ fi ...@@ -249,9 +249,17 @@ fi
do do
if [ $usevserver = yes ] if [ $usevserver = yes ]
then then
execstr="$VSERVER $vsname exec $MYSQLDUMP $defaultsfile --lock-tables --complete-insert --add-drop-table --quick --quote-names $ignore $db > $vroot$dumpdir/${db}.sql" if [ "$compress" == "yes" ]; then
execstr="$VSERVER $vsname exec $MYSQLDUMP $defaultsfile --lock-tables --complete-insert --add-drop-table --quick --quote-names $ignore $db | $GZIP > $vroot$dumpdir/${db}.sql.gz"
else
execstr="$VSERVER $vsname exec $MYSQLDUMP $defaultsfile --lock-tables --complete-insert --add-drop-table --quick --quote-names $ignore $db > $vroot$dumpdir/${db}.sql"
fi
else else
execstr="$MYSQLDUMP $defaultsfile --lock-tables --complete-insert --add-drop-table --quick --quote-names $ignore $db > $dumpdir/${db}.sql" if [ "$compress" == "yes" ]; then
execstr="$MYSQLDUMP $defaultsfile --lock-tables --complete-insert --add-drop-table --quick --quote-names $ignore $db | $GZIP > $dumpdir/${db}.sql.gz"
else
execstr="$MYSQLDUMP $defaultsfile --lock-tables --complete-insert --add-drop-table --quick --quote-names $ignore $db > $dumpdir/${db}.sql"
fi
fi fi
debug "su $user -c \"$execstr\"" debug "su $user -c \"$execstr\""
if [ ! $test ] if [ ! $test ]
...@@ -268,13 +276,6 @@ fi ...@@ -268,13 +276,6 @@ fi
fi fi
fi fi
done done
if [ "$compress" == "yes" ]
then
output=`$GZIP -f $vroot$dumpdir/*.sql 2>&1`
debug $output
fi
fi
# clean up tmp config file # clean up tmp config file
if [ "$dbusername" != "" -a "$dbpassword" != "" ] if [ "$dbusername" != "" -a "$dbpassword" != "" ]
......
...@@ -76,9 +76,17 @@ chmod 700 $vroot$backupdir ...@@ -76,9 +76,17 @@ chmod 700 $vroot$backupdir
# if $databases = all, use pg_dumpall # if $databases = all, use pg_dumpall
if [ "$databases" == "all" ]; then if [ "$databases" == "all" ]; then
if [ $usevserver = yes ]; then if [ $usevserver = yes ]; then
execstr="$VSERVER $vsname exec su - postgres -c \"$PGSQLDUMPALL > $backupdir/${vsname}.sql\"" if [ "$compress" == "yes" ]; then
execstr="$VSERVER $vsname exec su - postgres -c \"$PGSQLDUMPALL | $GZIP > $backupdir/${vsname}.sql.gz\""
else
execstr="$VSERVER $vsname exec su - postgres -c \"$PGSQLDUMPALL > $backupdir/${vsname}.sql\""
fi
else else
if [ "$compress" == "yes" ]; then
execstr="su - postgres -c \"$PGSQLDUMPALL | $GZIP > $backupdir/${localhost}-all.sql.gz\""
else
execstr="su - postgres -c \"$PGSQLDUMPALL > $backupdir/${localhost}-all.sql\"" execstr="su - postgres -c \"$PGSQLDUMPALL > $backupdir/${localhost}-all.sql\""
fi
fi fi
debug "$execstr" debug "$execstr"
if [ ! $test ]; then if [ ! $test ]; then
...@@ -96,11 +104,18 @@ if [ "$databases" == "all" ]; then ...@@ -96,11 +104,18 @@ if [ "$databases" == "all" ]; then
# else use pg_dump on each specified database # else use pg_dump on each specified database
else else
for db in $databases; do for db in $databases; do
if [ $usevserver = yes ] if [ $usevserver = yes ]; then
then if [ "$compress" == "yes" ]; then
execstr="$VSERVER $vsname exec su - postgres -c \"$PGSQLDUMP $db > $backupdir/${db}.sql\"" execstr="$VSERVER $vsname exec su - postgres -c \"$PGSQLDUMP $db | $GZIP > $backupdir/${db}.sql.gz\""
else
execstr="$VSERVER $vsname exec su - postgres -c \"$PGSQLDUMP $db | > $backupdir/${db}.sql\""
fi
else else
execstr="su - postgres -c \"$PGSQLDUMP $db > $backupdir/${db}.sql\"" if [ "$compress" == "yes" ]; then
execstr="su - postgres -c \"$PGSQLDUMP $db | $GZIP > $backupdir/${db}.sql.gz\""
else
execstr="su - postgres -c \"$PGSQLDUMP $db > $backupdir/${db}.sql\""
fi
fi fi
debug "$execstr" debug "$execstr"
if [ ! $test ]; then if [ ! $test ]; then
...@@ -117,10 +132,5 @@ else ...@@ -117,10 +132,5 @@ else
done done
fi fi
if [ "$compress" == "yes" ]; then
output=`$GZIP -f $vroot$backupdir/*.sql 2>&1`
debug $output
fi
return 0 return 0
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment