summaryrefslogtreecommitdiff
path: root/src/bin/pg_combinebackup/reconstruct.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/bin/pg_combinebackup/reconstruct.c')
-rw-r--r--src/bin/pg_combinebackup/reconstruct.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/bin/pg_combinebackup/reconstruct.c b/src/bin/pg_combinebackup/reconstruct.c
index 41f06bb26b5..33c6da02a8c 100644
--- a/src/bin/pg_combinebackup/reconstruct.c
+++ b/src/bin/pg_combinebackup/reconstruct.c
@@ -472,6 +472,14 @@ make_incremental_rfile(char *filename)
sizeof(rf->truncation_block_length) +
sizeof(BlockNumber) * rf->num_blocks;
+ /*
+ * Round header length to a multiple of BLCKSZ, so that blocks contents
+ * are properly aligned. Only do this when the file actually has data for
+ * some blocks.
+ */
+ if ((rf->num_blocks > 0) && ((rf->header_length % BLCKSZ) != 0))
+ rf->header_length += (BLCKSZ - (rf->header_length % BLCKSZ));
+
return rf;
}