Re: [HACKERS] reindex creates predicate lock on index root

2011-06-08 Thread Heikki Linnakangas
On 08.06.2011 06:37, Kevin Grittner wrote: You're right; that one was a false alarm. While REINDEX was reading the heap to build the index it got an SIREAD lock on a *heap* page. We never take locks on heap pages directly, so it must've been a promotion from heap tuple locks. While that

Re: [HACKERS] reindex creates predicate lock on index root

2011-06-08 Thread Dan Ports
On Tue, Jun 07, 2011 at 10:14:30PM -0400, Tom Lane wrote: Do you mean page zero, as in the metapage (for most index types), or do you mean the root page? If the former, how is that not an outright bug, since it corresponds to no data? If the latter, how is that not a serious performance

Re: [HACKERS] reindex creates predicate lock on index root

2011-06-08 Thread Robert Haas
On Wed, Jun 8, 2011 at 4:59 AM, Dan Ports d...@csail.mit.edu wrote: On Tue, Jun 07, 2011 at 10:14:30PM -0400, Tom Lane wrote: Do you mean page zero, as in the metapage (for most index types), or do you mean the root page?  If the former, how is that not an outright bug, since it corresponds to

Re: [HACKERS] reindex creates predicate lock on index root

2011-06-08 Thread Kevin Grittner
Robert Haas robertmh...@gmail.com wrote: I'm wondering if this shouldn't be linked to whether the scan is using an MVCC snapshot, rather than inserting exceptions for specific operations. Yeah, that was raised before somewhere and I spaced it. Grabbing predicate locks for non-MVCC

Re: [HACKERS] reindex creates predicate lock on index root

2011-06-08 Thread Tom Lane
Kevin Grittner kevin.gritt...@wicourts.gov writes: *** a/src/backend/storage/lmgr/predicate.c --- b/src/backend/storage/lmgr/predicate.c *** *** 274,279 --- 274,280 #define SkipSerialization(relation) \ ((!IsolationIsSerializable()) \ ||

Re: [HACKERS] reindex creates predicate lock on index root

2011-06-08 Thread Heikki Linnakangas
On 08.06.2011 18:09, Kevin Grittner wrote: Robert Haasrobertmh...@gmail.com wrote: I'm wondering if this shouldn't be linked to whether the scan is using an MVCC snapshot, rather than inserting exceptions for specific operations. Yeah, that was raised before somewhere and I spaced it.

Re: [HACKERS] reindex creates predicate lock on index root

2011-06-08 Thread Kevin Grittner
Heikki Linnakangas heikki.linnakan...@enterprisedb.com wrote: The attached patch has not yet been tested, but I'll test it today along with the latest committed code. You can't use GetActiveSnapshot() for this. Yeah, it didn't take much testing to find that out. I had a naive assumption

Re: [HACKERS] reindex creates predicate lock on index root

2011-06-08 Thread Tom Lane
Kevin Grittner kevin.gritt...@wicourts.gov writes: Heikki Linnakangas heikki.linnakan...@enterprisedb.com wrote: You can have one snapshot pushed to the active snapshot stack, and do a DDL operation like reindex using a different snapshot. You'll have to check the snapshot in the HeapScanDesc.

Re: [HACKERS] reindex creates predicate lock on index root

2011-06-08 Thread Kevin Grittner
Tom Lane t...@sss.pgh.pa.us wrote: Kevin Grittner kevin.gritt...@wicourts.gov writes: *** a/src/backend/storage/lmgr/predicate.c --- b/src/backend/storage/lmgr/predicate.c *** *** 274,279 --- 274,280 #define SkipSerialization(relation) \

[HACKERS] reindex creates predicate lock on index root

2011-06-07 Thread Kevin Grittner
During testing of the SSI DDL changes I noticed that a REINDEX INDEX created a predicate lock on page 0 of the index. This is pretty harmless, but mildly annoying. There are a few other places where it would be good to suppress predicate locks; these are listed on the RD section of the Wiki. I

Re: [HACKERS] reindex creates predicate lock on index root

2011-06-07 Thread Tom Lane
Kevin Grittner kevin.gritt...@wicourts.gov writes: During testing of the SSI DDL changes I noticed that a REINDEX INDEX created a predicate lock on page 0 of the index. This is pretty harmless, but mildly annoying. There are a few other places where it would be good to suppress predicate

Re: [HACKERS] reindex creates predicate lock on index root

2011-06-07 Thread Dan Ports
On Tue, Jun 07, 2011 at 07:45:43PM -0500, Kevin Grittner wrote: During testing of the SSI DDL changes I noticed that a REINDEX INDEX created a predicate lock on page 0 of the index. Really? That surprises me, and I couldn't reproduce it just now. Dan -- Dan R. K. Ports MIT CSAIL

Re: [HACKERS] reindex creates predicate lock on index root

2011-06-07 Thread Kevin Grittner
Dan Ports wrote: On Tue, Jun 07, 2011 at 07:45:43PM -0500, Kevin Grittner wrote: During testing of the SSI DDL changes I noticed that a REINDEX INDEX created a predicate lock on page 0 of the index. Really? That surprises me, and I couldn't reproduce it just now. You're right; that one

Re: [HACKERS] reindex creates predicate lock on index root

2011-06-07 Thread Alvaro Herrera
Excerpts from Kevin Grittner's message of mar jun 07 20:45:43 -0400 2011: During testing of the SSI DDL changes I noticed that a REINDEX INDEX created a predicate lock on page 0 of the index. Err, in a btree, page 0 is the metapage, not the root. The root page moves around, but it's never page