pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Paquier <michael@paquier.xyz>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Extend sendFileWithContent() to handle custom content length in
Date: Tue, 27 Oct 2026 23:02:29 +0000
Message-ID: <E1xLqBZ-000000012y2-0gbQ@gemulon.postgresql.org> (raw)

Extend sendFileWithContent() to handle custom content length in basebackup.c

sendFileWithContent() previously got the content length by using
strlen(), assuming that the content given is always a string.  Some
patches are under discussion to pass binary contents to a base backup
stream, where an arbitrary length needs to be given by the caller
instead.

The patch extends sendFileWithContent() to be able to handle this case,
where len < 0 can be used to indicate an arbitrary length rather than
rely on strlen() for the content length.

A comment in sendFileWithContent() mentioned the backup_label file.
However, this routine is used by more file types, like the tablespace
map, so adjust it in passing.

Note: This commit has been initially applied on v17~ as of 7606175991f,
and is required for a follow-up commit that addresses an issue down to
v15.

Author: David Steele
Discussion: https://postgr.es/m/2daf8adc-8db7-4204-a7f2-a7e94e2bfa4b@pgmasters.net
Discussion: https://postgr.es/m/d1697de1-eb7f-41bf-a4b7-bba7203df11f@pgbackrest.org
Backpatch-through: 15

Branch
------
REL_16_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/0cfd56254a060cb2325e9b8dd419dd7046e4b1c5

Modified Files
--------------
src/backend/backup/basebackup.c | 25 ++++++++++++++-----------
1 file changed, 14 insertions(+), 11 deletions(-)



view thread (5+ messages)  latest in thread

Message-ID: <E1xLqBZ-000000012y2-0gbQ@gemulon.postgresql.org>
Permalink:  ../E1xLqBZ-000000012y2-0gbQ@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1xLqBZ-000000012y2-0gbQ@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: michael@paquier.xyz
  Subject: Re: pgsql: Extend sendFileWithContent() to handle custom content length in
  In-Reply-To: <E1xLqBZ-000000012y2-0gbQ@gemulon.postgresql.org>
  References: <E1xLqBZ-000000012y2-0gbQ@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox