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

Commitdf8d2d8

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 parentb898eb6 commitdf8d2d8

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
@@ -300,28 +300,26 @@ checkAborting(ArchiveHandle *AH)
300300
}
301301

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

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

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

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp