Re: Archive recovery won't be completed on some situation.

From: Kyotaro HORIGUCHI <horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp>
To: alvherre(at)2ndquadrant(dot)com
Cc: masao(dot)fujii(at)gmail(dot)com, hlinnakangas(at)vmware(dot)com, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Archive recovery won't be completed on some situation.
Date: 2014-03-20 06:17:55
Message-ID: 20140320.151755.77656639.horiguchi.kyotaro@lab.ntt.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi, I confirmed that 82233ce7ea4 surely did it.

At Wed, 19 Mar 2014 09:35:16 -0300, Alvaro Herrera wrote
> Fujii Masao escribió:
> > On Wed, Mar 19, 2014 at 7:57 PM, Heikki Linnakangas
> > <hlinnakangas(at)vmware(dot)com> wrote:
>
> > >> 9.4 canceles backup mode even on immediate shutdown so the
> > >> operation causes no problem, but 9.3 and before are doesn't.
> > >
> > > Hmm, I don't think we've changed that behavior in 9.4.
> >
> > ISTM 82233ce7ea42d6ba519aaec63008aff49da6c7af changed immdiate
> > shutdown that way.
>
> Uh, interesting. I didn't see that secondary effect. I hope it's not
> for ill?

The crucial factor for the behavior change is that pmdie has
become not to exit immediately for SIGQUIT. 'case SIGQUIT:' in
pmdie() ended with "ExitPostmaster(0)" before the patch but now
it ends with 'PostmasterStateMachine(); break;' so continues to
run with pmState = PM_WAIT_BACKENDS, similar to SIGINT (fast
shutdown).

After all, pmState changes to PM_NO_CHILDREN via PM_WAIT_DEAD_END
by SIGCHLDs from non-significant processes, then CancelBackup().

Focusing on the point described above, the small patch below
rewinds the behavior back to 9.3 and before but I don't know the
appropriateness in regard to the intention of the patch.

diff --git a/src/backend/postmaster/postmaster.c b/src/backend/postmaster/postmaster.c
index e9072b7..f87c25c 100644
--- a/src/backend/postmaster/postmaster.c
+++ b/src/backend/postmaster/postmaster.c
@@ -2498,16 +2498,7 @@ pmdie(SIGNAL_ARGS)
(errmsg("received immediate shutdown request")));

TerminateChildren(SIGQUIT);
- pmState = PM_WAIT_BACKENDS;
-
- /* set stopwatch for them to die */
- AbortStartTime = time(NULL);
-
- /*
- * Now wait for backends to exit. If there are none,
- * PostmasterStateMachine will take the next step.
- */
- PostmasterStateMachine();
+ ExitPostmaster(0);
break;
}

regards,

--
Kyotaro Horiguchi
NTT Open Source Software Center

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Mark Kirkwood 2014-03-20 06:25:00 Re: four minor proposals for 9.5
Previous Message Amit Kapila 2014-03-20 04:36:10 Re: four minor proposals for 9.5