Re: Finding database for pg_upgrade missing library - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: Finding database for pg_upgrade missing library
Date
Msg-id 20180716121321.GA12341@momjian.us
Whole thread Raw
In response to Re: Finding database for pg_upgrade missing library  (Daniel Gustafsson <daniel@yesql.se>)
Responses Re: Finding database for pg_upgrade missing library
List pgsql-hackers
On Sat, Jul 14, 2018 at 12:14:51AM +0200, Daniel Gustafsson wrote:
> > On 13 Jul 2018, at 18:28, Bruce Momjian <bruce@momjian.us> wrote:
> > 
> > I received a private pg_upgrade feature request to report the database
> > name for missing loadable libraries.  Currently we report "could not
> > load library" and the library file name, e.g. $libdir/pgpool-regclass.
> > 
> > The request is that we report the _database_ name that contained the
> > loadable library reference.  However, that isn't easy to do because we
> > gather all loadable library file names, sort them, and remove
> > duplicates, for reasons of efficiency and so we check libraries in a
> > predictable alphabetical order.
> > 
> > Is it worth modifying pg_upgrade to report the first or all databases
> > that contain references to missing loadable libraries?  I don't think
> > so, but I wanted to ask here.
> 
> I ran into that very problem when upgrading 50+ clusters during a long night a
> while back, and patched pg_upgrade to report the database which helped a lot
> (or at least helped me be a bit lazy).  So, +1 on the feature from me.  If
> there is interest I can see if I can dig out the patch and polish it up.

Yes, please post the patch.  Seems we now have three people who want
this.  Even though it is related to reporting errors, I think this is a
new feature so will only be in PG 12.

Looking at the code, we do a qsort(), then detect (since they are all
now adjacent) and remove the duplicate references to the library.  What
I think should be done is to move the duplicate detection down to the
place where we check for the library, then print all the database names
of the duplicates if we don't find the library.  I guess we either need
a separate array for the database name, or a 'struct' that holds the
library name and database name.

-- 
  Bruce Momjian  <bruce@momjian.us>        http://momjian.us
  EnterpriseDB                             http://enterprisedb.com

+ As you are, so once was I.  As I am, so you will be. +
+                      Ancient Roman grave inscription +


pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: [HACKERS] PoC plpgsql - possibility to force custom or genericplan
Next
From: Tomas Vondra
Date:
Subject: Re: [HACKERS] PATCH: multivariate histograms and MCV lists