Bug 1182044 - rare fail when upgrading managed db: psql: FATAL: the database system is starting up
Summary: rare fail when upgrading managed db: psql: FATAL: the database system is sta...
Keywords:
Status: CLOSED DEFERRED
Alias: None
Product: Red Hat Satellite 5
Classification: Red Hat
Component: Upgrades
Version: 570
Hardware: Unspecified
OS: Unspecified
unspecified
low
Target Milestone: ---
Assignee: Tomáš Kašpárek
QA Contact: Red Hat Satellite QA List
URL:
Whiteboard:
Depends On:
Blocks: sat570-triage
TreeView+ depends on / blocked
 
Reported: 2015-01-14 10:54 UTC by Jan Hutař
Modified: 2018-04-10 08:37 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 1217317 (view as bug list)
Environment:
Last Closed: 2018-04-10 08:37:41 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Jan Hutař 2015-01-14 10:54:04 UTC
Description of problem:
Rarely when you are doing `./install.pl --upgrade --managed-db` it might fail.


Version-Release number of selected component (if applicable):
Satellite-5.7.0-RHEL6-re20150108.2-x86_64


How reproducible:
rarely (seen once and done about 10 runs of the command)


Steps to Reproduce:
1. # /mnt/tmp/install.pl --upgrade --managed-db


Actual results:
# /mnt/tmp/install.pl --upgrade --managed-db
* Starting Red Hat Satellite installer.
* Performing pre-install checks.
* Pre-install checks complete.  Beginning installation.
* RHN Registration.
** Registration: System is already registered with RHN.  Not re-registering.
* Upgrading managed DB packages.
*** Upgrading embedded database.
There was a problem during embedded database upgrade.
  Exit value: 2.
Please examine /var/log/rhn/rhn_installation.log for more information.
# tail /var/log/rhn/rhn_installation.log
Running Transaction
  Installing : postgresql92-postgresql-upgrade-9.2.8-2.el6.x86_64           1/1 
  Verifying  : postgresql92-postgresql-upgrade-9.2.8-2.el6.x86_64           1/1 

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

Complete!
Starting postgresql service: [  OK  ]
psql: FATAL:  the database system is starting up


When I have re-ran /usr/bin/spacewalk-upgrade-postgresql manually, upgrade passed.


Expected results:
Should work


Additional info:
This is a code-path:

### /mnt/tmp/install.pl:
[...]
if ($opts{"upgrade"} and $opts{"managed-db"}) {
  install_satellite_repo(\%opts);
  print loc("* Upgrading managed DB packages.\n");
  install_embedded_postgresql(\%opts);
  Spacewalk::Setup::postgresql_upgrade_embedded_db();
  print loc("* Managed DB instance was successfully upgraded.\n");
  exit 0;
}
[...]

### /mnt/tmp/install/lib/Spacewalk/Setup.pm:
[...]
sub postgresql_upgrade_embedded_db {
    print loc("*** Upgrading embedded database.\n");
    system_or_exit(['/usr/bin/spacewalk-upgrade-postgresql', ''], 1, "There was a problem during embedded database upgrade.\n");
    return 0;
}
[...]

### /usr/bin/spacewalk-upgrade-postgresql:
[...]
service postgresql start
DB_TIMEZONE=$(echo "show timezone;" | psql -U $DB_USER -d $DB_NAME -h localhost | sed -n 3p | sed 's/ //g')
LOG_TIMEZONE=$(echo "show log_timezone;" | psql -U $DB_USER -d $DB_NAME -h localhost | sed -n 3p | sed 's/ //g')
service postgresql stop
[...]

So looks like we are trying to stop PostgreSQL 8.4 right after we have started and we are not checking result of the commands betweet that start and stop so its results can be empty or something.

Comment 1 Jan Hutař 2015-02-04 05:48:23 UTC
Reported bug 1188942, which might be relevant.

Comment 2 Jan Hutař 2015-04-30 06:00:54 UTC
Pavel Raiskup mentioned PostgreSQL initscript configuration option which can achieve that. Problem is that it appears in rh-postgresql94 from RHSCL-2.0: bug 1188942 comment #3

Comment 3 Tomas Lestach 2018-04-10 08:37:41 UTC
We have re-reviewed this bug, as part of an ongoing effort to improve Satellite/Proxy feature and bug updates, review and backlog.

This is a low priority bug and has no currently open customer cases. While this bug may still valid, we do not see it being implemented prior to the EOL of the Satellite 5.x product. As such, this is being CLOSED DEFERRED.


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