Bug 1047125

Summary: [reports] upgrade: update ownership is slow and fills the log
Product: Red Hat Enterprise Virtualization Manager Reporter: Yedidyah Bar David <didi>
Component: ovirt-engine-reportsAssignee: Yedidyah Bar David <didi>
Status: CLOSED ERRATA QA Contact: Tareq Alayan <talayan>
Severity: medium Docs Contact:
Priority: high    
Version: 3.3.0CC: aberezin, acathrow, adahms, didi, iheim, oschreib, pstehlik, Rhev-m-bugs, talayan, yeylon, ylavi
Target Milestone: ---   
Target Release: 3.3.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: integration
Fixed In Version: IS31 - rhevm-reports-3.3.0-28.el6ev.noarch.rpm Doc Type: Bug Fix
Doc Text:
When upgrading from 3.2 to 3.3 with a local database, ownership of all database objects is changed from 'postgres' to 'engine_reports'. This is done by running the pg_dump command to search for the postgres owner, which can fill up the disk with logs if the database size is large. Furthermore, the SQL commands for changing the ownership are run individually, which can be slow. Now, pg_dump only retrieves only the schema, which is sufficient for this purpose, and all SQL commands are run in a single PSQL command.
Story Points: ---
Clone Of: 1046676 Environment:
Last Closed: 2014-01-21 14:57:21 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1056111    
Attachments:
Description Flags
logs none

Description Yedidyah Bar David 2013-12-29 09:48:58 UTC
+++ This bug was initially created as a clone of Bug #1046676 +++

Description of problem:

On upgrade from 3.2 to 3.3 with a local database, we change the ownership of all db objects from 'postgres' to 'engine_reports'. We do this by running 'pg_dump', searching the output for 'Owner postgres', then create a set of sql commands to change the ownership and run them, each in its own psql command. This has two problems:

1. pg_dump's output also goes to the log, and if the database is large, the log might feel up the disk.
2. Running each command in its own psql is slow

Proposed solution:

1. We should add '-s' to pg_dump to dump only the schema, that's enough for that purpose
2. We should run all the SQL commands in a single psql command.

This is less severe than bz #1046676 because the database in reports is not expected to be large.

Comment 1 Yaniv Lavi 2013-12-29 16:11:13 UTC
So the log will list the table content?
This is a blocker, since passwords will also appear.


Yaniv

Comment 2 Yedidyah Bar David 2013-12-31 10:21:51 UTC
Yes, they appear obfuscated, but I agree it's a blocker.

Comment 4 Tareq Alayan 2014-01-17 09:54:22 UTC
verified on rhevm-reports-3.3.0-28.el6ev.noarch rhevm-dwh-3.3.0-28.el6ev.noarch
see logs attached.
/usr/bin/pg_dump -s rhevmreports

Comment 5 Tareq Alayan 2014-01-17 09:55:39 UTC
Created attachment 851496 [details]
logs

Comment 7 errata-xmlrpc 2014-01-21 14:57:21 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHBA-2014-0035.html