pgsql: Fix past pd_upper write in ginRedoRecompress()

From: Alexander Korotkov <akorotkov(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Fix past pd_upper write in ginRedoRecompress()
Date: 2018-09-09 18:40:58
Message-ID: E1fz4dm-0007Rv-H2@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: 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
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/5f08accdad2b03e0107bdc73d48783a01fe51c8c

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

Browse pgsql-committers by date

  From Date Subject
Next Message Alexander Korotkov 2018-09-09 18:43:28 pgsql: Fix past pd_upper write in ginRedoRecompress()
Previous Message Tom Lane 2018-09-09 16:41:34 pgsql: Work around stdbool problem in dfmgr.c.