pg_basebackup: check timeline history file write failures in ReceiveXlogStream()
Hi,
While reviewing patch [1]/messages/by-id/f1743511-5fab-482e-94ec-1198ce18723e@riseup.net, I spotted that ReceiveXlogStream() calls writeTimeLineHistoryFile() without checking its result. writeTimeLineHistoryFile() can fail for several reasons and returns false to indicate a failure. This could cause pg_basebackup and pg_receivewal to continue streaming even if the timeline history file was not successfully written.
This seems a very old problem, dating back to 9.3.
Attached is a trivial patch that checks the return value of writeTimeLineHistoryFile() and returns false on failure.
[1]: /messages/by-id/f1743511-5fab-482e-94ec-1198ce18723e@riseup.net
Best regards,
--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/
On Wed, Nov 11, 2026 at 10:56 AM Chao Li <li.evan.chao@gmail.com> wrote:
Attached is a trivial patch that checks the return value of writeTimeLineHistoryFile() and returns false on failure.
Thanks for the report and patch! LGTM.
Barring any objections, I will commit it.
Regards,
--
Fujii Masao
Hi Chao,
Thank you for reporting the issue and fixing it. The patch looks good to
me.
Regards,
Surya Poondla
On Sat, Nov 14, 2026 at 7:21 AM surya poondla <suryapoondla4@gmail.com> wrote:
Thank you for reporting the issue and fixing it. The patch looks good to me.
I've pushed the patch. Thanks!
Regards,
--
Fujii Masao
On Nov 18, 2026, at 12:34, Fujii Masao <masao.fujii@gmail.com> wrote:
On Sat, Nov 14, 2026 at 7:21 AM surya poondla <suryapoondla4@gmail.com> wrote:
Thank you for reporting the issue and fixing it. The patch looks good to me.
I've pushed the patch. Thanks!
Hi Fujii-san, thanks a lot for pushing.
Best regards,
--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/