Re: pg_upgrade & tablespaces - Mailing list pgsql-general

From Joseph Kregloh
Subject Re: pg_upgrade & tablespaces
Date
Msg-id CAAW2xferCZkJi6BOo1DJXFvqTS+vfy6y+qK8KTZM7Ob_JMbzTA@mail.gmail.com
Whole thread Raw
In response to Re: pg_upgrade & tablespaces  (Adrian Klaver <adrian.klaver@gmail.com>)
Responses Re: pg_upgrade & tablespaces  (Adrian Klaver <adrian.klaver@gmail.com>)
List pgsql-general

So was your latest attempt where you ended up with a doubled data/ in the two or one jail scenario?


The two jails scenario. The two jail scenario is the same as the mounted scenario.

Can we see a directory listing for that case?

You say in the single jail case you got the same results. Which would that be the failure, the double data/ or both ?



Let's break this down between the two cases.

Case A:
pg_upgrade -b /home/jkregloh/pg_bin/ -B /usr/local/bin/ -d /home/jkregloh/pg_data/data -D /usr/local/pgsql/data/ -p 5452 -P 5451

[root@postgres-93-upgrade /usr/local/pgsql/data/drupal_dbspace]# ls -la
drwx------   3 pgsql  pgsql   3 Dec 19 20:18 PG_9.3_201306121

[root@postgres-93-upgrade /usr/local/pgsql/data/drupal_dbspace]# ls -la /home/jkregloh/pg_data/data/drupal_dbspace/
drwx------   4 pgsql  pgsql   4 Oct 20  2011 PG_9.0_201008051

Case B:
pg_upgrade -b /home/jkregloh/pg_bin/ -B /usr/local/bin/ -D /usr/local/pgsql_93/data -d /usr/local/pgsql/data/ -P 5452 -p 5451

[pgsql@postgres-93-upgrade /usr/local/pgsql_93/data/drupal_dbspace]$ ls -la /usr/local/pgsql/data/drupal_dbspace/
drwx------   4 pgsql  pgsql   4 Oct 20  2011 PG_9.0_201008051
drwx------   3 pgsql  pgsql   3 Dec 20 16:44 PG_9.3_201306121

[pgsql@postgres-93-upgrade /usr/local/pgsql_93/data/drupal_dbspace]$ ls -la /usr/local/pgsql_93/data/drupal_dbspace/                                                   
drwxr-xr-x   2 pgsql  pgsql   2 Dec 20 16:43 .

So it did the changes in the /usr/local/pgsql/data dir. Which contains the 9.0 install. pg_upgrade was almost successful, some stuff it did not do as I will show at the end of this email.

It created the symlinks for the 9.3 folders:
[pgsql@postgres-93-upgrade /usr/local/pgsql_93/data/drupal_dbspace]$ ls -la /usr/local/pgsql_93/data/pg_tblspc/
lrwx------   1 pgsql  pgsql  36 Dec 20 16:44 16452 -> /usr/local/pgsql/data/drupal_dbspace

When I start Postgres 9.3:
[pgsql@postgres-93-upgrade /usr/local/pgsql_93/data/drupal_dbspace]$ /usr/local/bin/postgres -D /usr/local/pgsql_93/data

I am able to connect to the server however running a simple query I get:
ERROR:  relation "sys_errors" does not exist
LINE 1: SELECT * FROM sys_errors ORDER BY created_ts DESC LIMIT 100;
                      ^
********** Error **********

ERROR: relation "sys_errors" does not exist
SQL state: 42P01
Character: 15

Below is the output of the execution of Case B:

[pgsql@postgres-93-upgrade /tmp]$ pg_upgrade -b /home/jkregloh/pg_bin/ -B /usr/local/bin/ -D /usr/local/pgsql_93/data -d /usr/local/pgsql/data/ -P 5452 -p 5451
Performing Consistency Checks
-----------------------------
Checking cluster versions                                   ok
Checking database user is a superuser                       ok
Checking for prepared transactions                          ok
Checking for reg* system OID user data types                ok
Checking for contrib/isn with bigint-passing mismatch       ok
Creating dump of global objects                             ok
Creating dump of database schemas
                                                            ok
Checking for presence of required libraries                 ok
Checking database user is a superuser                       ok
Checking for prepared transactions                          ok

If pg_upgrade fails after this point, you must re-initdb the
new cluster before continuing.

Performing Upgrade
------------------
Analyzing all rows in the new cluster                       ok
Freezing all rows on the new cluster                        ok
Deleting files from new pg_clog                             ok
Copying old pg_clog to new server                           ok
Setting next transaction ID for new cluster                 ok
Setting oldest multixact ID on new cluster                  ok
Resetting WAL archives                                      ok
Setting frozenxid counters in new cluster                   ok
Restoring global objects in the new cluster                 ok
Adding support functions to new cluster                     ok
Restoring database schemas in the new cluster
                                                            ok
Removing support functions from new cluster                 ok
Copying user relation files
                                                            ok 
Setting next OID for new cluster                            ok
Sync data directory to disk                                 ok
Creating script to analyze new cluster                      ok

Upgrade Complete
----------------
Optimizer statistics are not transferred by pg_upgrade so,
once you start the new server, consider running:
    analyze_new_cluster.sh

Could not create a script to delete the old cluster's data
files because user-defined tablespaces exist in the old cluster
directory.  The old cluster's contents must be deleted manually.
[pgsql@postgres-93-upgrade /tmp]$

pgsql-general by date:

Previous
From: Jeff Janes
Date:
Subject: Re: pg_upgrade & tablespaces
Next
From: "Anand Kumar, Karthik"
Date:
Subject: Re: Best way to sync possibly corrupted data?