[HACKERS] GSoC 2017: weekly progress reports (week 5) and Proposal forpredicate locking in gin index - Mailing list pgsql-hackers

From Shubham Barai
Subject [HACKERS] GSoC 2017: weekly progress reports (week 5) and Proposal forpredicate locking in gin index
Date
Msg-id CALxAEPu3E5PCLRPD2YPR0nXNzRh8hjfNQiHmJJG157-6f=zc+w@mail.gmail.com
Whole thread Raw
List 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()




Sent with Mailtrack

pgsql-hackers by date:

Previous
From: Kuntal Ghosh
Date:
Subject: Re: [HACKERS] WIP patch: distinguish selectivity of < from <= and >from >=
Next
From: Amit Langote
Date:
Subject: Re: [HACKERS] Add support for tuple routing to foreign partitions