Re: [ADMIN] Simultaneous index creates on different schemas cause deadlock?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Andres Freund <andres(at)2ndquadrant(dot)com>
Cc: Paul Hinze <paul(dot)t(dot)hinze(at)gmail(dot)com>, pgsql-admin(at)postgresql(dot)org, pgsql-hackers(at)postgresql(dot)org
Subject: Re: [ADMIN] Simultaneous index creates on different schemas cause deadlock?
Date: 2013-04-25 18:50:21
Message-ID: 14978.1366915821@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin pgsql-hackers

Andres Freund <andres(at)2ndquadrant(dot)com> writes:
> On 2013-04-25 13:17:31 -0400, Tom Lane wrote:
>> Since we know that C.I.C. executes in its own transaction, and there
>> can't be more than one on the same table due to locking, it seems to me
>> that it'd be safe to drop our own snapshot before waiting for other
>> xacts to end. That is, we could just rearrange the last few steps in
>> DefineIndex(), taking care to save snapshot->xmin before we destroy the
>> snapshot so that we still have that value to pass to
>> GetCurrentVirtualXIDs().
>>
>> Anybody see a flaw in that solution?

> Except that it still will unnecessarily wait for other CICs, just not
> deadlock, I don't see a problem. We could have a PROC_IN_CIC flag or
> something so we can ignore other index creations, but I am not sure if
> its worth the complication.

I'm not sure it's a good idea to ignore other CICs altogether --- they
could be executing user-defined index functions that do strange things
like consult other tables. Since this seems to me to be a bit outside
the intended use-case for CIC anyway, I think it's good enough if they
just don't deadlock.

regards, tom lane

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message anarazel@anarazel.de 2013-04-25 18:57:43 Re: [ADMIN] Simultaneous index creates on different schemas cause deadlock?
Previous Message Andres Freund 2013-04-25 17:34:46 Re: [HACKERS] Simultaneous index creates on different schemas cause deadlock?

Browse pgsql-hackers by date

  From Date Subject
Next Message anarazel@anarazel.de 2013-04-25 18:57:43 Re: [ADMIN] Simultaneous index creates on different schemas cause deadlock?
Previous Message Tom Lane 2013-04-25 17:56:53 Re: libpq COPY handling