pgsql: Fix past pd_upper write in ginRedoRecompress() - Mailing list pgsql-committers

From Alexander Korotkov
Subject pgsql: Fix past pd_upper write in ginRedoRecompress()
Date
Msg-id E1fz4gC-0007U1-Hv@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
Fix past pd_upper write in ginRedoRecompress()

ginRedoRecompress() replays actions over compressed segments of posting list
in-place.  However, it might lead to write past pg_upper, because intermediate
state during playing the changes can take more space than both original state
and final state.  This commit fixes that by refuse from in-place modification.
Instead page tail is copied once modification is started, and then it's used
as the source of original segments.  Backpatch to 9.4 where posting list
compression was introduced.

Reported-by: Sivasubramanian Ramasubramanian
Discussion: https://postgr.es/m/1536091151804.6588%40amazon.com
Author: Alexander Korotkov based on patch from and ideas by Sivasubramanian Ramasubramanian
Review: Sivasubramanian Ramasubramanian
Backpatch-through: 9.4

Branch
------
REL_11_STABLE

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

Modified Files
--------------
src/backend/access/gin/ginxlog.c | 80 +++++++++++++++++++++++++++++-----------
1 file changed, 59 insertions(+), 21 deletions(-)


pgsql-committers by date:

Previous
From: Alexander Korotkov
Date:
Subject: pgsql: Improve behavior of to_timestamp()/to_date() functions
Next
From: Alexander Korotkov
Date:
Subject: pgsql: Fix past pd_upper write in ginRedoRecompress()