Re: [HACKERS] GSoC 2017: weekly progress reports (week 6) - Mailing list pgsql-hackers

From Alexander Korotkov
Subject Re: [HACKERS] GSoC 2017: weekly progress reports (week 6)
Date
Msg-id CAPpHfdvED_-7KbJp-ei4zRZu1brLgkJt4CA-uxF0iRO9WX2Sqw@mail.gmail.com
Whole thread Raw
In response to Re: [HACKERS] GSoC 2017: weekly progress reports (week 6)  (Shubham Barai <shubhambaraiss@gmail.com>)
Responses Re: [HACKERS] GSoC 2017: weekly progress reports (week 6)
List pgsql-hackers
Hi!

On Wed, Aug 9, 2017 at 6:30 PM, Shubham Barai <shubhambaraiss@gmail.com> wrote:
Please find the updated patch for predicate locking in gin index here.

There was a small issue in the previous patch. I didn't consider the case
where only root page exists in the tree, and there is a predicate lock on it,
and it gets split. 

If we treat the original page as a left page and create a new root and right
page, then we just need to copy a predicate lock from the left to the right 
page (this is the case in B-tree).

But if we treat the original page as a root and create a new left and right
page, then we need to copy a predicate lock on both new pages (in the case of rum and gin).


I've assigned to review this patch.  First of all I'd like to understand general idea of this patch.

As I get, you're placing predicate locks to both entry tree leaf pages and posting tree leaf pages.  But, GIN implements so called "fast scan" technique which allows it to skip some leaf pages of posting tree when these pages are guaranteed to not contain matching item pointers.  Wherein the particular order of posting list scan and skip depends of their estimated size (so it's a kind of coincidence).

But thinking about this more generally, I found that proposed locking scheme is redundant.  Currently when entry has posting tree, you're locking both:
1) entry tree leaf page containing pointer to posting tree,
2) leaf pages of corresponding posting tree.
Therefore conflicting transactions accessing same entry would anyway conflict while accessing the same entry tree leaf page.  So, there is no necessity to lock posting tree leaf pages at all.  Alternatively, if entry has posting tree, you can skip locking entry tree leaf page and lock posting tree leaf pages instead.

------
Alexander Korotkov
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company 

pgsql-hackers by date:

Previous
From: Pavel Stehule
Date:
Subject: Re: [HACKERS] proposal - Default namespaces for XPath expressions(PostgreSQL 11)
Next
From: Michael Paquier
Date:
Subject: Re: [HACKERS] Use of RangeVar for partitioned tables in autovacuum