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

Commit16fda4b

Browse files
committed
Make error handling in parallel pg_upgrade less bogus.
reap_child() basically ignored the possibility of either an error inwaitpid() itself or a child process failure on signal. We don't reallyneed to do more than report and crash hard, but proceeding as thoughnothing is wrong is definitely Not Acceptable. The error report fornonzero child exit status was pretty off-point, as well.Noted while fooling around with child-process failure detectionlogic elsewhere. It's been like this a long time, so back-patch toall supported branches.
1 parentade2d61 commit16fda4b

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

‎src/bin/pg_upgrade/parallel.c

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ reap_child(bool wait_for_child)
290290
{
291291
#ifndefWIN32
292292
intwork_status;
293-
intret;
293+
pid_tchild;
294294
#else
295295
intthread_num;
296296
DWORDres;
@@ -300,14 +300,13 @@ reap_child(bool wait_for_child)
300300
return false;
301301

302302
#ifndefWIN32
303-
ret=waitpid(-1,&work_status,wait_for_child ?0 :WNOHANG);
304-
305-
/* no children or, for WNOHANG, no dead children */
306-
if (ret <=0|| !WIFEXITED(work_status))
307-
return false;
308-
309-
if (WEXITSTATUS(work_status)!=0)
310-
pg_fatal("child worker exited abnormally: %s\n",strerror(errno));
303+
child=waitpid(-1,&work_status,wait_for_child ?0 :WNOHANG);
304+
if (child== (pid_t)-1)
305+
pg_fatal("waitpid() failed: %s\n",strerror(errno));
306+
if (child==0)
307+
return false;/* no children, or no dead children */
308+
if (work_status!=0)
309+
pg_fatal("child process exited abnormally: status %d\n",work_status);
311310
#else
312311
/* wait for one to finish */
313312
thread_num=WaitForMultipleObjects(parallel_jobs,thread_handles,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp