Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitcd4b6af

Browse files
committed
Fix unnecessary padding in incremental backups
Commit10e3226 added padding to incremental backups to ensure theblock data is properly aligned. The code in sendFile() however failed toconsider that the header may be a multiple of BLCKSZ and thus alreadyaligned, adding a full BLCKSZ of unnecessary padding.Not only does this make the incremental file a bit larger, but the otherplaces calculating the amount of padding did realize it's not needed anddid not include it in the formula. This resulted in pg_basebackupgetting confused while parsing the data stream, trying to access fileswith invalid filenames (e.g. with binary data etc.) and failing.
1 parent8225c2f commitcd4b6af

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

‎src/backend/backup/basebackup.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1638,11 +1638,12 @@ sendFile(bbsink *sink, const char *readfilename, const char *tarfilename,
16381638

16391639
/*
16401640
* Add padding to align header to a multiple of BLCKSZ, but only if
1641-
* the incremental file has some blocks. If there are no blocks we
1642-
* don't want make the file unnecessarily large, as that might make
1643-
* some filesystem optimizations impossible.
1641+
* the incremental file has some blocks, and the alignment is actually
1642+
* needed (i.e. header is not already a multiple of BLCKSZ). If there
1643+
* are no blocks we don't want to make the file unnecessarily large,
1644+
* as that might make some filesystem optimizations impossible.
16441645
*/
1645-
if (num_incremental_blocks>0)
1646+
if ((num_incremental_blocks>0)&& (header_bytes_done %BLCKSZ!=0))
16461647
{
16471648
paddinglen= (BLCKSZ- (header_bytes_done %BLCKSZ));
16481649

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp