]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Fix rare sharedtuplestore.c corruption.
authorThomas Munro <tmunro@postgresql.org>
Thu, 26 Jan 2023 01:50:07 +0000 (14:50 +1300)
committerThomas Munro <tmunro@postgresql.org>
Thu, 26 Jan 2023 01:54:39 +0000 (14:54 +1300)
commit1a5afe007779b677c4f2e411f8d9af23f7a2d085
treec22a4b9b2ee348f0b304f78f51e2fa125d48df02
parentc5864805ba99f79b49b12dc14499da58b0e15eb8
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@gmail.com>
Discussion: https://postgr.es/m/17619-0de62ceda812b8b5%40postgresql.org
src/backend/utils/sort/sharedtuplestore.c