Re: [COMMITTERS] pgsql: Avoid extra locks in GetSnapshotData if old_snapshot_threshold <

From: Kevin Grittner <kgrittn(at)gmail(dot)com>
To: Noah Misch <noah(at)leadboat(dot)com>
Cc: Andres Freund <andres(at)anarazel(dot)de>, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Ants Aasma <ants(dot)aasma(at)eesti(dot)ee>, Kevin Grittner <kgrittn(at)postgresql(dot)org>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [COMMITTERS] pgsql: Avoid extra locks in GetSnapshotData if old_snapshot_threshold <
Date: 2016-07-19 23:09:59
Message-ID: CACjxUsMujjg0peWzBdnNzWPdbMTzZj2j+KgNpEvWdFw+FGYTzA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

On Mon, Jul 18, 2016 at 9:10 PM, Noah Misch <noah(at)leadboat(dot)com> wrote:
> On Sat, Jul 16, 2016 at 06:48:08PM -0400, Noah Misch wrote:
>> On Wed, Jul 13, 2016 at 03:57:02PM -0500, Kevin Grittner wrote:
>>> On Wed, Jul 13, 2016 at 12:48 PM, Andres Freund <andres(at)anarazel(dot)de> wrote:
>>>> On 2016-07-13 10:06:52 -0500, Kevin Grittner wrote:
>>>>> On Wed, Jul 13, 2016 at 7:57 AM, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
>>>>>> On Tue, Jul 12, 2016 at 8:34 PM, Kevin Grittner <kgrittn(at)gmail(dot)com> wrote:
>>>>>>> On Fri, Jul 8, 2016 at 1:52 PM, Andres Freund <andres(at)anarazel(dot)de> wrote:
>>>>>>>
>>>>>>>> I'm a bit confused, why aren't we simply adding LSN interlock
>>>>>>>> checks for toast? Doesn't look that hard? Seems like a much more
>>>>>>>> natural course of fixing this issue?
>>>>>>>
>>>>>>> I took some time trying to see what you have in mind, and I'm
>>>>>>> really not "getting it".
>>>>>>
>>>>>> Isn't it possible if we initialize lsn and whenTaken in SnapshotToast
>>>>>> when old_snapshot_threshold > 0 and add a check for
>>>>>> HeapTupleSatisfiesToast in TestForOldSnapshot()?
>>>>>
>>>>> With that approach, how will we know *not* to generate an error
>>>>> when reading the chain of tuples for a value we are deleting. Or
>>>>> positioning to modify an index on toast data. Etc., etc. etc.
>>>>
>>>> I'm not following. How is that different in the toast case than in the
>>>> heap case?
>>>
>>> A short answer is that a normal table's heap doesn't go through
>>> systable_getnext_ordered(). That function is used both for cases
>>> where the check should not be made, like toast_delete_datum(), and
>>> cases where it should, like toast_fetch_datum().
>>>
>>> Since this keeps coming up, I'll produce a patch this way. I'm
>>> skeptical, but maybe it will look better than I think it will. I
>>> should be able to post that by Friday.
>>
>> This PostgreSQL 9.6 open item is past due for your status update. Kindly send
>> a status update within 24 hours, and include a date for your subsequent status
>> update. Refer to the policy on open item ownership:
>> http://www.postgresql.org/message-id/20160527025039.GA447393@tornado.leadboat.com
>
> IMMEDIATE ATTENTION REQUIRED. This PostgreSQL 9.6 open item is long past due
> for your status update. Please reacquaint yourself with the policy on open
> item ownership[1] and then reply immediately. If I do not hear from you by
> 2016-07-20 03:00 UTC, I will transfer this item to release management team
> ownership without further notice.
>
> [1] http://www.postgresql.org/message-id/20160527025039.GA447393@tornado.leadboat.com

As far as I can see, to do this the way that Andres and Amit
suggest involves tying in to indexam.c and other code in incredibly
ugly ways. I think it is entirely the wrong way to go, as I can't
find a way to make it look remotely sane. The question is whether
I should do it the way that I think is sane, or whether someone
else wants to show me what I'm missing by producing at least a
rough patch along these lines.

--
Kevin Grittner
EDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Andres Freund 2016-07-19 23:32:50 Re: Re: [COMMITTERS] pgsql: Avoid extra locks in GetSnapshotData if old_snapshot_threshold <
Previous Message pgsql 2016-07-19 22:55:46 pgsql: Tag refs/tags/REL9_6_BETA3 was created

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2016-07-19 23:32:50 Re: Re: [COMMITTERS] pgsql: Avoid extra locks in GetSnapshotData if old_snapshot_threshold <
Previous Message Kevin Grittner 2016-07-19 21:38:19 Re: Document that vacuum can't truncate if old_snapshot_threshold >= 0