提交 5f2688ac 编写于 作者: J Jimmy Yih

Revert SignalSomeChildren function back to Postgres 9.2 functionality

Currently, the walsender process is not properly stopped during
gpstop. The SignalSomeChildren function was changed in the Postgres
8.3 merge in commit 20ac0be1. It was
previously at a Postgres 9.2 state to support sending signals to
walsender as a part of our master and standby master replication.
上级 417a581d
......@@ -567,7 +567,7 @@ static enum CAC_state canAcceptConnections(void);
static long PostmasterRandom(void);
static void RandomSalt(char *md5Salt);
static void signal_child(pid_t pid, int signal);
static void SignalSomeChildren(int signal, bool only_autovac);
static bool SignalSomeChildren(int signal, int target);
#define SignalChildren(sig) SignalSomeChildren(sig, BACKEND_TYPE_ALL)
#define SignalAutovacWorkers(sig) SignalSomeChildren(sig, BACKEND_TYPE_AUTOVAC)
......@@ -6249,14 +6249,14 @@ signal_child(pid_t pid, int signal)
}
/*
* Send a signal to all backend children, including autovacuum workers
* (but NOT special children; dead_end children are never signaled, either).
* If only_autovac is TRUE, only the autovacuum worker processes are signalled.
* Send a signal to the targeted children (but NOT special children;
* dead_end children are never signaled, either).
*/
static void
SignalSomeChildren(int signal, bool only_autovac)
static bool
SignalSomeChildren(int signal, int target)
{
Dlelem *curr;
bool signaled = false;
for (curr = DLGetHead(BackendList); curr; curr = DLGetSucc(curr))
{
......@@ -6264,14 +6264,32 @@ SignalSomeChildren(int signal, bool only_autovac)
if (bp->dead_end)
continue;
if (only_autovac && !bp->is_autovacuum)
continue;
/*
* Since target == BACKEND_TYPE_ALL is the most common case, we test
* it first and avoid touching shared memory for every child.
*/
if (target != BACKEND_TYPE_ALL)
{
int child;
if (bp->is_autovacuum)
child = BACKEND_TYPE_AUTOVAC;
else if (IsPostmasterChildWalSender(bp->child_slot))
child = BACKEND_TYPE_WALSND;
else
child = BACKEND_TYPE_NORMAL;
if (!(target & child))
continue;
}
ereport(DEBUG4,
(errmsg_internal("sending signal %d to process %d",
signal, (int) bp->pid)));
signal_child(bp->pid, signal);
signaled = true;
}
return signaled;
}
/*
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册