pg.ddx.io pgsql-committers@postgresql.org mailing list archivehelp / color / mirror / Atom feed
pgsql: In basebackup.c, perform end-of-file test after checksum validat 2+ messages / 1 participants [nested] [flat]
* pgsql: In basebackup.c, perform end-of-file test after checksum validat @ 2023-03-06 15:26 Robert Haas <rhaas@postgresql.org> 0 siblings, 0 replies; 2+ messages in thread From: Robert Haas @ 2023-03-06 15:26 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org 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 Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/33352b9279f5e109aae74d61531d33d8fb12253e Modified Files -------------- src/backend/backup/basebackup.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) ^ permalink raw reply [nested|flat] 2+ messages in thread
* pgsql: In basebackup.c, perform end-of-file test after checksum validat @ 2023-03-06 15:26 Robert Haas <rhaas@postgresql.org> 0 siblings, 0 replies; 2+ messages in thread From: Robert Haas @ 2023-03-06 15:26 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org 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 Branch ------ REL_15_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/349803b18fee2476c7c9c84039d04c900ce8d499 Modified Files -------------- src/backend/backup/basebackup.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) ^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2023-03-06 15:26 UTC | newest] Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2023-03-06 15:26 pgsql: In basebackup.c, perform end-of-file test after checksum validat Robert Haas <rhaas@postgresql.org> 2023-03-06 15:26 pgsql: In basebackup.c, perform end-of-file test after checksum validat Robert Haas <rhaas@postgresql.org>
This inbox is served by DDX for PostgreSQL; see mirroring instructions for how to clone and mirror all data and code used for this inbox