Bug 960760 - Unable to restore from 3.1 LogCollector DB backup file
Summary: Unable to restore from 3.1 LogCollector DB backup file
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Enterprise Virtualization Manager
Classification: Red Hat
Component: ovirt-engine
Version: 3.2.0
Hardware: Unspecified
OS: Unspecified
urgent
unspecified
Target Milestone: ---
: 3.3.0
Assignee: Eli Mesika
QA Contact: Dušan Kajan
URL:
Whiteboard: infra
Depends On: 976337
Blocks: 973275
TreeView+ depends on / blocked
 
Reported: 2013-05-07 21:33 UTC by Eli Mesika
Modified: 2016-02-10 19:35 UTC (History)
10 users (show)

Fixed In Version: is7
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 973275 (view as bug list)
Environment:
Last Closed:
oVirt Team: Infra
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
Restore output (165.86 KB, text/plain)
2013-07-15 07:26 UTC, Ilanit Stein
no flags Details


Links
System ID Private Priority Status Summary Last Updated
oVirt gerrit 15068 0 None None None Never
oVirt gerrit 16904 0 None None None Never

Description Eli Mesika 2013-05-07 21:33:27 UTC
Description of problem:
Unable to restore from 3.1 LogCollector DB backup file

backup files created with LogCollector on 3.1 will fail to restore.
This is due to the fact that LogCollector is using PG pg_dump utility with the TAR format in order to backup the database.
Unfortunately, there is a bug (Tom Lane claims that this is a feature,) that in case that TAR format is used the -c flag of pg_dump is not honoured and will create always DROP statements for all database objects in the generated restore.sql script.
(See 
http://www.postgresql.org/message-id/E1TrqX7-0002qd-4e@wrigleys.postgresql.org)

The DROP statements caused DB errors when attempting to restore the backup by 
1) dropping existing DB
2) re creating a new blank db with teh same name
3) using pg_restore to restore database from the backup file

Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1.create a database backup from LogCollector on 3.1 or use and existing one or use pg_dump with -F t flag to generate this file
2.drop the database using dropdb
3.recreate the database using createdb
4.try to use pg_restore to restore the database from the file in 1)
  
Actual results:
Lots of errors on the DROP statements 

Expected results:

We should be able to restore the database from the LogCollector DB backup file

Additional info:

The only way to resolve that is to create a utility that will 

1) Open the backup TAR file to a directory D
2) Do sed operations on the restore.sql to remove unneeded statements 

After that, the database should be restored with:

psql -U engine -f <D>/restore.sql engine

where <D> is the directory to which the TAR was extracted in 1)

Comment 3 Ilanit Stein 2013-07-15 06:49:26 UTC
Verified on is5:

Comment 4 Ilanit Stein 2013-07-15 07:26:34 UTC
Created attachment 773571 [details]
Restore output

Comment 6 Ilanit Stein 2013-07-16 07:45:22 UTC
Checked on is5, 
Back to assign:
In case that engine is the only database installed, the language plpgsql is removed with the database, and not installed again, by the restore script. 
This fail the restore, and also require to run engine-cleanup\engine-setup in order to connect to the rhevm via GUI.

Comment 7 Eli Mesika 2013-07-23 19:38:38 UTC
fixed in commit: e5acad1

Comment 8 Dušan Kajan 2013-11-22 14:46:55 UTC
everything seems to be fine, use this steps:

[root@dk-rh33 ~]# service ovirt-engine stop
[root@dk-rh33 ~]# pg_dump -F t -U postgres engine >backup.tar
[root@dk-rh33 ~]# dropdb -U postgres engine
[root@dk-rh33 ~]# createdb -U postgres engine
[root@dk-rh33 ~]# pg_restore -d engine -U postgres backup.tar 
[root@dk-rh33 ~]# service ovirt-engine start
database was restored correctly, althoug it gave me this warnings :
pg_restore: WARNING:  column "storage_pool_id" has type "unknown"
DETAIL:  Proceeding with relation creation anyway.
pg_restore: WARNING:  column "storage_pool_name" has type "unknown"
DETAIL:  Proceeding with relation creation anyway.


setting as verified

Comment 9 Itamar Heim 2014-01-21 22:29:14 UTC
Closing - RHEV 3.3 Released

Comment 10 Itamar Heim 2014-01-21 22:29:18 UTC
Closing - RHEV 3.3 Released

Comment 11 Itamar Heim 2014-01-21 22:32:13 UTC
Closing - RHEV 3.3 Released


Note You need to log in before you can comment on or make changes to this bug.