GSoC 2017: weekly progress reports (week 5) and Proposal for predicate locking in gin index

From: Shubham Barai <shubhambaraiss(at)gmail(dot)com>
To: Kevin Grittner <kgrittn(at)gmail(dot)com>, Andrew Borodin <amborodin86(at)gmail(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: GSoC 2017: weekly progress reports (week 5) and Proposal for predicate locking in gin index
Date: 2017-07-04 19:10:41
Message-ID: CALxAEPu3E5PCLRPD2YPR0nXNzRh8hjfNQiHmJJG157-6f=zc+w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Project: Explicitly support predicate locks in index AMs besides b-tree

Hi,

During this week, I read documentation and source code of gin index to find
appropriate places to insert calls to existing functions.

Proposal

Gin index consists of a Btree index over key values, where each key is an
element of some indexed items and each tuple in a leaf page contains either
a posting list if the list is small enough or a pointer to posting tree.
As gin searches have to go all the way to leaf pages to determine whether
there is a match or not, we just need a predicate lock on leaf pages.

Also, gin index has a feature called fast update which postpones the
insertion of tuples by temporarily storing them into pending list. The
pending list is eventually flushed during vacuum. So this creates a problem
because even if a scan acquires a page level predicate lock on the pending
list, we will not be able to detect r-w conflict because a new insert will
just append tuples on the pending list. So, I think if a fast update is
enabled, we need a predicate lock on the entire relation.

The possible places where we need to insert calls to existing
functions are as follows

1. PredicateLockPage()

-> entryLoadMoreItems()

->startscanentry()
before calling collectMatchBitmap()

>scanPostingTree()
after acquiring a shared lock on a leaf page

2. CheckForSerializableConflictIn()

->ginentryinsert()

->gininsertitempointers()
in case of insertion in a posting tree

3. PredicateLockPageSplit()

->dataBeginPlacetoPageLeaf()
after calling dataPlacetoPageLeafSplit()

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

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Langote 2017-07-05 00:13:00 Re: Add support for tuple routing to foreign partitions
Previous Message Kuntal Ghosh 2017-07-04 18:43:08 Re: WIP patch: distinguish selectivity of < from <= and > from >=