Thread: Problem upgrading PGSQL7.3.2 from PGSQL6.5 under RHLinux6.5 - missing global/pg_control

Hi all

Been trying to get postmaster to run after a PGSQL upgrade from 6.5
to 7.3.2.  (I know, it's a big step!) Below is the transcription of the
steps
I've taken so far to give the complete details.  I'm installing under
/usr/local/pgsql_7.3.2
and my database data dir is on another physical drive under
/mnt/huge/postgresql.
(It's gotta be here since I don't have room on the other drive).

The short version is that everything is fine up until the postmaster phase.
It's really weird.  Firstly, when trying to start postmaser, the PG_VERSION
file did not exist (I created it later, but shouldn't the "gmake install" or
even
the "initdb" have done this already?)  Anyway, I create this file using

"echo "7.3.2" > PG_VERSION

and continue on.  Then, after I create the file, it says it can't find the
global/pg_control
file under my data directory "/mnt/huge/postgresql".  I haven't seen this
structure
before in the old installation, so I'm stumped.  (Again, shouldn't the
creation of these
directories and files be handled by "gmake install" or "initdb"?) I ran
"gmake check"
and it found no errors.  And running postmaster in higher debug mode just
gave this:

DEBUG:  proc_exit(2)
DEBUG:  shmem_exit(2)
DEBUG:  exit(2)

Anyway, below are the details.  Hope you can help since I'd really like to
get
this running soon and continue development...  :)

Take care,
Jason

<snip>

*** AS ROOT ***

- backup the data using pg_dumpall
- shut down postmaster

*many pgsql binaries and dirs scattered around in the default RH
installation,
 so rename them to ensure no versioning conflicts

- renamed /var/lib/pgsql to /var/lib/old_pgsql
- renamed /usr/data to /usr/old_data
- renamed the following old binaries in /usr/bin

-r-xr-xr-x    1 root     root         1956 Feb 12  2000
/usr/bin/old_vacuumdb
-r-xr-xr-x    1 root     root         1803 Feb 12  2000
/usr/bin/old_pg_dumpall
-r-xr-xr-x    1 root     root          251 Feb 12  2000
/usr/bin/old_ipcclean
-r-xr-xr-x    1 root     root         3743 Feb 12  2000
/usr/bin/old_initlocation
-r-xr-xr-x    1 root     root        16980 Feb 12  2000 /usr/bin/old_initdb
-r-xr-xr-x    1 root     root         4411 Feb 12  2000
/usr/bin/old_createuser
-r-xr-xr-x    1 root     root         4051 Feb 12  2000
/usr/bin/old_createlang
-r-xr-xr-x    1 root     root         2393 Feb 12  2000
/usr/bin/old_createdb
-r-xr-xr-x    1 root     root        51344 Feb 12  2000 /usr/bin/old_psql
-r-xr-xr-x    1 root     root      1115120 Feb 12  2000
/usr/bin/old_postgres
-r-xr-xr-x    1 root     root         3700 Feb 12  2000 /usr/bin/old_pg_id
-r-xr-xr-x    1 root     root         3776 Feb 12  2000
/usr/bin/old_pg_encoding
-r-xr-xr-x    1 root     root        52304 Feb 12  2000 /usr/bin/old_pg_dump
-r-xr-xr-x    1 root     root       238320 Feb 12  2000 /usr/bin/old_ecpg

- removed the following symbolic link
lrwxrwxrwx    1 root     root            8 Jan 14  2001
/usr/bin/postmaster -> postgres

******** BUILD AND INSTALLATION ************

# ./configure --prefix=/usr/local/pgsql_7.3.2 --datadir=/mnt/huge/postgresql
# gmake
# gmake install
# ls /mnt/huge/postgresql

conversion_create.sql
pg_hba.conf.sample
pg_ident.conf.sample
postgres.bki
postgres.description
postgresql.conf.sample

# chown postgres /mnt/huge/postgresql
# su - postgres
$ ./bin/initdb -D /mnt/huge/postgresql

FATAL:  data directory /mnt/huge/postgresql has group or world access;
permissions should be u=rwx (0700)

$ ### OK, give it the permissions it requires.
$ chmod 0700 /mnt/huge/postgresql
$ ./bin/initdb -D /mnt/huge/postgresql

The files belonging to this database system will be owned by user
"postgres".
This user must also own the server process.

The database cluster will be initialized with locale en_US.
This locale setting will prevent the use of indexes for pattern matching
operations.  If that is a concern, rerun initdb with the collation order
set to "C".  For more information see the Administrator's Guide.

initdb: The directory /mnt/huge/postgresql/ exists but is not empty.
If you want to create a new database system, either remove or empty
the directory /mnt/huge/postgresql/ or run initdb with
an argument other than /mnt/huge/postgresql/.

$ ./postmaster -D /mnt/huge/postgresql
FATAL:  File /mnt/huge/postgresql/PG_VERSION is missing. This is not a valid
data directory.

$ #### Is this normal?  Where is the PG_VERSION file?  Ok, so create it.
$ echo "7.3.2" > /mnt/huge/postgresql/PG_VERSION

$ ./postmaster -D /mnt/huge/postgresql
./postmaster does not find the database system.
Expected to find it in the PGDATA directory "/mnt/huge/postgresql",
but unable to open file "/mnt/huge/postgresql/global/pg_control": No such
file or directory

$ ### If this is needed, shouldn't have initdb created it?  :(
$ ### try the tests via gmake check
$ gmake check

======================
 All 89 tests passed.
======================

gmake[2]: Leaving directory
`/usr/local/downloads/postgresql-7.3.2/src/test/regress'
gmake[1]: Leaving directory `/usr/local/downloads/postgresql-7.3.2/src/test'

$ ### tests were ok!  What's going on?  try debug info...
$ cd /usr/local/pgsql_7.3.2/bin
$ postmaster -d 2 -D /mnt/huge/postgresql
postmaster does not find the database system.
Expected to find it in the PGDATA directory "/mnt/huge/postgresql",
but unable to open file "/mnt/huge/postgresql/global/pg_control": No such
file or directory

DEBUG:  proc_exit(2)
DEBUG:  shmem_exit(2)
DEBUG:  exit(2)

<snip>


Re: Problem upgrading PGSQL7.3.2 from PGSQL6.5 under RHLinux6.5

From
Stephan Szabo
Date:
On Sun, 11 May 2003, Jason Kosowan wrote:

> # ./configure --prefix=/usr/local/pgsql_7.3.2 --datadir=/mnt/huge/postgresql

  --datadir=DIR           read-only architecture-independent data in DIR
                          [PREFIX/share]

> $ ./bin/initdb -D /mnt/huge/postgresql
>
> The files belonging to this database system will be owned by user
> "postgres".
> This user must also own the server process.
>
> The database cluster will be initialized with locale en_US.
> This locale setting will prevent the use of indexes for pattern matching
> operations.  If that is a concern, rerun initdb with the collation order
> set to "C".  For more information see the Administrator's Guide.
>
> initdb: The directory /mnt/huge/postgresql/ exists but is not empty.
> If you want to create a new database system, either remove or empty
> the directory /mnt/huge/postgresql/ or run initdb with
> an argument other than /mnt/huge/postgresql/.

See the above.  Most of the rest of this is due to the fact that initdb
didn't run. The --datadir isn't the database structure directory.



"Jason Kosowan" <jasonkosowan@yahoo.com> writes:
> Been trying to get postmaster to run after a PGSQL upgrade from 6.5
> to 7.3.2.  (I know, it's a big step!) Below is the transcription of the
> steps

You failed to run initdb.  Note the complaint:

> initdb: The directory /mnt/huge/postgresql/ exists but is not empty.
> If you want to create a new database system, either remove or empty
> the directory /mnt/huge/postgresql/ or run initdb with
> an argument other than /mnt/huge/postgresql/.

This is a safety precaution to keep people from initdb'ing over an
existing installation ...

            regards, tom lane