Re: pgsql: Fix page modification outside of critical section in GIN

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Alexander Korotkov <akorotkov(at)postgresql(dot)org>
Cc: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: Re: pgsql: Fix page modification outside of critical section in GIN
Date: 2020-02-07 18:06:46
Message-ID: 21620.1581098806@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Alexander Korotkov <akorotkov(at)postgresql(dot)org> writes:
> Fix page modification outside of critical section in GIN
> By oversight 52ac6cd2d0 makes ginDeletePage() sets pd_prune_xid of page to be
> deleted before entering the critical section. It appears that only versions 11
> and later were affected by this oversight.

I happened to notice, while reviewing stuff for the release notes,
that this patch does not do what the commit message says. The
previous code modified the pd_prune_xid of the "dBuffer" page,
but now it's modifying the pd_prune_xid of the "lBuffer" page.
Is that actually correct? If it isn't, maybe you need to move
the GinPageSetDeleteXid call down a bit further, next to the
GinPageSetDeleted call (by which time the "page" variable has
been restored to the right thing).

Another idea which would be safer if a bit more invasive is to stop
using the single "page" variable for two purposes.

regards, tom lane

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Stephen Frost 2020-02-07 19:22:09 Re: pgsql: Prevent running pg_basebackup as root
Previous Message Fujii Masao 2020-02-07 13:08:26 pgsql: Fix bug in Tid scan.