pg_basebackup: check timeline history file write failures in ReceiveXlogStream()

From: Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: pg_basebackup: check timeline history file write failures in ReceiveXlogStream()
Date: 2026-11-11 01:55:52
Message-ID: 530B55ED-C7F7-441C-BBC0-6F3F9901E414@gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

While reviewing patch [1], 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] https://postgr.es/m/f1743511-5fab-482e-94ec-1198ce18723e@riseup.net

Best regards,
--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/

Attachment Content-Type Size
v1-0001-Check-timeline-history-file-write-failures-in-Rec.patch application/octet-stream 1.4 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message shihao zhong 2026-11-11 02:06:04 Assertion failure in get_matching_part_pairs() with pruned partitions
Previous Message Hayato Kuroda (Fujitsu) 2026-11-11 01:53:27 RE: Fix "unexpected logical decoding status change" error; from concurrent logical decoding activation