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

Bug 1546771

Summary: on failure to upgrade postgresql to 9.5, engine-setup unconditionally removes the 9.5 data directory
Product: [oVirt] ovirt-engine Reporter: Yedidyah Bar David <didi>
Component: Setup.EngineCommonAssignee: Yedidyah Bar David <didi>
Status: CLOSED CURRENTRELEASE QA Contact: Lucie Leistnerova <lleistne>
Severity: high Docs Contact:
Priority: unspecified    
Version: 4.2.0CC: bugs, jbelka, lsvaty, lveyde
Target Milestone: ovirt-4.2.2Flags: rule-engine: ovirt-4.2+
lleistne: testing_plan_complete+
sbonazzo: devel_ack+
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: ovirt-engine-4.2.2.4 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-03-29 11:02:24 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: Integration RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Yedidyah Bar David 2018-02-19 14:56:21 UTC
Description of problem:

If engine-setup upgrades postgresql to 9.5, and fails (currently in the upgrade, but once we fix bug 1492138, can fail anywhere), it removes the new data dir, /var/opt/rh/rh-postgresql95/lib/pgsql/data .

I think that as a minimum, we should check if this directory exists _prior_ to trying to upgrade, and reject upgrade.

Comment 1 Yedidyah Bar David 2018-03-05 09:46:05 UTC
Not sure how I didn't notice this in my testing, but data directory is created by rh-postgresql95-postgresql-server , so need to change the test to make sure it's empty, not missing.

Comment 2 Jiri Belka 2018-03-07 12:52:00 UTC
This should be taken seriously. If 4.1 is installed, we cannot prevent users to have PG 9.5 from SC and using it. Thus if upgrade would fail and remove existing /rh/rh-postgresql95/lib/pgsql/data, it would be serious data loss :)

Of course we do not recommend such setup but we do not prevent it and we even cannot.

Comment 3 Yedidyah Bar David 2018-03-07 13:28:20 UTC
As discussed in private:

If new data dir exists and is not empty, we refuse to upgrade automatically.

If we do upgrade automatically and fail, we remove the junk we put there.

Please verify thoroughly :-)

Comment 4 Lucie Leistnerova 2018-03-21 18:37:24 UTC
Tested on engine+dwh, separate dwh:
1. postgres 9.5 directory is not empty -> engine upgrade fails and directory stays untouched 
2. postgres 9.5 directory exists and is empty, failing upgrade in different states -> directory completely removed (I think that is no problem, it shouldn't make any difference whether the directory is empty or completely missing)
3. postgres 9.5 directory is missing, failing upgrade in different states -> directory still missing

verified in ovirt-engine-dwh-setup-4.2.2.2-1.el7ev.noarch, ovirt-engine-setup-4.2.2.4-0.1.el7.noarch

Comment 5 Sandro Bonazzola 2018-03-29 11:02:24 UTC
This bugzilla is included in oVirt 4.2.2 release, published on March 28th 2018.

Since the problem described in this bug report should be
resolved in oVirt 4.2.2 release, it has been closed with a resolution of CURRENT RELEASE.

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