Re: pg_upgrade + Extensions

From: Smitha Pamujula <smitha(dot)pamujula(at)iovation(dot)com>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: "David E(dot) Wheeler" <david(at)justatheory(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Grant Holly <grant(dot)holly(at)iovation(dot)com>
Subject: Re: pg_upgrade + Extensions
Date: 2015-07-14 16:48:59
Message-ID: CAGWGGXNNJ5J4kp2UWXedZ5+kkfZ95+vvtxY2A216geNhLxLQ=Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Jul 13, 2015 at 11:56 AM, Andrew Dunstan <andrew(at)dunslane(dot)net>
wrote:

>
> On 07/13/2015 01:12 PM, Smitha Pamujula wrote:
>
>> Yes. I have checked that the extension didn't exist in any of the
>> databases. I used \dx to see if there was json_build was listed and i didnt
>> see any. Is that sufficient to check its existence. I am about to do
>> another testing in a few minutes on a different machine. I will capture
>> before/after shots
>>
>>
>>
> Please don't top-post on the PostgreSQL lists - see <
> http://idallen.com/topposting.html>
>
> In theory it should be enough if it was installed in the standard way. But
> a more thorough procedure would be to run this command:
>
> select count(*)
> from pg_proc
> where prosrc ~ 'json_build';
>
> Here's a one-liner that will check every database for you:
>
> for db in `psql -t -c 'select datname from pg_database where
> datallowconn'` ; do C=`psql -t -c "select count(*) from pg_proc
> where prosrc ~ 'json_build'" $db`; echo $db $C; done
>
> cheers
>
> andrew
>

K i have tested it on our db. Sorry for the long mail, most of it is just
output from the commands. My comments are in blue.

Pre-upgrade:

psql -l
List of databases
Name | Owner | Encoding | Collate | Ctype |
Access privileges-----------+----------+----------+-------------+-------------+--------------------------
postgres | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
reporting | sqitch | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
=Tc/sqitch +
| | | | |
sqitch=CTc/sqitch +
| | | | |
owner_gulper=C/sqitch +
| | | | |
owner_reporting=C/sqitch
template0 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
=c/postgres +
| | | | |
postgres=CTc/postgres
template1 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
=c/postgres +
| | | | |
postgres=CTc/postgres

Removed the json_build extension from 9.3 database. Verified here:

for db in `psql -t -c 'select datname from pg_database where>
datallowconn'` ; do C=`psql -t -c "select count(*) from pg_proc>
where prosrc ~ 'json_build'" $db`; echo $db $C; donetemplate1
0postgres 0reporting 0

Then I installed the pg 9.4 and started the empty instance.

psql -d postgres
psql (9.3.5, server 9.4.4)WARNING: psql major version 9.3, server
major version 9.4.
Some psql features might not work.
Type "help" for help.

postgres=# \l
List of databases
Name | Owner | Encoding | Collate | Ctype |
Access privileges-----------+----------+----------+-------------+-------------+-----------------------
postgres | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
template0 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
=c/postgres +
| | | | |
postgres=CTc/postgres
template1 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
=c/postgres +
| | | | |
postgres=CTc/postgres

Now I ran the same extension check on the 94.

for db in `psql -t -c 'select datname from pg_database where>
datallowconn'` ; do C=`psql -t -c "select count(*) from pg_proc>
where prosrc ~ 'json_build'" $db`; echo $db $C; donetemplate1
4postgres 4

I see that its got the new procs as part of the 94. Now if i do the
check link its giving me this error.

[postgres(at)pdxqarptsrd04 pg_94_upgrade]$ /usr/pgsql-9.4/bin/pg_upgrade
--check --link
Performing Consistency Checks
-----------------------------
Checking cluster versions ok
Checking database user is a superuser ok
Checking database connection settings ok
Checking for prepared transactions ok
Checking for reg* system OID user data types ok
Checking for contrib/isn with bigint-passing mismatch ok
Checking for invalid "line" user columns ok
Checking for presence of required libraries fatal

Your installation references loadable libraries that are missing from the
new installation. You can add these libraries to the new installation,
or remove the functions using them from the old installation. A list of
problem libraries is in the file:
loadable_libraries.txt

Failure, exiting
[postgres(at)pdxqarptsrd04 pg_94_upgrade]$ cat loadable_libraries.txt
Could not load library "$libdir/json_build"
ERROR: could not access file "$libdir/json_build": No such file or directory

[postgres(at)pdxqarptsrd04 pg_94_upgrade]$ rpm -qa|grep json_build
json_build93-1.0.0-1iov.x86_64

This error will go away only if I install the new json_build94.

[postgres(at)pdxqarptsrd04 pg_94_upgrade]$ rpm -qa|grep json_build
json_build94-1.0.0-1iov.x86_64
json_build93-1.0.0-1iov.x86_64

[postgres(at)pdxqarptsrd04 pg_94_upgrade]$ /usr/pgsql-9.4/bin/pg_upgrade
--check --link
Performing Consistency Checks
-----------------------------
Checking cluster versions ok
Checking database user is a superuser ok
Checking database connection settings ok
Checking for prepared transactions ok
Checking for reg* system OID user data types ok
Checking for contrib/isn with bigint-passing mismatch ok
Checking for invalid "line" user columns ok
Checking for presence of required libraries ok
Checking database user is a superuser ok
Checking for prepared transactions ok

*Clusters are compatible*

I was under the impression that we dont need to get the json_build
libraries for 94. But the upgrade wont go forward without that. Are we
missing doing something here or is it necessarty to get json_build94
before upgrade.

Thanks

Smitha

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2015-07-14 16:51:46 Re: WIP: Enhanced ALTER OPERATOR
Previous Message Thom Brown 2015-07-14 16:33:13 Re: Support retrieving value from any sequence