| From: | Michael Paquier <michael(at)paquier(dot)xyz> |
|---|---|
| To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
| Subject: | pgsql: Extend sendFileWithContent() to handle custom content length in |
| Date: | 2026-10-27 23:02:29 |
| Message-ID: | E1xLqBZ-000000012y4-0lOk@gemulon.postgresql.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-committers |
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(-)
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Michael Paquier | 2026-10-27 23:46:27 | pgsql: Avoid torn copy of the control file in base backups |
| Previous Message | David Rowley | 2026-10-27 22:43:27 | pgsql: Fix broken indentation caused by 34d52e6d3 |