Re: pgsql: Avoid creation of the free space map for small heap relations, t

From: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, John Naylor <john(dot)naylor(at)2ndquadrant(dot)com>
Cc: Amit Kapila <akapila(at)postgresql(dot)org>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: pgsql: Avoid creation of the free space map for small heap relations, t
Date: 2019-02-27 04:05:49
Message-ID: CAA4eK1LH3AeHc+DvrYUUq6jMokaSg5MrHZ8o54qT3jUgZZc15g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

On Tue, Feb 26, 2019 at 2:58 PM Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
>
> On Mon, Feb 25, 2019 at 10:32 PM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> >
>
> To fix this symptom, we can ensure that once we didn't get any block
> from local map, we must clear it. See the attached patch. I will try
> to evaluate this code path to see if there is any similar race
> condition and will also try to generate a reproducer. I don't have
> any great idea to write a reproducer for this issue apart from trying
> some thing similar to ecpg/test/thread/prep.pgc, if you can think of
> any, I am all ears.
>

I have tried this test many times (more than 1000 times) by varying
thread count, but couldn't reproduce it. My colleague, Kuntal has
tried a similar test overnight, but the issue didn't reproduce which
is not surprising to me seeing the nature of the problem. As I could
reproduce it via the debugger, I think we can go ahead with the fix.
I have improved the comments in the attached patch and I have also
tried to address Tom's concern w.r.t comments by adding additional
comments atop of data-structure used to maintain the local map.

Let me know what you think?

--
With Regards,
Amit Kapila.
EnterpriseDB: http://www.enterprisedb.com

Attachment Content-Type Size
fix_loc_map_clear_2.patch application/octet-stream 1.5 KB

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Andres Freund 2019-02-27 04:41:28 pgsql: Store table oid and tuple's tid in tuple slots directly.
Previous Message Andres Freund 2019-02-27 02:07:11 pgsql: Add ExecStorePinnedBufferHeapTuple.

Browse pgsql-hackers by date

  From Date Subject
Next Message Nagaura, Ryohei 2019-02-27 04:25:27 RE: Timeout parameters
Previous Message Amit Langote 2019-02-27 02:21:58 Re: Problem with default partition pruning