pgsql: Fix rare sharedtuplestore.c corruption.

From: Thomas Munro <tmunro(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Fix rare sharedtuplestore.c corruption.
Date: 2023-01-26 02:30:12
Message-ID: E1pKs1k-005V7V-7U@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix rare sharedtuplestore.c corruption.

If the final chunk of an oversized tuple being written out to disk was
exactly 32760 bytes, it would be corrupted due to a fencepost bug.

Bug #17619. Back-patch to 11 where the code arrived.

While testing that (see test module in archives), I (tmunro) noticed
that the per-participant page counter was not initialized to zero as it
should have been; that wasn't a live bug when it was written since DSM
memory was originally always zeroed, but since 14
min_dynamic_shared_memory might be configured and it supplies non-zeroed
memory, so that is also fixed here.

Author: Dmitry Astapov <dastapov(at)gmail(dot)com>
Discussion: https://postgr.es/m/17619-0de62ceda812b8b5%40postgresql.org

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/ffcf6f4cfca5a4ce2ac7ff7e8fa17541a5a9caea

Modified Files
--------------
src/backend/utils/sort/sharedtuplestore.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Thomas Munro 2023-01-26 02:30:26 pgsql: Fix rare sharedtuplestore.c corruption.
Previous Message Michael Paquier 2023-01-26 00:14:04 pgsql: Revert "Rename contrib module basic_archive to basic_wal_module"