Bug 1181916

Summary: Openshift overwrites data/postgresql.conf during restart, destroying max_prepared_transactions setting
Product: OpenShift Container Platform Reporter: Hooman Broujerdi <hghasemb>
Component: ImageStreamsAssignee: Jason DeTiberus <jdetiber>
Status: CLOSED ERRATA QA Contact: libra bugs <libra-bugs>
Severity: medium Docs Contact:
Priority: high    
Version: 2.1.0CC: bleanhar, cryan, erich, gpei, hghasemb, jokerman, knakayam, libra-onpremise-devel, mmccomas
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: openshift-origin-cartridge-postgresql-1.32.0.1-1 Doc Type: Bug Fix
Doc Text:
Cause: Configuration templates did not account for max_prepared_transactions. Consequence: max_prepared_transactions was not set to the value from OPENSHIFT_POSTGRESQL_MAX_PREPARED_TRANSACTIONS Fix: Configuration templates have been updated to ensure postgres configuration matches the environment variable. Result: If the environment variable OPENSHIFT_POSTGRESQL_MAX_PREPARED_TRANSACTIONS is set the postgres configuration honor that value at restart. If the variable is not set the value will be zero.
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-02-12 13:09:58 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:

Description Hooman Broujerdi 2015-01-14 04:53:43 UTC
+++ This bug was initially created as clone of Bug #1123850 +++

Description of problem:

By default, PostgreSQL database server parameters may be disabled or set to a different value. For example: max_prepared_transactions is set to 0, which disables XA transactions.

According to Bug #1123850 in order to set such parameters this should be feasible by setting an appropriate environment varibale, however this doesn't seem to work.

How reproducible: 

1. Create an application with a postgresql database. 
2. Set an appropriate environment variable : 

[hooman@dhcp-0-201 bug1123850]$ rhc env-set OPENSHIFT_POSTGRESQL_MAX_PREPARED_TRANSACTIONS="100" -a bug1123850
Setting environment variable(s) ... done

3. Restart the application or the database service.
[hooman@dhcp-0-201 bug1123850]$ rhc cartridge restart postgresql-9.2 -a bug1123850
Restarting postgresql-9.2 ... done

Actual results:

Revisiting the postgresql.conf doesn't have the parameter set and the parameter is wiped - this doesn't work either if the parameter is set manually by modifying the data/postgresql.conf and restarting the service. 

NOTE: The above works if the parameters are already exists in the postgresql.conf e.g: 

rhc env-set OPENSHIFT_POSTGRESQL_SHARED_BUFFERS=256 -a bug1123850
Setting environment variable(s) ... done

[hooman@dhcp-0-201 bug1123850]$ rhc cartridge restart postgresql-9.2 -a bug1123850
Restarting postgresql-9.2 ... done

Expected results:

The environment variable for the appropriate parameters have to be set in the data/postgresql.conf.

Comment 7 Gaoyun Pei 2015-01-26 07:56:20 UTC
Verify this bug with openshift-origin-cartridge-postgresql-1.32.0.1-1 on 2.2/2015-01-23.2. Both postgresql-8.4 and postgresql-9.2 work well with the new env var OPENSHIFT_POSTGRESQL_MAX_PREPARED_TRANSACTIONS.


1. Create an app with postgresql-8.4 embedded, check its default max_prepared_transactions settings in 
postgresql/data/postgresql.conf.

[app-123.ose22-manual.com.cn data]\> grep max_prepared_transactions *
postgresql.conf:max_prepared_transactions = 0


2. Set env vars to modify datestyle and locale vars
[root@broker ~]# rhc env-set OPENSHIFT_POSTGRESQL_MAX_PREPARED_TRANSACTIONS=100 -a app
Setting environment variable(s) ... done


3. Restart the postgres cartridge
[root@broker ~]# rhc cartridge restart postgresql -a app
Using postgresql-8.4 (PostgreSQL 8.4) for 'postgresql'
Restarting postgresql-8.4 ... done


4. Check postgresql/data/postgresql.conf again. The env vars setting by user was taking effect

[app-123.ose22-manual.com.cn data]\> grep max_prepared_transactions postgresql.conf 
max_prepared_transactions = 100

Comment 11 errata-xmlrpc 2015-02-12 13:09:58 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.

https://rhn.redhat.com/errata/RHBA-2015-0220.html