pg_receivewal: Skip LZ4-compressed segments with incomplete frames When searching for the latest WAL segment to determine where to start streaming, pg_receivewal decompresses each completed LZ4 segment and accepts it if the segment matches the expected size. The code did not check that the LZ4 frame was complete, so a slightly-truncated segment, or a segment compressed with content checksum (we support the case of segments compressed by external tools) with an incorrect checksum, could be considered as valid while it is not.
These segments are now skipped when trying to find the LSN where streaming should start, if found, so as we are more proactive in detecting if something is wrong with the WAL records (aka this is faster than waiting for replay and a CRC32 failure in a WAL record). Oversight in babbbb595d23. Author: Raja Sai Pranav <[email protected]> Discussion: https://postgr.es/m/[email protected] Backpatch-through: 15 Branch ------ REL_19_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/4b3c9325757dfd8f2312e9f1a8decf4431f344ae Modified Files -------------- src/bin/pg_basebackup/pg_receivewal.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
