Re: README of hash index

From: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
To: Jeff Janes <jeff(dot)janes(at)gmail(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: README of hash index
Date: 2016-09-22 09:10:58
Message-ID: CAA4eK1JBJhkC3XFv94ciP4gMt593G=awxPNgbY-W3f3nteq1yg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Sep 16, 2016 at 9:56 PM, Jeff Janes <jeff(dot)janes(at)gmail(dot)com> wrote:
> On Fri, Sep 16, 2016 at 4:20 AM, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
> wrote:
>>
>> Currently README of hash module contain algorithms written in below form.
>>
>> The insertion algorithm is rather similar:
>>
>> pin meta page and take buffer content lock in shared mode
>> loop:
>> compute bucket number for target hash key
>> release meta page buffer content lock
>> if (correct bucket page is already locked)
>> break
>> release any existing bucket page lock (if a concurrent split happened)
>> take heavyweight bucket lock in shared mode
>> retake meta page buffer content lock in shared mode
>> -- (so far same as reader)
>> release pin on metapage
>> ..
>> ..
>>
>> I have mostly updated them in the patches I have proposed to improve
>> hash index. However, each time I try to update them, I find that it
>> is easy to follow the code than to read and understand the existing
>> algorithm written in above form from README.
>>
>> Do others find it useful to maintain the algorithms in above form?
>
>
> I think that having them all condensed into one place makes it easier to
> think through the locking models to decide if there might be races or
> deadlocks. If you only care about the algorithm for inserting in isolation,
> I agree reading the code might be better.
>

Thanks Jeff and Ken for the inputs. I will keep the algorithms
updated in README of hash index.

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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Rajkumar Raghuwanshi 2016-09-22 09:30:47 Re: Partition-wise join for join between (declaratively) partitioned tables
Previous Message Claudio Freire 2016-09-22 08:00:18 Re: Tuplesort merge pre-reading