Обсуждение: Deadlock during CREATE INDEX CONCURRENTLY, but index still created

Поиск
Список
Период
Сортировка

Deadlock during CREATE INDEX CONCURRENTLY, but index still created

От
Florian Weimer
Дата:
I've run two CREATE INDEX CONCURRENTLY on the same table in parallel,
and one of them errored out with:

2011-05-18 14:30:06.645 UTC bfk 23530 postgres ERROR:  deadlock
  detected
2011-05-18 14:30:06.645 UTC bfk 23530 postgres DETAIL:  Process
  23530 waits for ShareLock on virtual transaction 9/28523127; blocked by
  process 26612.
        Process 26612 waits for ShareUpdateExclusiveLock on relation
        229701 of database 229155; blocked by process 23530.
        Process 23530: CREATE INDEX CONCURRENTLY idx1 ON tbl (col1);
        Process 26612: CREATE INDEX CONCURRENTLY idx2 ON tbl (col);

The curious thing is that both indexes were created.  I would have
expected that the creation of idx1 would be rolled back.

Are both of the usable, or should I re-create idx1 from scratch?

This is with PostgreSQL 8.4.7.  (The changelog for 8.4.8 does not list
anything which appears to be relevant.)

--
Florian Weimer                <fweimer@bfk.de>
BFK edv-consulting GmbH       http://www.bfk.de/
Kriegsstraße 100              tel: +49-721-96201-1
D-76133 Karlsruhe             fax: +49-721-96201-99

Re: Deadlock during CREATE INDEX CONCURRENTLY, but index still created

От
Scott Marlowe
Дата:
On Wed, May 18, 2011 at 9:19 AM, Florian Weimer <fweimer@bfk.de> wrote:
> I've run two CREATE INDEX CONCURRENTLY on the same table in parallel,
> and one of them errored out with:
> The curious thing is that both indexes were created.  I would have
> expected that the creation of idx1 would be rolled back.
>
> Are both of the usable, or should I re-create idx1 from scratch?

They should be marked invalid.

Re: Deadlock during CREATE INDEX CONCURRENTLY, but index still created

От
Florian Weimer
Дата:
* Scott Marlowe:

> On Wed, May 18, 2011 at 9:19 AM, Florian Weimer <fweimer@bfk.de> wrote:
>> I've run two CREATE INDEX CONCURRENTLY on the same table in parallel,
>> and one of them errored out with:
>> The curious thing is that both indexes were created.  I would have
>> expected that the creation of idx1 would be rolled back.
>>
>> Are both of the usable, or should I re-create idx1 from scratch?
>
> They should be marked invalid.

Ah, thanks, I see it now.  I guess this answers my question. 8-)

--
Florian Weimer                <fweimer@bfk.de>
BFK edv-consulting GmbH       http://www.bfk.de/
Kriegsstraße 100              tel: +49-721-96201-1
D-76133 Karlsruhe             fax: +49-721-96201-99