GSoC 2017 : Proposal for predicate locking in gist index

From: Shubham Barai <shubhambaraiss(at)gmail(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Cc: Andrew Borodin <amborodin86(at)gmail(dot)com>, Kevin Grittner <kgrittn(at)gmail(dot)com>
Subject: GSoC 2017 : Proposal for predicate locking in gist index
Date: 2017-05-31 20:02:15
Message-ID: CALxAEPto08BUB8o1ZCWHmF1_zG-Hx+uEhNxd7fuEaQ+=pvbk+g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello everyone,

I have been accepted as GSoC student for the project "Explicitly support
predicate locks in index access methods besides b-tree". I want to share my
approach for implementation of page level predicate locking in gist index.
Any suggestions will be appreciated.

Proposal

The main difference between b-tree and gist index while searching for a
target tuple is that in gist index, we can determine if there is a match or
not at any level of the index. In gist, index entry of internal nodes
contains a predicate which is used as a search key to search all reachable
tuples from that node. To insert a tuple in the index, we first check the
key representing a target subtree. If it doesn't already cover the key we
are inserting, we have to replace it with the union of old key and the key
we are inserting. After considering all these points, it seems logical to
acquire a predicate lock at each level of the index.

The simplest way to do that will be by inserting a call for
prdicatelockpage() in gistscanpage().

Insertion algorithm also needs to check for conflicting predicate locks at
each level of the index.

We can insert a call for CheckForSerializableConflictIn() at two places in
gistdoinsert().

1. after acquiring an exclusive lock on internal page (in case we are
trying to replace an old search key)

2. after acquiring an exclusive lock on leaf page

If there is not enough space for insertion, we have to copy predicate lock
from an old page to all new pages generated after a successful split
operation. For that, we can insert a call for PredicateLockPageSplit() in
gistplacetopage().

Regards,

Shubham

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Joshua D. Drake 2017-05-31 20:18:51 Re: TAP backpatching policy
Previous Message Michael Paquier 2017-05-31 19:52:52 Re: [HACKERS] Channel binding support for SCRAM-SHA-256