Re: [HACKERS] GSoC 2017: weekly progress reports (week 6)

2018-05-04 Thread Teodor Sigaev
Thanks to everyone, v3 is pushed. Teodor Sigaev wrote: I don't very happy with rootBuffer added everywhere. ginInsertItemPointers() and   ginPrepareDataScan() now take both args, rootBlkno and rootBuffer, second could be invalid. As I can see, you did it to call CheckForSerializableConflictIn(

Re: [HACKERS] GSoC 2017: weekly progress reports (week 6)

2018-04-28 Thread Teodor Sigaev
I don't very happy with rootBuffer added everywhere. ginInsertItemPointers() and  ginPrepareDataScan() now take both args, rootBlkno and rootBuffer, second could be invalid. As I can see, you did it to call CheckForSerializableConflictIn() in ginEntryInsert(). Seems, it could be reverted and C

Re: [HACKERS] GSoC 2017: weekly progress reports (week 6)

2018-04-28 Thread Teodor Sigaev
I took a stab at fixing those issues, as well as the bug when fastupdate is turned on concurrently. Does the attached patch look sane to you? That's look sane, and I believe it should be applied but I see some issue in your patch: I don't very happy with rootBuffer added everywhere. ginInsertIt

Re: [HACKERS] GSoC 2017: weekly progress reports (week 6)

2018-04-09 Thread Andrey Borodin
> 9 апр. 2018 г., в 23:04, Heikki Linnakangas написал(а): > > On 09/04/18 18:21, Andrey Borodin wrote: >>> 9 апр. 2018 г., в 19:50, Teodor Sigaev >>> написал(а): 3. Why do we *not* lock the entry leaf page, if there is no match? We still need a lock to remember that we probed for tha

Re: [HACKERS] GSoC 2017: weekly progress reports (week 6)

2018-04-09 Thread Heikki Linnakangas
On 09/04/18 18:21, Andrey Borodin wrote: 9 апр. 2018 г., в 19:50, Teodor Sigaev написал(а): 3. Why do we *not* lock the entry leaf page, if there is no match? We still need a lock to remember that we probed for that value and there was no match, so that we conflict with a tuple that might be

Re: [HACKERS] GSoC 2017: weekly progress reports (week 6)

2018-04-09 Thread Heikki Linnakangas
On 09/04/18 18:04, Alvaro Herrera wrote: Heikki Linnakangas wrote: Remember, the purpose of predicate locks is to lock key ranges, not physical pages or tuples in the index. We use leaf pages as handy shortcut for "any key value that would belong on this page", but it is just an implementation

Re: [HACKERS] GSoC 2017: weekly progress reports (week 6)

2018-04-09 Thread Teodor Sigaev
Alvaro Herrera wrote: Heikki Linnakangas wrote: Remember, the purpose of predicate locks is to lock key ranges, not physical pages or tuples in the index. We use leaf pages as handy shortcut for "any key value that would belong on this page", but it is just an implementation detail. Hmm ...

Re: [HACKERS] GSoC 2017: weekly progress reports (week 6)

2018-04-09 Thread Andrey Borodin
> 9 апр. 2018 г., в 19:50, Teodor Sigaev написал(а): >> >> 3. Why do we *not* lock the entry leaf page, if there is no match? We still >> need a lock to remember that we probed for that value and there was no >> match, so that we conflict with a tuple that might be inserted later. >> At least

Re: [HACKERS] GSoC 2017: weekly progress reports (week 6)

2018-04-09 Thread Alvaro Herrera
Heikki Linnakangas wrote: > Remember, the purpose of predicate locks is to lock key ranges, not physical > pages or tuples in the index. We use leaf pages as handy shortcut for "any > key value that would belong on this page", but it is just an implementation > detail. Hmm ... so, thinking about

Re: [HACKERS] GSoC 2017: weekly progress reports (week 6)

2018-04-09 Thread Alexander Korotkov
Hi! Thank you for taking a look at this patch. I really appreciate your attention over complex subjects like this. On Mon, Apr 9, 2018 at 1:33 PM, Heikki Linnakangas wrote: > On 28/03/18 19:53, Teodor Sigaev wrote: > >> As I understand, scan should lock any visited page, but now it's true >> o

Re: [HACKERS] GSoC 2017: weekly progress reports (week 6)

2018-04-09 Thread Teodor Sigaev
Hi! 1. Why do we lock all posting tree pages, even though they all represent the same value? Isn't it enough to lock the root of the posting tree? 2. Why do we lock any posting tree pages at all, if we lock the entry tree page anyway? Isn't the lock on the entry tree page sufficient to cover t

Re: [HACKERS] GSoC 2017: weekly progress reports (week 6)

2018-04-09 Thread Teodor Sigaev
Ugh, I miss your last email where you another locking protocol. Reading. Teodor Sigaev wrote: Attached is a test case that demonstrates a case where we miss a serialization failure, when fastupdate is turned on concurrently. It works on v10, but fails to throw a serialization error on v11. Tha

Re: [HACKERS] GSoC 2017: weekly progress reports (week 6)

2018-04-09 Thread Teodor Sigaev
Attached is a test case that demonstrates a case where we miss a serialization failure, when fastupdate is turned on concurrently. It works on v10, but fails to throw a serialization error on v11. Thank you for reserching! Proof of concept: diff --git a/src/backend/commands/tablecmds.c b/src/ba

Re: [HACKERS] GSoC 2017: weekly progress reports (week 6)

2018-04-09 Thread Heikki Linnakangas
On 28/03/18 19:53, Teodor Sigaev wrote: Hi! I slightly modified test for clean demonstration of difference between fastupdate on and off. Also I added CheckForSerializableConflictIn() to fastupdate off codepath, but only in case of non-empty pending list. The next question what I see: why do no

Re: [HACKERS] GSoC 2017: weekly progress reports (week 6)

2018-04-08 Thread Heikki Linnakangas
On 16/03/18 00:26, Alexander Korotkov wrote: On Tue, Mar 13, 2018 at 3:26 PM, Andrey Borodin wrote: On 13/03/18 14:02, Alexander Korotkov wrote: And what happen if somebody concurrently set (fastupdate = on)? Can we miss conflicts because of that? No, AccessExclusiveLock will prevent this ki

Re: [HACKERS] GSoC 2017: weekly progress reports (week 6)

2018-03-30 Thread Tom Lane
I wrote: > prion doesn't like this patch, which probably means that something is > trying to use the content of a relcache entry after having closed it. Oh, sorry, scratch that --- looking closer, it was failing before this. regards, tom lane

Re: [HACKERS] GSoC 2017: weekly progress reports (week 6)

2018-03-30 Thread Tom Lane
Teodor Sigaev writes: > Thanks for everyone, pushed prion doesn't like this patch, which probably means that something is trying to use the content of a relcache entry after having closed it. regards, tom lane

Re: [HACKERS] GSoC 2017: weekly progress reports (week 6)

2018-03-30 Thread Teodor Sigaev
Thanks for everyone, pushed Oh, right, that makes sense. I'm not sure that the comments explain this sufficiently -- I think it'd be good to expand that. I improved comments Given this patch, it seems clear that serializable mode is much worse with fastupdate than without it! That's true. An

Re: [HACKERS] GSoC 2017: weekly progress reports (week 6)

2018-03-29 Thread Alvaro Herrera
Teodor Sigaev wrote: > > Alvaro Herrera wrote: > > I don't quite understand the new call in gininsert -- I mean I see that > > it wants to check for conflicts even when fastupdate is set, but why? > If fastupdate is set then we check conflict with whole index, not a > particular pages in it. Predi

Re: [HACKERS] GSoC 2017: weekly progress reports (week 6)

2018-03-29 Thread Teodor Sigaev
Alvaro Herrera wrote: I don't quite understand the new call in gininsert -- I mean I see that it wants to check for conflicts even when fastupdate is set, but why? If fastupdate is set then we check conflict with whole index, not a particular pages in it. Predicate lock on penging list pages w

Re: [HACKERS] GSoC 2017: weekly progress reports (week 6)

2018-03-29 Thread Alexander Korotkov
On Thu, Mar 29, 2018 at 1:38 PM, Teodor Sigaev wrote: > The next question what I see: why do not we lock entry leaf pages in some >> cases? >> > > I've modified patch to predicate lock each leaf (entry or posting) page. > Now patch reaches commitable state from my point view. I made some enhanc

Re: [HACKERS] GSoC 2017: weekly progress reports (week 6)

2018-03-29 Thread Alvaro Herrera
I don't quite understand the new call in gininsert -- I mean I see that it wants to check for conflicts even when fastupdate is set, but why? Maybe, just maybe, it would be better to add a new flag to the GinCheckForSerializableConflictIn function, that's passed differently for this one callsite, a

Re: [HACKERS] GSoC 2017: weekly progress reports (week 6)

2018-03-29 Thread Teodor Sigaev
The next question what I see: why do not we lock entry leaf pages in some cases? I've modified patch to predicate lock each leaf (entry or posting) page. Now patch reaches commitable state from my point view. -- Teodor Sigaev E-mail: teo...@sigaev.ru

Re: [HACKERS] GSoC 2017: weekly progress reports (week 6)

2018-03-28 Thread Teodor Sigaev
Hi! I slightly modified test for clean demonstration of difference between fastupdate on and off. Also I added CheckForSerializableConflictIn() to fastupdate off codepath, but only in case of non-empty pending list. The next question what I see: why do not we lock entry leaf pages in some cas

Re: [HACKERS] GSoC 2017: weekly progress reports (week 6)

2018-03-28 Thread Dmitry Ivanov
I'd like to see fastupdate=on in test too, now tests cover only case without fastupdate. Please, add them. Here's a couple of tests for pending list (fastupdate = on). By the way, isn't it strange that permutation "fu1" "rxy3" "wx3" "rxy4" "c1" "wy4" "c2" doesn't produce an ERROR? -- Dmitry

Re: [HACKERS] GSoC 2017: weekly progress reports (week 6)

2018-03-28 Thread Dmitry Ivanov
I'd like to see fastupdate=on in test too, now tests cover only case without fastupdate. Please, add them. Here's a couple of tests for pending list (fastupdate = on). -- Dmitry Ivanov Postgres Professional: http://www.postgrespro.com The Russian Postgres Companydiff --git a/src/backend/access/

Re: [HACKERS] GSoC 2017: weekly progress reports (week 6)

2018-03-23 Thread Teodor Sigaev
Hi! Patch seems good, but I found one bug in it, in fact, nobody checks serializible conflict with fastupdate=on: gininsert() { if (GinGetUseFastUpdate()) { /* two next lines are GinCheckForSerializableConflictIn() */ if (!GinGetUseFastUpdate())

Re: [HACKERS] GSoC 2017: weekly progress reports (week 6)

2018-03-16 Thread Shubham Barai
On 16 March 2018 at 03:57, Alexander Korotkov wrote: > On Tue, Mar 13, 2018 at 3:25 PM, Alvaro Herrera > wrote: > >> Alexander Korotkov wrote: >> >> > And what happen if somebody concurrently set (fastupdate = on)? >> > Can we miss conflicts because of that? >> >> I think it'd be better to have

Re: [HACKERS] GSoC 2017: weekly progress reports (week 6)

2018-03-15 Thread Alexander Korotkov
On Tue, Mar 13, 2018 at 3:25 PM, Alvaro Herrera wrote: > Alexander Korotkov wrote: > > > And what happen if somebody concurrently set (fastupdate = on)? > > Can we miss conflicts because of that? > > I think it'd be better to have that option require AccessExclusive lock, > so that it can never b

Re: [HACKERS] GSoC 2017: weekly progress reports (week 6)

2018-03-15 Thread Alexander Korotkov
On Tue, Mar 13, 2018 at 3:26 PM, Andrey Borodin wrote: > > 13 марта 2018 г., в 17:02, Alexander Korotkov > написал(а): > > > > BTW to BTW. I think we should check pending list size with > GinGetPendingListCleanupSize() here > > + > > + /* > > +* If fast update is enabled, we acquir

Re: [HACKERS] GSoC 2017: weekly progress reports (week 6)

2018-03-13 Thread Andrey Borodin
> 13 марта 2018 г., в 17:02, Alexander Korotkov > написал(а): > > BTW to BTW. I think we should check pending list size with > GinGetPendingListCleanupSize() here > + > + /* > +* If fast update is enabled, we acquire a predicate lock on the > entire > +* relation as fas

Re: [HACKERS] GSoC 2017: weekly progress reports (week 6)

2018-03-13 Thread Alvaro Herrera
Alexander Korotkov wrote: > And what happen if somebody concurrently set (fastupdate = on)? > Can we miss conflicts because of that? I think it'd be better to have that option require AccessExclusive lock, so that it can never be changed concurrently with readers. Seems to me that penalizing eve

Re: [HACKERS] GSoC 2017: weekly progress reports (week 6)

2018-03-13 Thread Alexander Korotkov
On Mon, Mar 12, 2018 at 9:47 AM, Andrey Borodin wrote: > > 12 марта 2018 г., в 1:54, Alexander Korotkov > написал(а): > > > > On Wed, Mar 7, 2018 at 8:30 PM, Alvaro Herrera > wrote: > > I suggest to create a new function GinPredicateLockPage() that checks > > whether fast update is enabled for

Re: [HACKERS] GSoC 2017: weekly progress reports (week 6)

2018-03-11 Thread Andrey Borodin
> 12 марта 2018 г., в 1:54, Alexander Korotkov > написал(а): > > On Wed, Mar 7, 2018 at 8:30 PM, Alvaro Herrera > wrote: > I suggest to create a new function GinPredicateLockPage() that checks > whether fast update is enabled for the index. The current arrangement > looks too repetitive and

Re: [HACKERS] GSoC 2017: weekly progress reports (week 6)

2018-03-11 Thread Alexander Korotkov
On Wed, Mar 7, 2018 at 8:30 PM, Alvaro Herrera wrote: > I suggest to create a new function GinPredicateLockPage() that checks > whether fast update is enabled for the index. The current arrangement > looks too repetitive and it seems easy to make a mistake. > BTW, should we also skip CheckForSe

Re: [HACKERS] GSoC 2017: weekly progress reports (week 6)

2018-03-08 Thread Shubham Barai
On 07-Mar-2018 11:00 PM, "Alvaro Herrera" wrote: I suggest to create a new function GinPredicateLockPage() that checks whether fast update is enabled for the index. The current arrangement looks too repetitive and it seems easy to make a mistake. Stylistically, please keep #include lines ordere

Re: GSoC 2017: weekly progress reports (week 6)

2018-03-07 Thread Andres Freund
Hi, On 2018-03-07 11:58:51 -0300, Alvaro Herrera wrote: > > This appears to be a duplicate of > > https://commitfest.postgresql.org/17/1466/ - as the other one is older, I'm > > closing this one. > > This comment makes no sense from the POV of the mail archives. I had to > look at the User-Age

Re: [HACKERS] GSoC 2017: weekly progress reports (week 6)

2018-03-07 Thread Alvaro Herrera
I suggest to create a new function GinPredicateLockPage() that checks whether fast update is enabled for the index. The current arrangement looks too repetitive and it seems easy to make a mistake. Stylistically, please keep #include lines ordered alphabetically, and cut long lines to below 80 ch

Re: GSoC 2017: weekly progress reports (week 6)

2018-03-07 Thread Alvaro Herrera
Andres Freund wrote: > This appears to be a duplicate of https://commitfest.postgresql.org/17/1466/ > - as the other one is older, I'm closing this one. This comment makes no sense from the POV of the mail archives. I had to look at the User-Agent in your email to realize that you wrote it in t

Re: [HACKERS] GSoC 2017: weekly progress reports (week 6)

2018-03-07 Thread Andrey Borodin
Hi! > 28 февр. 2018 г., в 22:19, Shubham Barai > написал(а): > > Sure. I have attached a rebased version I've looked into the code closely again. The patch is heavily reworked since GSoC state :) Tests are looking fine and locking is fine-grained. But there is one thing I could not understand

Re: GSoC 2017: weekly progress reports (week 6)

2018-03-01 Thread Andres Freund
This appears to be a duplicate of https://commitfest.postgresql.org/17/1466/ - as the other one is older, I'm closing this one.

Re: [HACKERS] GSoC 2017: weekly progress reports (week 6)

2018-02-28 Thread Shubham Barai
On 28 February 2018 at 05:51, Thomas Munro wrote: > On Wed, Jan 3, 2018 at 4:31 AM, Shubham Barai > wrote: > > I have created new isolation tests. Please have a look at > > updated patch. > > Hi Shubham, > > Could we please have a rebased version of the gin one? > Sure. I have attached a rebase

Re: [HACKERS] GSoC 2017: weekly progress reports (week 6)

2018-02-27 Thread Thomas Munro
On Wed, Jan 3, 2018 at 4:31 AM, Shubham Barai wrote: > I have created new isolation tests. Please have a look at > updated patch. Hi Shubham, Could we please have a rebased version of the gin one? -- Thomas Munro http://www.enterprisedb.com

Re: [HACKERS] GSoC 2017: weekly progress reports (week 6)

2018-01-02 Thread Shubham Barai
On 2 October 2017 at 22:21, Alexander Korotkov wrote: > On Sun, Oct 1, 2017 at 11:53 AM, Shubham Barai > wrote: > >> Yes, page-level predicate locking should happen only when fast update is >> off. >> Actually, I forgot to put conditions in updated patch. Does everything >> else look ok ? >> > >

Re: [HACKERS] GSoC 2017: weekly progress reports (week 6)

2017-11-28 Thread Michael Paquier
On Tue, Oct 3, 2017 at 1:51 AM, Alexander Korotkov wrote: > I think that isolation tests should be improved. It doesn't seems that any > posting tree would be generated by the tests that you've provided, because > all the TIDs could fit the single posting list. Note, that you can get some > insi