From: Robert Haas <rhaas@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: pg_basebackup: Fix code that thinks about LZ4 buffer size.
Date: Mon, 04 Apr 2022 14:45:00 +0000
Message-ID: <E1nbNwy-000IDd-8g@gemulon.postgresql.org> (raw)
pg_basebackup: Fix code that thinks about LZ4 buffer size.
Before this patch, there was some code that tried to make sure that the
buffer was always big enough at the start, and then asserted that it
didn't need to be enlarged later. However, the code to make sure it was
big enough at the start doesn't actually work, and therefore it was
possible to fail an assertion and crash later.
Remove the code that tries to make sure the buffer is always big enough
at the start in favor of enlarging the buffer as we go along whenever
that is necessary.
The mistake probably happened because, on the server side, we do
actually need to guarantee that the buffer is big enough at the start
to avoid subsequent resizings. However, in that case, the calling
code makes promises about how much data it will provide at once, but
here, that's not the case.
Report by Justin Pryzby. Analysis by me. Patch by Dipesh Pandit.
Discussion: http://postgr.es/m/20220330143536.GG28503@telsasoft.com
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/afb529e6772b4e2b065644a2204697eeaf6c9a96
Modified Files
--------------
src/bin/pg_basebackup/bbstreamer_lz4.c | 22 ++++++++--------------
1 file changed, 8 insertions(+), 14 deletions(-)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-committers@postgresql.org
Cc: rhaas@postgresql.org
Subject: Re: pgsql: pg_basebackup: Fix code that thinks about LZ4 buffer size.
In-Reply-To: <E1nbNwy-000IDd-8g@gemulon.postgresql.org>
References: <E1nbNwy-000IDd-8g@gemulon.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
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