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

Commitb9ded15

Browse files
committed
Properly send SCM status updates when shutting down service on Windows
The Service Control Manager should be notified regularly during a shutdownthat takes a long time. Previously we would increaes the counter, but forgotto actually send the notification to the system. The loop counter was alsoincorrectly initalized in the event that the startup of the system took longenough for it to increase, which could cause the shutdown process not to waitas long as expected.Krystian Bigaj, reviewed by Michael Paquier
1 parent272f99f commitb9ded15

File tree

1 file changed

+20
-8
lines changed

1 file changed

+20
-8
lines changed

‎src/bin/pg_ctl/pg_ctl.c

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1503,15 +1503,27 @@ pgwin32_ServiceMain(DWORD argc, LPTSTR *argv)
15031503
switch (ret)
15041504
{
15051505
caseWAIT_OBJECT_0:/* shutdown event */
1506-
kill(postmasterPID,SIGINT);
1506+
{
1507+
/*
1508+
* status.dwCheckPoint can be incremented by
1509+
* test_postmaster_connection(true), so it might not
1510+
* start from 0.
1511+
*/
1512+
intmaxShutdownCheckPoint=status.dwCheckPoint+12;;
15071513

1508-
/*
1509-
* Increment the checkpoint and try again Abort after 12
1510-
* checkpoints as the postmaster has probably hung
1511-
*/
1512-
while (WaitForSingleObject(postmasterProcess,5000)==WAIT_TIMEOUT&&status.dwCheckPoint<12)
1513-
status.dwCheckPoint++;
1514-
break;
1514+
kill(postmasterPID,SIGINT);
1515+
1516+
/*
1517+
* Increment the checkpoint and try again. Abort after 12
1518+
* checkpoints as the postmaster has probably hung.
1519+
*/
1520+
while (WaitForSingleObject(postmasterProcess,5000)==WAIT_TIMEOUT&&status.dwCheckPoint<maxShutdownCheckPoint)
1521+
{
1522+
status.dwCheckPoint++;
1523+
SetServiceStatus(hStatus, (LPSERVICE_STATUS)&status);
1524+
}
1525+
break;
1526+
}
15151527

15161528
case (WAIT_OBJECT_0+1):/* postmaster went down */
15171529
break;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp