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

Commitf7642cf

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 parentcd24b4e commitf7642cf

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
@@ -294,7 +294,7 @@ reap_child(bool wait_for_child)
294294
{
295295
#ifndefWIN32
296296
intwork_status;
297-
intret;
297+
pid_tchild;
298298
#else
299299
intthread_num;
300300
DWORDres;
@@ -304,14 +304,13 @@ reap_child(bool wait_for_child)
304304
return false;
305305

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

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp