aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRobert Haas <rhaas@postgresql.org>2020-04-27 13:04:35 -0400
committerRobert Haas <rhaas@postgresql.org>2020-04-27 13:04:35 -0400
commit0278d3f79a30cd9ccd6646b8447b25c60ae7d01d (patch)
treec8795cb981b40908f205c64a9356a53d0730aeb4 /src
parente81e5741a6c5d2000b70ea4d5aeceb7669fbccbf (diff)
downloadpostgresql-0278d3f79a30cd9ccd6646b8447b25c60ae7d01d.tar.gz
postgresql-0278d3f79a30cd9ccd6646b8447b25c60ae7d01d.zip
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
Diffstat (limited to 'src')
-rw-r--r--src/bin/pg_basebackup/pg_basebackup.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/bin/pg_basebackup/pg_basebackup.c b/src/bin/pg_basebackup/pg_basebackup.c
index faa69d14ceb..c1d3d8624bf 100644
--- a/src/bin/pg_basebackup/pg_basebackup.c
+++ b/src/bin/pg_basebackup/pg_basebackup.c
@@ -1207,7 +1207,12 @@ ReceiveTarFile(PGconn *conn, PGresult *res, int rownum)
time(NULL));
writeTarData(&state, header, sizeof(header));
- writeTarData(&state, zerobuf, 511);
+
+ /*
+ * we don't need to pad out to a multiple of the tar block size
+ * here, because the file is zero length, which is a multiple of
+ * any block size.
+ */
}
}