Re: problem with maintenance script and missing pg_clog files with pg 7.2.1 - Mailing list pgsql-general

From Ben Roberts
Subject Re: problem with maintenance script and missing pg_clog files with pg 7.2.1
Date
Msg-id 20020925101859.GO11482@runtime-collective.com
Whole thread Raw
In response to Re: problem with maintenance script and missing pg_clog files with pg 7.2.1  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: problem with maintenance script and missing pg_clog files with pg 7.2.1  (Martijn van Oosterhout <kleptog@svana.org>)
Re: problem with maintenance script and missing pg_clog  (Oliver Elphick <olly@lfix.co.uk>)
List pgsql-general
Ben Roberts benroberts@runtime-collective.com said:

Tom, Martijn,

Oh dear, I feel this problem is related to us having not correctly
implemented the move to a new data directory.

I think the problem here is in postmaster.conf:

ns1:/etc/postgresql# cat postmaster.conf
# /etc/postgresql/postmaster.conf
#
# Copyright (c) Oliver Elphick 1997, 2001
# Part of the Debian package, postgresql. The Debian packaging is
# licensed under GPL v.2

<snip>

POSTGRES_HOME=`getent passwd postgres | awk -F: '{print $6}' | head -1`
if [ -z "$POSTGRES_HOME" ]
then
    POSTGRES_HOME=/var/lib/postgres
fi

# Where to find the PostgreSQL database files, including those that
# define PostgresSQL users and permissions.
POSTGRES_DATA=/2/var/lib/postgres/data

<snip>

As you can see postmaster looks for the value of POSTGRES_HOME directory in
/etc/passwd and if not found it defaults to the value of
/var/lib/postgres. Unfortunately the relevant entry in /etc/passwd is:

postgres:x:31:32:postgres:/var/lib/postgres:/bin/sh

                          ^^^^^^^^^^^^^^^^^
Instead of /2/var/lib/postgres.

ho hum....we seem to have forgotten to change the postgres home directory
when we made the move to the new disk. Possibly postgres is using the value
of POSTGRES_HOME for some things and POSTGRES_DATA for others, causing the
problems we are seeing?

It's not 100% certain that this is the cause of the problem, but it looks
very much like the smoking gun to me.

Or is just 'OK' to have separate directories for POSTGRES_HOME and
POSTGRES_DATA?

thanks,

Ben

pgsql-general by date:

Previous
From: Ben Roberts
Date:
Subject: Re: problem with maintenance script and missing pg_clog files with pg 7.2.1
Next
From: Martijn van Oosterhout
Date:
Subject: Re: problem with maintenance script and missing pg_clog files with pg 7.2.1