提交 42a7dbe7 编写于 作者: A Ashwin Agrawal

Register SIGUSR1 handler for startup process.

Seems this was missed while back-porting wal replication and due to this, latch
was never signaled to startup process. Instead replay currently always happened
due to latch time-out of 5 seconds and never due to walreceiver signaling of wal
arrival.

Author: Xin Zhang <xzhang@pivotal.io>
Author: Ashwin Agrawal <aagrawal@pivotal.io>
上级 108de474
......@@ -53,6 +53,7 @@
#include "storage/bufmgr.h"
#include "storage/fd.h"
#include "storage/ipc.h"
#include "storage/latch.h"
#include "storage/pmsignal.h"
#include "storage/procarray.h"
#include "storage/smgr.h"
......@@ -11604,6 +11605,13 @@ StartupProcTriggerHandler(SIGNAL_ARGS)
errno = save_errno;
}
/* SIGUSR1: let latch facility handle the signal */
static void
StartupProcSigUsr1Handler(SIGNAL_ARGS)
{
latch_sigusr1_handler();
}
/* SIGHUP: set flag to re-read config file at next convenient time */
static void
StartupProcSigHupHandler(SIGNAL_ARGS)
......@@ -11693,7 +11701,7 @@ StartupProcessMain(int passNum)
pqsignal(SIGQUIT, startupproc_quickdie); /* hard crash time */
pqsignal(SIGALRM, SIG_IGN);
pqsignal(SIGPIPE, SIG_IGN);
pqsignal(SIGUSR1, SIG_IGN);
pqsignal(SIGUSR1, StartupProcSigUsr1Handler);
if (passNum == 1)
pqsignal(SIGUSR2, StartupProcTriggerHandler);
else
......@@ -12531,16 +12539,6 @@ CheckPromoteSignal(bool do_unlink)
return false;
}
/*
* Wake up startup process to replay newly arrived WAL, or to notice that
* failover has been requested.
*/
void
WakeupRecovery(void)
{
SetLatch(&XLogCtl->recoveryWakeupLatch);
}
/*
* Put the current standby master dbid in the shared memory, which will
* be looked up from mmxlog.
......@@ -12754,3 +12752,13 @@ checkXLogConsistency(XLogRecord *record, XLogRecPtr EndRecPtr)
}
}
}
/*
* Wake up startup process to replay newly arrived WAL, or to notice that
* failover has been requested.
*/
void
WakeupRecovery(void)
{
SetLatch(&XLogCtl->recoveryWakeupLatch);
}
......@@ -731,7 +731,7 @@ XLogWalRcvFlush(bool dying)
}
SpinLockRelease(&walrcv->mutex);
/* Signal the startup process and walsender that new WAL has arrived */
/* Signal the startup process that new WAL has arrived */
WakeupRecovery();
/* Report XLOG streaming progress in PS display */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册