Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 1168139

Summary: restoring cold PostgreSQL dump from 5.6.0 on 5.7.0 restores it to /var/lib/pgsql/data/ (should be /opt/rh/postgresql92/root/var/lib/pgsql/data)
Product: Red Hat Satellite 5 Reporter: Jan Hutař <jhutar>
Component: UpgradesAssignee: Tomáš Kašpárek <tkasparek>
Status: CLOSED CURRENTRELEASE QA Contact: Jan Hutař <jhutar>
Severity: high Docs Contact:
Priority: unspecified    
Version: 570   
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: spacewalk-setup-postgresql-2.3.0-12-sat rhn-upgrade-5.7.0.7-1 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-01-13 10:26:10 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: 1128174    

Description Jan Hutař 2014-11-26 09:13:37 UTC
Description of problem:
Restoring cold PostgreSQL dump from 5.6.0 on 5.7.0 restores it to /var/lib/pgsql/data/ (should be /opt/rh/postgresql92/root/var/lib/pgsql/data)


Version-Release number of selected component (if applicable):
rhn-upgrade-5.7.0.6-1.el5sat
Upgrade from: Satellite 5.6.0 (upgraded from RHN) @ RHEL5 @ embedded PostgreSQL
Upgrade to: Satellite-5.7.0-RHEL6-re20141125.0-x86_64 @ RHEL6 @ embedded PostgreSQL; spacewalk-dobby-2.3.2-20.el6sat.noarch


How reproducible:
always


Steps to Reproduce:
1. Dump data on old 5.6.0 Satellite with `db-control backup /tmp/BACKUP`
2. Transfer /tmp/BACKUP directory to new 5.7.0 Satellite
3. Restore DB from the cold backup on new 5.7.0 Satellite using
   `db-control restore /tmp/BACKUP`


Actual results:
# db-control restore /tmp/BACKUP/
Parsing backup log.
Restoring backup from Wed Nov 26 01:53:42 2014...
  /tmp/BACKUP/pg_subtrans/0001.gz -> /var/lib/pgsql/data/pg_subtrans/0001.tmp... done.  Checksum verified.
[...]
  /tmp/BACKUP/PG_VERSION.gz -> /var/lib/pgsql/data/PG_VERSION.tmp... done.  Checksum verified.
Extraction and verification complete, renaming files... done.
Removing unnecessary files... done.
Restoring empty directories... done.
Restoration complete, you may now start the database.


Expected results:
satellite-and-os-upgrade-postgresql.txt should mention required steps to make this work

Comment 5 Jan Hutař 2014-12-01 12:26:32 UTC
When I'm upgrading OS too (coming from 5.2.0 @ RHEL5 @ embedded Oracle to 5.7.0 @ RHEL6 @ embedded PostgreSQL), I got:


# /usr/bin/spacewalk-upgrade-postgresql
Loaded plugins: product-id, rhnplugin, security, subscription-manager
This system is receiving updates from RHN Classic or RHN Satellite.
Setting up Install Process
beaker-tasks                                | 1.3 kB     00:00     
red-hat-satellite                           | 2.1 kB     00:00 ... 
Resolving Dependencies
--> Running transaction check
---> Package postgresql92-postgresql-upgrade.x86_64 0:9.2.8-2.el6 will be installed
--> Processing Dependency: postgresql-server(x86-64) < 8.5 for package: postgresql92-postgresql-upgrade-9.2.8-2.el6.x86_64
--> Processing Dependency: postgresql-server(x86-64) >= 8.4.0 for package: postgresql92-postgresql-upgrade-9.2.8-2.el6.x86_64
--> Running transaction check
---> Package postgresql-server.x86_64 0:8.4.20-1.el6_5 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=============================================================================================================================================================================================================================================
 Package                                                               Arch                                         Version                                                 Repository                                                  Size
=============================================================================================================================================================================================================================================
Installing:
 postgresql92-postgresql-upgrade                                       x86_64                                       9.2.8-2.el6                                             red-hat-satellite                                           73 k
Installing for dependencies:
 postgresql-server                                                     x86_64                                       8.4.20-1.el6_5                                          rhel-x86_64-server-6                                       3.4 M

Transaction Summary
=============================================================================================================================================================================================================================================
Install       2 Package(s)

Total size: 3.5 M
Total download size: 73 k
Installed size: 120 k
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : postgresql-server-8.4.20-1.el6_5.x86_64                                                                                                                                                                                   1/2 
  Installing : postgresql92-postgresql-upgrade-9.2.8-2.el6.x86_64                                                                                                                                                                        2/2 
  Verifying  : postgresql-server-8.4.20-1.el6_5.x86_64                                                                                                                                                                                   1/2 
  Verifying  : postgresql92-postgresql-upgrade-9.2.8-2.el6.x86_64                                                                                                                                                                        2/2 

Installed:
  postgresql92-postgresql-upgrade.x86_64 0:9.2.8-2.el6                                                                                                                                                                                       

Dependency Installed:
  postgresql-server.x86_64 0:8.4.20-1.el6_5                                                                                                                                                                                                  

Complete!

/var/lib/pgsql/data is missing. Use "service postgresql initdb" to initialize the cluster first.
[FAILED]


and when I do it manually, I get:


# service postgresql initdb
# rhn-satellite stop   # this requirement is not n the docs, but I have added it to bug 1169299 comment #2 (without this, you can not start PG 8.4)
# /usr/bin/spacewalk-upgrade-postgresql
Loaded plugins: product-id, rhnplugin, security, subscription-manager
This system is receiving updates from RHN Classic or RHN Satellite.
Setting up Install Process
red-hat-satellite                                       | 2.1 kB     00:00 ... 
Package postgresql92-postgresql-upgrade-9.2.8-2.el6.x86_64 already installed and latest version
Nothing to do
Starting postgresql service: [  OK  ]
psql: FATAL:  Ident authentication failed for user "rhnuser"

Comment 6 Jan Hutař 2014-12-01 12:28:28 UTC
Forgot to mention that I had spacewalk-setup-postgresql-2.3.0-12.el6sat.noarch

Comment 7 Jan Hutař 2014-12-01 13:21:44 UTC
In comment #5 I was wrong. I was updating from 5.2.0 and that spacewalk-upgrade-postgresql is not meant to be run in such a case.

Anyway with dump from 5.6.0 @ PostgreSQL 8.4 restored, I got:

# /usr/bin/spacewalk-upgrade-postgresql
Loaded plugins: product-id, rhnplugin, security, subscription-manager
This system is receiving updates from RHN Classic or RHN Satellite.
Setting up Install Process
beaker-tasks                                                                                                                                                                                                          | 1.3 kB     00:00     
red-hat-satellite                                                                                                                                                                                                     | 2.1 kB     00:00 ... 
Resolving Dependencies
--> Running transaction check
---> Package postgresql92-postgresql-upgrade.x86_64 0:9.2.8-2.el6 will be installed
--> Processing Dependency: postgresql-server(x86-64) < 8.5 for package: postgresql92-postgresql-upgrade-9.2.8-2.el6.x86_64
--> Processing Dependency: postgresql-server(x86-64) >= 8.4.0 for package: postgresql92-postgresql-upgrade-9.2.8-2.el6.x86_64
--> Running transaction check
---> Package postgresql-server.x86_64 0:8.4.20-1.el6_5 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=============================================================================================================================================================================================================================================
 Package                                                               Arch                                         Version                                                 Repository                                                  Size
=============================================================================================================================================================================================================================================
Installing:
 postgresql92-postgresql-upgrade                                       x86_64                                       9.2.8-2.el6                                             red-hat-satellite                                           73 k
Installing for dependencies:
 postgresql-server                                                     x86_64                                       8.4.20-1.el6_5                                          rhel-x86_64-server-6                                       3.4 M

Transaction Summary
=============================================================================================================================================================================================================================================
Install       2 Package(s)

Total size: 3.5 M
Total download size: 73 k
Installed size: 120 k
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : postgresql-server-8.4.20-1.el6_5.x86_64                                                                                                                                                                                   1/2 
  Installing : postgresql92-postgresql-upgrade-9.2.8-2.el6.x86_64                                                                                                                                                                        2/2 
  Verifying  : postgresql-server-8.4.20-1.el6_5.x86_64                                                                                                                                                                                   1/2 
  Verifying  : postgresql92-postgresql-upgrade-9.2.8-2.el6.x86_64                                                                                                                                                                        2/2 

Installed:
  postgresql92-postgresql-upgrade.x86_64 0:9.2.8-2.el6                                                                                                                                                                                       

Dependency Installed:
  postgresql-server.x86_64 0:8.4.20-1.el6_5                                                                                                                                                                                                  

Complete!
Starting postgresql service: [  OK  ]
psql: FATAL:  no pg_hba.conf entry for host "[local]", user "rhnuser", database "rhnschema", SSL off

Comment 12 Clifford Perry 2015-01-13 10:26:10 UTC
With the release of Red Hat Satellite 5.7 on January 12th 2015 this bug is
being moved to a Closed Current Release state. 

The Satellite 5.7 GA Errata:
 - https://rhn.redhat.com/errata/RHSA-2015-0033.html 

Satellite 5.7 Release Notes:
 -
https://access.redhat.com/documentation/en-US/Red_Hat_Satellite/5.7/html-single/Release_Notes/index.html

Satellite Customer Portal Blog announcement for release:
 - https://access.redhat.com/blogs/1169563/posts/1315743 

Cliff

NOTE: This bug has not been re-verified (moved to RELEASE_PENDING) prior to release. We assume that the bug has indeed been fixed and not regressed since we initially verified it. Please re-open in the future if needed.