postgresql/src
Robert Haas 33352b9279 In basebackup.c, perform end-of-file test after checksum validation.
We read blocks of data from files that we're backing up in chunks,
some multiple of BLCKSZ for each read. If checksum verification fails,
we then try rereading just the one block for which validation failed.
If that block happened to be the first block of the chunk, and if
the file was concurrently truncated to remove that block, then we'd
reach a call to bbsink_archive_contents() with a buffer length of 0.
That causes an assertion failure.

As far as I can see, there are no particularly bad consequences if
this happens in a non-assert build, and it's pretty unlikely to happen
in the first place because it requires a series of somewhat unlikely
things to happen in very quick succession. However, assertion failures
are bad, so rearrange the code to avoid that possibility.

Patch by me, reviewed by Michael Paquier.

Discussion: http://postgr.es/m/CA+TgmoZ_fFAoU6mrHt9QBs+dcYhN6yXenGTTMRebZNhtwPwHyg@mail.gmail.com
2023-03-06 10:15:32 -05:00
..
backend In basebackup.c, perform end-of-file test after checksum validation. 2023-03-06 10:15:32 -05:00
bin Fix handling of default option values in createuser 2023-03-06 14:16:32 +01:00
common Revise pg_pwrite_zeros() 2023-03-06 13:21:33 +09:00
fe_utils Revert refactoring of restore command code to shell_restore.c 2023-02-06 08:28:42 +09:00
include Add PROCESS_MAIN to VACUUM 2023-03-06 16:41:05 +09:00
interfaces Check for unbounded authentication exchanges in libpq. 2023-02-22 21:27:38 +02:00
makefiles meson: Add equivalent of configure --disable-rpath option 2023-03-01 08:05:42 +01:00
pl Remove local optimizations of empty Bitmapsets into null pointers. 2023-03-02 12:01:47 -05:00
port Remove gratuitous references to postmaster program 2023-01-26 10:48:32 +01:00
template Use unnamed POSIX semaphores on Cygwin. 2023-01-06 10:33:28 +13:00
test Add PROCESS_MAIN to VACUUM 2023-03-06 16:41:05 +09:00
timezone Fix outdated references to guc.c 2023-03-02 13:49:39 +01:00
tools Tighten header pre-inclusions in headerscheck and cpluspluscheck. 2023-03-04 12:11:50 -05:00
tutorial Remove useless casts to (void *) in arguments of some system functions 2023-02-07 06:57:59 +01:00
.gitignore
DEVELOPERS
Makefile Integrate pg_bsd_indent into our build/test infrastructure. 2023-02-12 12:22:21 -05:00
Makefile.global.in autoconf: Move export_dynamic determination to configure 2022-12-06 18:55:28 -08:00
Makefile.shlib autoconf: Rely on ar supporting index creation 2022-10-07 11:53:39 -07:00
meson.build Integrate pg_bsd_indent into our build/test infrastructure. 2023-02-12 12:22:21 -05:00
nls-global.mk Fix for make unportability 2022-07-13 09:15:01 +02:00