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

Commitb9784e1

Browse files
committed
In Windows pg_dump, ensure idle workers will shut down during error exit.
The Windows coding of ShutdownWorkersHard() thought that setting termEventwas sufficient to make workers exit after an error. But that only helpsif a worker is busy and passes through checkAborting(). An idle workerwill just sit, resulting in pg_dump failing to exit until the user gives upand hits control-C. We should close the write end of the command pipeso that idle workers will see socket EOF and exit, as the Unix coding wasalready doing.Back-patch to 9.3 where parallel pg_dump was introduced.Kyotaro Horiguchi
1 parent6537a48 commitb9784e1

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

‎src/bin/pg_dump/parallel.c

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -301,28 +301,26 @@ checkAborting(ArchiveHandle *AH)
301301
}
302302

303303
/*
304-
* Shut down any remaining workers, this has an implicit do_wait == true.
305-
*
306-
* The fastest way we can make the workers terminate gracefully is when
307-
* they are listening for new commands and we just tell them to terminate.
304+
* Shut down any remaining workers, waiting for them to finish.
308305
*/
309306
staticvoid
310307
ShutdownWorkersHard(ParallelState*pstate)
311308
{
312-
#ifndefWIN32
313309
inti;
314310

315311
/*
316-
* Close our write end of the sockets so thatthe workersknow they can
317-
* exit.
312+
* Close our write end of the sockets so thatany workerswaiting for
313+
*commands know they canexit.
318314
*/
319315
for (i=0;i<pstate->numWorkers;i++)
320316
closesocket(pstate->parallelSlot[i].pipeWrite);
321317

318+
#ifndefWIN32
319+
/* On non-Windows, send SIGTERM to abort commands-in-progress. */
322320
for (i=0;i<pstate->numWorkers;i++)
323321
kill(pstate->parallelSlot[i].pid,SIGTERM);
324322
#else
325-
/*The workers monitor this event via checkAborting(). */
323+
/*Non-idle workers monitor this event via checkAborting(). */
326324
SetEvent(termEvent);
327325
#endif
328326

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp