On Wed, Sep 1, 2021 at 1:56 PM Daniel Gustafsson <dan...@yesql.se> wrote: > A v2 with the above fixes is attached.
Thanks for the updated patch. Here are some comments: 1) Do we need to set bgchild = -1 before the exit(1); in the code below so that we don't kill(bgchild, SIGTERM); unnecessarily in kill_bgchild_atexit? + if (bgchild_exited) + { + pg_log_error("background WAL receiver terminated unexpectedly"); + exit(1); + } + 2) Missing "," after "On Windows, we use a ....." + * that time. On Windows we use a background thread which can communicate 3) How about "/* Flag to indicate whether or not child process exited */" instead of +/* State of child process */? 4) Instead of just exiting from the main pg_basebackup process when the child WAL receiver dies, can't we think of restarting the child process, probably with the WAL streaming position where it left off or stream from the beginning? This way, the work that the main pg_basebackup has done so far doesn't get wasted. I'm not sure if this affects the pg_basebackup functionality. We can restart the child process for 1 or 2 times, if it still dies, we can kill the main pg_baasebackup process too. Thoughts? Regards, Bharath Rupireddy.