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

Commit239b175

Browse files
committed
Process pending postmaster work before connections.
Modify the new event loop code from commit7389aad so that it checksfor work requested by signal handlers even if it doesn't see a latchevent yet.This gives priority to shutdown and reload requests where the latch willbe reported later in the event array, or in a later call toWaitEventSetWait(), due to scheduling details. In particular, thisguarantees that a SIGHUP-then-connect sequence (as seen inauthentication tests) causes the postmaster to process the reload beforeaccepting the connection. If the WaitEventSetWait() call saw the socketas ready, and the reload signal was generated before the connection,then the latest time the signal handler should be able to run is afterpoll/epoll_wait/kevent returns but before we check thepending_pm_reload_request flag.While here, also shift the handling of child exit below reload requests,per Tom Lane's observation that that might start new processes, so weshould make sure we pick up new settings first.This probably explains the one-off failure of build farm animalmalleefowl.Reported-by: Hou Zhijie <houzj.fnst@fujitsu.com>Reported-by: Tom Lane <tgl@sss.pgh.pa.us>Discussion:https://postgr.es/m/OS0PR01MB57163D3BF2AB42ECAA94E5C394C29%40OS0PR01MB5716.jpnprd01.prod.outlook.com
1 parent8f8f115 commit239b175

File tree

1 file changed

+17
-12
lines changed

1 file changed

+17
-12
lines changed

‎src/backend/postmaster/postmaster.c

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1750,20 +1750,25 @@ ServerLoop(void)
17501750
for (inti=0;i<nevents;i++)
17511751
{
17521752
if (events[i].events&WL_LATCH_SET)
1753-
{
17541753
ResetLatch(MyLatch);
17551754

1756-
/* Process work requested via signal handlers. */
1757-
if (pending_pm_shutdown_request)
1758-
process_pm_shutdown_request();
1759-
if (pending_pm_child_exit)
1760-
process_pm_child_exit();
1761-
if (pending_pm_reload_request)
1762-
process_pm_reload_request();
1763-
if (pending_pm_pmsignal)
1764-
process_pm_pmsignal();
1765-
}
1766-
elseif (events[i].events&WL_SOCKET_ACCEPT)
1755+
/*
1756+
* The following requests are handled unconditionally, even if we
1757+
* didn't see WL_LATCH_SET. This gives high priority to shutdown
1758+
* and reload requests where the latch happens to appear later in
1759+
* events[] or will be reported by a later call to
1760+
* WaitEventSetWait().
1761+
*/
1762+
if (pending_pm_shutdown_request)
1763+
process_pm_shutdown_request();
1764+
if (pending_pm_reload_request)
1765+
process_pm_reload_request();
1766+
if (pending_pm_child_exit)
1767+
process_pm_child_exit();
1768+
if (pending_pm_pmsignal)
1769+
process_pm_pmsignal();
1770+
1771+
if (events[i].events&WL_SOCKET_ACCEPT)
17671772
{
17681773
Port*port;
17691774

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp