pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Extend sendFileWithContent() to handle custom content length in
5+ messages / 2 participants
[nested] [flat]

* pgsql: Extend sendFileWithContent() to handle custom content length in
@ 2023-11-12 23:36 Michael Paquier <michael@paquier.xyz>
  2023-11-13 00:53 ` Re: pgsql: Extend sendFileWithContent() to handle custom content length in Julien Rouhaud <rjuju123@gmail.com>
  0 siblings, 1 reply; 5+ messages in thread

From: Michael Paquier @ 2023-11-12 23:36 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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.

Author: David Steele
Discussion: https://postgr.es/m/2daf8adc-8db7-4204-a7f2-a7e94e2bfa4b@pgmasters.net

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/7606175991f8ed5ae36eecf6951cb89dcfb2156e

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



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: pgsql: Extend sendFileWithContent() to handle custom content length in
  2023-11-12 23:36 pgsql: Extend sendFileWithContent() to handle custom content length in Michael Paquier <michael@paquier.xyz>
@ 2023-11-13 00:53 ` Julien Rouhaud <rjuju123@gmail.com>
  2023-11-13 02:20   ` Re: pgsql: Extend sendFileWithContent() to handle custom content length in Michael Paquier <michael@paquier.xyz>
  0 siblings, 1 reply; 5+ messages in thread

From: Julien Rouhaud @ 2023-11-13 00:53 UTC (permalink / raw)
  To: Michael Paquier <michael@paquier.xyz>; +Cc: pgsql-committers@lists.postgresql.org

Hi,

On Sun, Nov 12, 2023 at 11:36:58PM +0000, Michael Paquier wrote:
> Extend sendFileWithContent() to handle custom content length in basebackup.c
> [...]
> 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.

Did you mean >= 0?

-   len = strlen(content);
+   if (len < 0)
+       len = strlen(content);





^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: pgsql: Extend sendFileWithContent() to handle custom content length in
  2023-11-12 23:36 pgsql: Extend sendFileWithContent() to handle custom content length in Michael Paquier <michael@paquier.xyz>
  2023-11-13 00:53 ` Re: pgsql: Extend sendFileWithContent() to handle custom content length in Julien Rouhaud <rjuju123@gmail.com>
@ 2023-11-13 02:20   ` Michael Paquier <michael@paquier.xyz>
  0 siblings, 0 replies; 5+ messages in thread

From: Michael Paquier @ 2023-11-13 02:20 UTC (permalink / raw)
  To: Julien Rouhaud <rjuju123@gmail.com>; +Cc: pgsql-committers@lists.postgresql.org

On Mon, Nov 13, 2023 at 08:53:45AM +0800, Julien Rouhaud wrote:
> Did you mean >= 0?

Indeed, thanks.  The commit message got that the opposite way.
--
Michael

Attachments:

  signature.asc (application/pgp-signature, 832B) download

^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* pgsql: Extend sendFileWithContent() to handle custom content length in
@ 2026-10-27 23:02 Michael Paquier <michael@paquier.xyz>
  0 siblings, 0 replies; 5+ messages in thread

From: Michael Paquier @ 2026-10-27 23:02 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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(-)



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* pgsql: Extend sendFileWithContent() to handle custom content length in
@ 2026-10-27 23:02 Michael Paquier <michael@paquier.xyz>
  0 siblings, 0 replies; 5+ messages in thread

From: Michael Paquier @ 2026-10-27 23:02 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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_15_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/d2c1e18de9d1604130d7d4a2eb3bcc6e0de7a545

Modified Files
--------------
src/backend/backup/basebackup.c | 29 ++++++++++++++++-------------
1 file changed, 16 insertions(+), 13 deletions(-)



^ permalink  raw  reply  [nested|flat] 5+ messages in thread


end of thread, other threads:[~2026-10-27 23:02 UTC | newest]

Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2023-11-12 23:36 pgsql: Extend sendFileWithContent() to handle custom content length in Michael Paquier <michael@paquier.xyz>
2023-11-13 00:53 ` Julien Rouhaud <rjuju123@gmail.com>
2023-11-13 02:20   ` Michael Paquier <michael@paquier.xyz>
2026-10-27 23:02 pgsql: Extend sendFileWithContent() to handle custom content length in Michael Paquier <michael@paquier.xyz>
2026-10-27 23:02 pgsql: Extend sendFileWithContent() to handle custom content length in Michael Paquier <michael@paquier.xyz>

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