Kiril Nesenko has posted comments on this change.

Change subject: [WIP] core: 3.1 backup fix tool.
......................................................................


Patch Set 4: (3 inline comments)

....................................................
File backend/manager/tools/dbutils/backupfixtool.sh
Line 1: #!/bin/bash
can we run it as #!/bin/sh
 ?
Line 2: 
###############################################################################################################
Line 3: # The purpose of this utility is to fix backups done by the log 
collector in version 3.1 in order to use
Line 4: # those backup files to create a 3.1 database before upgrading from 3.1 
to 3.2
Line 5: # the log collector used to backup files in the TAR format, however , 
Postgres has a bug in pg_dump that


Line 56: fi
Line 57: 
Line 58: caution
Line 59: 
Line 60: echo "validating the ${FILE} file type..."
Validating
Line 61: if file "${FILE}" | grep 'tar'; then
Line 62:     echo "Extracting the restore.sql file ..."
Line 63:     tar -xf "${FILE}" restore.sql > /dev/null
Line 64:     if [ $? -ne 0 ]; then


Line 66:         exit 1
Line 67:     fi
Line 68: 
Line 69:     echo "Fixing the restore.sql file..."
Line 70:     sed -i -e '/^DROP /d' -e '/^CREATE SCHEMA/d' -e '/^ALTER TABLE 
ONLY public\./d' -e '/^ALTER FUNCTION public\.uuid_/d' -e '/^CREATE PROCEDURAL 
LANGUAGE plpgsql/d' -e 's/^CREATE FUNCTION uuid_/CREATE OR REPLACE FUNCTION 
uuid_/g' restore.sql
I prefer to use , its nore readable: 
sed -i -e '/^DROP/d' \
             '/^CREATE PROCEDURAL LANGUAGE plpgsql/d' \
              ..... 
               .... restore.sql
Line 71:     echo "Replacing the restore.sql file in original tar file..."
Line 72:     tar -uvf "${FILE}" restore.sql
Line 73:     if [ $? -ne 0 ]; then
Line 74:         echo "Failed to replace fixed restore.sql file in ${FILE}."


-- 
To view, visit http://gerrit.ovirt.org/15068
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Id17f718d5acf7a4df00092875d308f52e6dd7e3f
Gerrit-PatchSet: 4
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Eli Mesika <emes...@redhat.com>
Gerrit-Reviewer: Alex Lourie <alou...@redhat.com>
Gerrit-Reviewer: Eli Mesika <emes...@redhat.com>
Gerrit-Reviewer: Kiril Nesenko <knese...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to