Re: fix for pg_upgrade - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: fix for pg_upgrade
Date
Msg-id 201109290314.p8T3EBd21746@momjian.us
Whole thread Raw
In response to Re: fix for pg_upgrade  (Alvaro Herrera <alvherre@commandprompt.com>)
Responses Re: fix for pg_upgrade
List pgsql-hackers
Alvaro Herrera wrote:
>
> Excerpts from Bruce Momjian's message of mié sep 28 13:48:28 -0300 2011:
> > Bruce Momjian wrote:
> > > OK, so it fails for all tables and you are using the newest version.
> > > Thanks for all your work.  I am now guessing that pg_upgrade 9.1.X is
> > > just broken on Windows.
> > >
> > > Perhaps the variables set by pg_upgrade_support.so are not being passed
> > > into the server variables?  I know pg_upgrade 9.0.X worked on Windows
> > > because EnterpriseDB did extensive testing recently on this.   Has
> > > anyone used pg_upgrade 9.1.X on Windows?
> >
> > OK, I have a new theory.  postmaster.c processes the -b
> > (binary-upgrade) flag by setting a C variable:
> >
> >             case 'b':
> >                 /* Undocumented flag used for binary upgrades */
> >                 IsBinaryUpgrade = true;
> >                 break;
> >
> > I am now wondering if this variable is not being passed down to the
> > sessions during Win32's EXEC_BACKEND.  Looking at the other postmaster
> > settings, these set GUC variables, which I assume are passed down.  Can
> > someone confirm this?
>
> Well, you could compile it with -DEXEC_BACKEND to test it for yourself.
>
> >  How should this be fixed?
>
> Maybe it should be part of struct BackendParameters.

Thanks.  That's what I did, and tested the failure with -DEXEC_BACKEND,
and the fix with the patch, which is attached.  I am confident this will
fix Windows as well.

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

  + It's impossible for everything to be true. +
diff --git a/src/backend/postmaster/postmaster.c b/src/backend/postmaster/postmaster.c
new file mode 100644
index 94b57fa..0a84d97
*** a/src/backend/postmaster/postmaster.c
--- b/src/backend/postmaster/postmaster.c
*************** typedef struct
*** 433,438 ****
--- 433,439 ----
      TimestampTz PgStartTime;
      TimestampTz PgReloadTime;
      bool        redirection_done;
+     bool        IsBinaryUpgrade;
  #ifdef WIN32
      HANDLE        PostmasterHandle;
      HANDLE        initial_signal_pipe;
*************** save_backend_variables(BackendParameters
*** 4653,4658 ****
--- 4654,4660 ----
      param->PgReloadTime = PgReloadTime;

      param->redirection_done = redirection_done;
+     param->IsBinaryUpgrade = IsBinaryUpgrade;

  #ifdef WIN32
      param->PostmasterHandle = PostmasterHandle;
*************** restore_backend_variables(BackendParamet
*** 4874,4879 ****
--- 4876,4882 ----
      PgReloadTime = param->PgReloadTime;

      redirection_done = param->redirection_done;
+     IsBinaryUpgrade = param->IsBinaryUpgrade;

  #ifdef WIN32
      PostmasterHandle = param->PostmasterHandle;

pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: Mismatch of relation names: pg_toast.pg_toast_nnn during pg_upgrade from 8.4 to 9.1
Next
From: Gurjeet Singh
Date:
Subject: Removing savepointLevel from TransactionState