Re: Support for REINDEX CONCURRENTLY

From: Andres Freund <andres(at)2ndquadrant(dot)com>
To: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
Cc: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>, Peter Eisentraut <peter_e(at)gmx(dot)net>, Fujii Masao <masao(dot)fujii(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Simon Riggs <simon(at)2ndquadrant(dot)com>
Subject: Re: Support for REINDEX CONCURRENTLY
Date: 2013-03-06 12:31:37
Message-ID: 20130306123137.GN13803@alap2.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2013-03-06 21:19:57 +0900, Michael Paquier wrote:
> On Wed, Mar 6, 2013 at 9:09 PM, Andres Freund <andres(at)2ndquadrant(dot)com>wrote:
>
> > On 2013-03-06 20:59:37 +0900, Michael Paquier wrote:
> > > OK. Patches updated... Please see attached.
> > > With all the work done on those patches, I suppose this is close to being
> > > something clean...
> >
> > Yes, its looking good. There are loads of improvements possible but
> > those can very well be made incrementally.
> > > > I have the feeling we are talking past each other. Unless I miss
> > > > something *there is no* WaitForMultipleVirtualLocks between phase 2 and
> > > > 3. But one WaitForMultipleVirtualLocks for all would be totally
> > > > sufficient.
> > > >
> > > OK, sorry for the confusion. I added a call to
> > WaitForMultipleVirtualLocks
> > > also before phase 3.
> > > Honestly, I am still not very comfortable with the fact that the
> > ShareLock
> > > wait on parent relation is done outside each index transaction for build
> > > and validation... Changed as requested though...
> >
> > Could you detail your concerns a bit? I tried to think it through
> > multiple times now and I still can't see a problem. The lock only
> > ensures that nobody has the relation open with the old index definition
> > in mind...
> >
> I am making a comparison with CREATE INDEX CONCURRENTLY where the ShareLock
> wait is made inside the build and validation transactions. Was there any
> particular reason why CREATE INDEX CONCURRENTLY wait is done inside a
> transaction block?
> That's my only concern.

Well, it needs to be executed in a transaction because it needs a valid
resource owner and a previous CommitTransactionCommand() will leave that
at NULL. And there is no reason in the single-index case of CREATE INDEX
CONCURRENTLY to do it in a separate transaction.

Greetings,

Andres Freund

--
Andres Freund http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Stephen Frost 2013-03-06 13:17:03 Re: WIP: index support for regexp search
Previous Message Michael Paquier 2013-03-06 12:19:57 Re: Support for REINDEX CONCURRENTLY