pgsql: Fix unnecessary padding in incremental backups

From: Tomas Vondra <tomas(dot)vondra(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Fix unnecessary padding in incremental backups
Date: 2024-04-14 18:38:22
Message-ID: E1rw4kA-0023SJ-5i@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix unnecessary padding in incremental backups

Commit 10e3226ba13d added padding to incremental backups to ensure the
block data is properly aligned. The code in sendFile() however failed to
consider that the header may be a multiple of BLCKSZ and thus already
aligned, adding a full BLCKSZ of unnecessary padding.

Not only does this make the incremental file a bit larger, but the other
places calculating the amount of padding did realize it's not needed and
did not include it in the formula. This resulted in pg_basebackup
getting confused while parsing the data stream, trying to access files
with invalid filenames (e.g. with binary data etc.) and failing.

Branch
------
master

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

Modified Files
--------------
src/backend/backup/basebackup.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Heikki Linnakangas 2024-04-14 20:04:42 pgsql: Put back initialization of 'sslmode', to silence Coverity
Previous Message Tomas Vondra 2024-04-14 16:59:12 pgsql: Add regression test for BRIN parallel builds