Skip to content

Commit a08bfe7

Browse files
committed
Fix bogus tar-file padding logic for standby.signal.
When pg_basebackup -R is used, we inject standby.signal into the tar file for the main tablespace. The proper thing to do is to pad each file injected into the tar file out to a 512-byte boundary by appending nulls, but here the file is of length 0 and we add 511 zero bytes. Since 0 is already a multiple of 512, we should not add any zero bytes. Do that instead. Patch by me, reviewed by Tom Lane. Discussion: http://postgr.es/m/CA+TgmobWbfReO9-XFk8urR1K4wTNwqoHx_v56t7=T8KaiEoKNw@mail.gmail.com
1 parent 18f7e85 commit a08bfe7

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/bin/pg_basebackup/pg_basebackup.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1131,7 +1131,12 @@ ReceiveTarFile(PGconn *conn, PGresult *res, int rownum)
11311131
time(NULL));
11321132

11331133
WRITE_TAR_DATA(header, sizeof(header));
1134-
WRITE_TAR_DATA(zerobuf, 511);
1134+
1135+
/*
1136+
* we don't need to pad out to a multiple of the tar block
1137+
* size here, because the file is zero length, which is a
1138+
* multiple of any block size.
1139+
*/
11351140
}
11361141
}
11371142

0 commit comments

Comments
 (0)