Re: BUG #13612: postgresql94-setup initdb in kickstart fails

From: Allan(dot)Kristensen(at)schneider-electric(dot)com
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Devrim GÜNDÜZ <devrim(at)gunduz(dot)org>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #13612: postgresql94-setup initdb in kickstart fails
Date: 2015-10-27 09:08:26
Message-ID: OF5C73D522.300CF89C-ONC1257EEB.002DC722-C1257EEB.0032360A@schneider-electric.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

> On Fri, Sep 11, 2015 at 08:26:38AM +0200,
Allan(dot)Kristensen(at)schneider-electric(dot)com wrote:
> > lvaro Herrera wrote:
> > > Bruce Momjian wrote:
> > > > On Thu, Sep 10, 2015 at 09:23:45AM -0400, Bruce Momjian wrote:
> > > > > On Thu, Sep 10, 2015 at 04:20:17PM +0300, Devrim Gunduz wrote:
> > > > > >
> > > > > > Hi,
> > > > > >
> > > > > > On Thu, 2015-09-10 at 09:11 -0400, Bruce Momjian wrote:
> > > > > > > Uh, we didn't write or maintain that file.
> > > > > >
> > > > > > It comes with the RPMs.
> > > > > >
> > > > > > Allan, I'll take a look soon.
> > > > >
> > > > > Oh, OK. I wasn't sure if it was something from the RPMs, or
something
> > > > > Red Hat wrote.
> > > >
> > > > FYI, I am getting an email failure from the original poster, so
there
> > > > might not be much point in replying to him:
> > > >
> > > > User allan.kristsensen
(allan(dot)kristsensen(at)schneider-electric(dot)com) not
> > > > listed in Domino Directory
> > >
> > > He mistyped his address in the bug report form. I corrected it
here.
> >
> > Thanks lvaro and sorry about the email address.
> >
> > The rpm in question postgresql94-server-9.4.4-1PGDG.rhel7.x86_64.rpm
downloaded
> > from the http://yum.postgresql.org/9.4/redhat/rhel-7-x86_64/ repo.
>
> Thanks. I would be interested to know how email list subscribers like
> me can determine who the source of the OS-specific script is so we can
> properly route such messsages.
>
> --
> Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
> EnterpriseDB http://enterprisedb.com
>
> + Everyone has their own god. +

I have been using the lines from OP for over a month now and did not find
any issues. What is the process for incorporating it into the next
release?

Here is the diff if that makes life easier.

########### Diff start ###########
--- /usr/pgsql-9.4/bin/postgresql94-setup 2015-06-11
13:19:27.000000000 +0200
+++ /usr/pgsql-9.4/bin/postgresql94-setup.new 2015-10-26
16:05:28.082858681 +0100
@@ -79,32 +79,34 @@
sed 's/^Environment=//' | tr ' ' '\n' |
sed -n 's/^PGDATA=//p' | tail -n 1`
if [ x"$PGDATA" = x ]; then
- echo "failed to find PGDATA setting in ${SERVICE_NAME}.service"
- exit 1
+ # Find the unit file for new version.
+ if [ -f "/etc/systemd/system/${SERVICE_NAME}.service" ]
+ then
+ SERVICE_FILE="/etc/systemd/system/${SERVICE_NAME}.service"
+ elif [ -f "/lib/systemd/system/${SERVICE_NAME}.service" ]
+ then
+ SERVICE_FILE="/lib/systemd/system/${SERVICE_NAME}.service"
+ else
+ echo "Could not find systemd unit file ${SERVICE_NAME}.service"
+ exit 1
+ fi
+
+ # Get data directory from the service file
+ PGDATA=`sed -n 's/Environment=PGDATA=//p' "${SERVICE_FILE}"`
+
+ if [ x"$PGDATA" = x ]; then
+ echo "Failed to find PGDATA setting in ${SERVICE_NAME}.service"
+ exit 1
+ fi
fi

-# Find the unit file for new version.
-if [ -f "/etc/systemd/system/${SERVICE_NAME}.service" ]
-then
- SERVICE_FILE="/etc/systemd/system/${SERVICE_NAME}.service"
-elif [ -f "/lib/systemd/system/${SERVICE_NAME}.service" ]
-then
- SERVICE_FILE="/lib/systemd/system/${SERVICE_NAME}.service"
-else
- echo "Could not find systemd unit file ${SERVICE_NAME}.service"
- exit 1
-fi
+export PGDATA

# Log file for pg_upgrade
PGUPLOG=/var/lib/pgsql/$PGMAJORVERSION/pgupgrade.log
# Log file for initdb
PGLOG=/var/lib/pgsql/9.4/initdb.log

-# Get data directory from the service file
-PGDATA=`sed -n 's/Environment=PGDATA=//p' "${SERVICE_FILE}"`
-
-export PGDATA
-
# For SELinux we need to use 'runuser' not 'su'
if [ -x /sbin/runuser ]
then
########### Diff end ###########

Best regards
Allan Kristensen
_____________________________________________________________________________________

Allan Kristensen | APC by Schneider Electric | IT Business |
Denmark | Configuration Management Administrator
Phone: +45 72190143 | Mobile: +45 20752220
Email: allan(dot)kristensen(at)schneider-electric(dot)com | Site:
www.schneider-electric.dk | Address: Silcon Alle, 6000 Kolding, Denmark

*** Please consider the environment before printing this e-mail ***

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message michael 2015-10-27 09:22:08 BUG #13739: Recurring corrupted page pointer panics on hot-standby replica
Previous Message Tatsuo Ishii 2015-10-27 08:31:25 Re: Re: [BUGS] BUG #13611: test_postmaster_connection failed (Windows, listen_addresses = '0.0.0.0' or '::')