Eli Mesika has uploaded a new change for review.

Change subject: core: Database restore script complains about ...
......................................................................

core: Database restore script complains about ...

Database restore script complains about existing entries and fails horribly

This patch fixes a bug when restoring an existing DB.
The problem was that "Drop Database" command was used while it was
executed from the active database, it caused the drop to fail since some
objects were locked and the restore  generated lots of error while
trying to create duplicate objects.
Solution is to use the built-in dropdb function instead the "Drop
Database" SQL statement.

Change-Id: I636f269e1f6094e7fc7f55ab7fddacf6a33926ba
Signed-off-by: Eli Mesika <[email protected]>
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=910748
---
M backend/manager/dbscripts/restore.sh
1 file changed, 1 insertion(+), 2 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/46/12146/1

diff --git a/backend/manager/dbscripts/restore.sh 
b/backend/manager/dbscripts/restore.sh
index 94ad242..29834d0 100755
--- a/backend/manager/dbscripts/restore.sh
+++ b/backend/manager/dbscripts/restore.sh
@@ -63,8 +63,7 @@
         echo "Database ${DATABASE} exists, please use -r to force removing it."
         exit 1
     else
-        cmd="drop database ${DATABASE};"
-        echo ${cmd} | psql  -h ${SERVERNAME} -p ${PORT} -U ${USERNAME}
+        dropdb  -h ${SERVERNAME} -p ${PORT} -U ${USERNAME} ${DATABASE}
     fi
 fi
 


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I636f269e1f6094e7fc7f55ab7fddacf6a33926ba
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

Reply via email to