Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commita0c75f5

Browse files
committed
Avoid treating WAL senders as normal backends.
The previous coding treated anything that wasn't an autovacuum launcheras a normal backend, which is wrong now that we also have WAL senders.Fujii Masao, reviewed by Robert Haas, Alvaro Herrera, Tom Lane,and Bernd Helmle.
1 parentfb4c5d2 commita0c75f5

File tree

1 file changed

+38
-14
lines changed

1 file changed

+38
-14
lines changed

‎src/backend/postmaster/postmaster.c

Lines changed: 38 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3167,13 +3167,25 @@ SignalSomeChildren(int signal, int target)
31673167

31683168
if (bp->dead_end)
31693169
continue;
3170-
if (!(target&BACKEND_TYPE_NORMAL)&& !bp->is_autovacuum)
3171-
continue;
3172-
if (!(target&BACKEND_TYPE_AUTOVAC)&&bp->is_autovacuum)
3173-
continue;
3174-
if (!(target&BACKEND_TYPE_WALSND)&&
3175-
IsPostmasterChildWalSender(bp->child_slot))
3176-
continue;
3170+
3171+
/*
3172+
* Since target == BACKEND_TYPE_ALL is the most common case,
3173+
* we test it first and avoid touching shared memory for
3174+
* every child.
3175+
*/
3176+
if (target!=BACKEND_TYPE_ALL)
3177+
{
3178+
intchild;
3179+
3180+
if (bp->is_autovacuum)
3181+
child=BACKEND_TYPE_AUTOVAC;
3182+
elseif (IsPostmasterChildWalSender(bp->child_slot))
3183+
child=BACKEND_TYPE_WALSND;
3184+
else
3185+
child=BACKEND_TYPE_NORMAL;
3186+
if (!(target&child))
3187+
continue;
3188+
}
31773189

31783190
ereport(DEBUG4,
31793191
(errmsg_internal("sending signal %d to process %d",
@@ -4380,13 +4392,25 @@ CountChildren(int target)
43804392

43814393
if (bp->dead_end)
43824394
continue;
4383-
if (!(target&BACKEND_TYPE_NORMAL)&& !bp->is_autovacuum)
4384-
continue;
4385-
if (!(target&BACKEND_TYPE_AUTOVAC)&&bp->is_autovacuum)
4386-
continue;
4387-
if (!(target&BACKEND_TYPE_WALSND)&&
4388-
IsPostmasterChildWalSender(bp->child_slot))
4389-
continue;
4395+
4396+
/*
4397+
* Since target == BACKEND_TYPE_ALL is the most common case,
4398+
* we test it first and avoid touching shared memory for
4399+
* every child.
4400+
*/
4401+
if (target!=BACKEND_TYPE_ALL)
4402+
{
4403+
intchild;
4404+
4405+
if (bp->is_autovacuum)
4406+
child=BACKEND_TYPE_AUTOVAC;
4407+
elseif (IsPostmasterChildWalSender(bp->child_slot))
4408+
child=BACKEND_TYPE_WALSND;
4409+
else
4410+
child=BACKEND_TYPE_NORMAL;
4411+
if (!(target&child))
4412+
continue;
4413+
}
43904414

43914415
cnt++;
43924416
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp