Re: [HACKERS] btree vacuum and suspended scans can deadlock

2016-10-14 Thread Kevin Grittner
On Thu, Oct 13, 2016 at 4:44 PM, Tom Lane wrote: > I was about to suggest that maybe we didn't need cleanup locks in btree > indexes anymore now that SnapshotNow is gone, but I see that somebody > already altered nbtree/README to say this: > > : Therefore, a scan using an MVCC snapshot which has

Re: [HACKERS] btree vacuum and suspended scans can deadlock

2016-10-13 Thread Amit Kapila
On Fri, Oct 14, 2016 at 2:52 AM, Robert Haas wrote: > On Thu, Oct 13, 2016 at 6:33 AM, Amit Kapila wrote: >> If we agree that above is a problematic case, then some of the options >> to solve it could be (a) Vacuum should not wait for a cleanup lock and >> instead just give up and start again whi

Re: [HACKERS] btree vacuum and suspended scans can deadlock

2016-10-13 Thread Amit Kapila
On Fri, Oct 14, 2016 at 3:14 AM, Tom Lane wrote: > Robert Haas writes: >> On Thu, Oct 13, 2016 at 6:33 AM, Amit Kapila wrote: >>> If we agree that above is a problematic case, then some of the options >>> to solve it could be (a) Vacuum should not wait for a cleanup lock and >>> instead just giv

Re: [HACKERS] btree vacuum and suspended scans can deadlock

2016-10-13 Thread Tom Lane
Robert Haas writes: > On Thu, Oct 13, 2016 at 6:33 AM, Amit Kapila wrote: >> If we agree that above is a problematic case, then some of the options >> to solve it could be (a) Vacuum should not wait for a cleanup lock and >> instead just give up and start again which I think is a bad idea (b) >>

Re: [HACKERS] btree vacuum and suspended scans can deadlock

2016-10-13 Thread Robert Haas
On Thu, Oct 13, 2016 at 6:33 AM, Amit Kapila wrote: > If we agree that above is a problematic case, then some of the options > to solve it could be (a) Vacuum should not wait for a cleanup lock and > instead just give up and start again which I think is a bad idea (b) > don't allow to take lock of

[HACKERS] btree vacuum and suspended scans can deadlock

2016-10-13 Thread Amit Kapila
During Vacuum, cleanup in btree need to acquire cleanup lock on the block and the non-MVCC scans or scans on unlogged index retain the pin on a buffer during scan of a block. Now, if the scan is suspended (use cursor and then fetch one row) after holding a pin on a buffer in Session-1 and in Sessi