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

Commit6479df1

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 parentb2355a2 commit6479df1

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

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

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

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

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp