Eli Mesika has uploaded a new change for review. Change subject: core: using pg_dump --column-inserts ...(#858643) ......................................................................
core: using pg_dump --column-inserts ...(#858643) using pg_dump --column-inserts slows down the restore process Adding additional flag to the backup.sh script -c, if this flag is set then the pg_dump is called with the --column-inserts flag, otherwise not. The default behaviour is to backup without --column-inserts in order to generate COPY statements rather than INSERT statements per table row for easy and efficient restore. Change-Id: Iac6b8a6762868b9535f24cc9c496e11722485885 Signed-off-by: Eli Mesika <[email protected]> --- M backend/manager/dbscripts/backup.sh 1 file changed, 11 insertions(+), 3 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/34/8134/1 diff --git a/backend/manager/dbscripts/backup.sh b/backend/manager/dbscripts/backup.sh index 2a164b9..1ee75f3 100755 --- a/backend/manager/dbscripts/backup.sh +++ b/backend/manager/dbscripts/backup.sh @@ -17,7 +17,7 @@ set_defaults usage() { - printf "Usage: ${ME} [-h] [-s SERVERNAME] [-p PORT] [-d DATABASE] [-l DIR] -u USERNAME [-v] \n" + printf "Usage: ${ME} [-h] [-s SERVERNAME] [-p PORT] [-d DATABASE] [-l DIR] -u USERNAME [-c] [-v] \n" printf "\n" printf "\t-s SERVERNAME - The database servername for the database (def. ${SERVERNAME})\n" printf "\t-p PORT - The database port for the database (def. ${PORT})\n" @@ -25,6 +25,7 @@ printf "\t-u USERNAME - The username for the database.\n" printf "\t-v - Turn on verbosity (WARNING: lots of output)\n" printf "\t-l DIR - Backup file directory. ${DIR}\n" + printf "\t-c - Backup each row as SQL insert statement.\n" printf "\t-h - This help text.\n" printf "\n" printf "for more options please run pg_dump --help" @@ -38,13 +39,14 @@ fi } -while getopts hs:d:u:p:l:f:v option; do +while getopts hs:d:u:p:l:f:cv option; do case $option in s) SERVERNAME=$OPTARG;; p) PORT=$OPTARG;; d) DATABASE=$OPTARG;; u) USERNAME=$OPTARG;; l) DIR=$OPTARG;; + c) COLUMN_INSERTS=true;; v) VERBOSE=true;; h) usage;; esac @@ -62,7 +64,13 @@ file="${DIR}/${file}" fi -cmd="pg_dump -C -E UTF8 --column-inserts --disable-dollar-quoting --disable-triggers --format=p -h ${SERVERNAME} -p ${PORT} -U ${USERNAME} -f ${file} ${DATABASE}" +if [ -n "${COLUMN_INSERTS}" ]; then + cmd="pg_dump -C -E UTF8 --column-inserts --disable-dollar-quoting --disable-triggers --format=p -h ${SERVERNAME} -p ${PORT} -U ${USERNAME} -f ${file} ${DATABASE}" +else + cmd="pg_dump -C -E UTF8 --disable-dollar-quoting --disable-triggers --format=p -h ${SERVERNAME} -p ${PORT} -U ${USERNAME} -f ${file} ${DATABASE}" + +fi + echo "Backup of database $DATABASE to $file started..." if [ -n "${VERBOSE}" ]; then -- To view, visit http://gerrit.ovirt.org/8134 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Iac6b8a6762868b9535f24cc9c496e11722485885 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Eli Mesika <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
