Re: Trap errors from streaming child in pg_basebackup to exit early - Mailing list pgsql-hackers

From Bharath Rupireddy
Subject Re: Trap errors from streaming child in pg_basebackup to exit early
Date
Msg-id CALj2ACVkc8rQPMaRMHQvk4ej=J8PW=iF3Zb=d_m8y2n2xPTyFA@mail.gmail.com
Whole thread Raw
In response to Re: Trap errors from streaming child in pg_basebackup to exit early  (Daniel Gustafsson <daniel@yesql.se>)
List pgsql-hackers
On Fri, Sep 3, 2021 at 3:23 PM Daniel Gustafsson <daniel@yesql.se> wrote:
> > 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?
>
> I was toying with the idea, but I ended up not pursuing it.  This error is well
> into the “really shouldn’t happen, but can” territory and it’s quite likely
> that some level of manual intervention is required to make it successfully
> restart.  I’m not convinced that adding complicated logic to restart (and even
> more complicated tests to simulate and test it) will be worthwhile.

 I withdraw my suggestion because I now feel that it's better not to
make it complex and let the user decide if at all the child process
exits abnormally.

I think we might still miss abnormal child thread exits on Windows
because we set bgchild_exited = true only if ReceiveXlogStream or
walmethod->finish() returns false. I'm not sure the parent thread on
Windows can detect a child's abnormal exit. Since there is no signal
mechanism on Windows, what the patch does is better to detect child
exit on two important functions failures.

Overall, the v3 patch looks good to me.

Regards,
Bharath Rupireddy.



pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: [PATCH] Make pkg-config files cross-compile friendly
Next
From: Bharath Rupireddy
Date:
Subject: Re: pg_receivewal starting position