GSoC 2017 Proposal for predicate locking in hash index

Started by Shubham Baraiover 9 years ago3 messageshackers
Jump to latest
#1Shubham Barai
shubhambaraiss@gmail.com

Hi,

Now that hash index support write-ahead logging, it will be great if we add
support for predicate locking to it.
Implementation of predicate locking in hash index seems very simple.
I have already made changes in the code. I am currently working on testing.

Here is my approach

1) PredicateLockPage()

->_hash_first()

During a scan operation, acquire a predicate lock on the primary page of a
bucket.

2) CheckForSerializableConflictIn()

->_hash_doinsert()

During an insert operation, check if there is any predicate lock on the
primary page of a bucket.

3) PredicateLockPageSplit()

In case of a bucket split, copy predicate lock from the primary page of an
old bucket to the primary page of a new bucket.

Any suggestions or corrections will be appreciated.

Regards,
Shubham

<https://mailtrack.io/> Sent with Mailtrack
<https://mailtrack.io/install?source=signature&lang=en&referral=shubhambaraiss@gmail.com&idSignature=22>

#2Alvaro Herrera
alvherre@2ndquadrant.com
In reply to: Shubham Barai (#1)
Re: GSoC 2017 Proposal for predicate locking in hash index

Shubham Barai wrote:

Hi,

Now that hash index support write-ahead logging, it will be great if we add
support for predicate locking to it.
Implementation of predicate locking in hash index seems very simple.
I have already made changes in the code. I am currently working on testing.

So if I understand correctly, this would only cause a false positive if
two transactions have a rw/ww conflict in different tuples in the same
bucket. Is that what we expect?

--
�lvaro Herrera https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#3Shubham Barai
shubhambaraiss@gmail.com
In reply to: Alvaro Herrera (#2)
Re: GSoC 2017 Proposal for predicate locking in hash index

Hi,

On 22 June 2017 at 21:12, Alvaro Herrera <alvherre@2ndquadrant.com> wrote:

Shubham Barai wrote:

Hi,

Now that hash index support write-ahead logging, it will be great if we

add

support for predicate locking to it.
Implementation of predicate locking in hash index seems very simple.
I have already made changes in the code. I am currently working on

testing.

So if I understand correctly, this would only cause a false positive if
two transactions have a rw/ww conflict in different tuples in the same
bucket. Is that what we expect?

Yes, I think so. Is there any way to further reduce false positives in

the same bucket?

Regards,
Shubham

<https://mailtrack.io/> Sent with Mailtrack
<https://mailtrack.io/install?source=signature&lang=en&referral=shubhambaraiss@gmail.com&idSignature=22>