> On Fri, Feb 15, 2019 at 10:02 PM Alvaro Herrera <alvherre@2ndquadrant.com> wrote:
>
> On 2019-Feb-07, Dmitry Dolgov wrote:
>
> > Could there be a race condition somewhere? The idea and the code looks
> > reasonable, but when I'm testing ALTER TABLE ... REPLICA IDENTITY with this
> > patch and concurrent partition creation, I've got the following error on ATTACH
> > PARTITION:
> >
> > ERROR: 42P17: replica index does not exist in partition "test373"
> > LOCATION: MatchReplicaIdentity, tablecmds.c:15018
> >
> > This error seems unstable, other time I've got a deadlock. And I don't observe
> > this behaviour on the master.
>
> Can you share your reproducer?
Sure, I was running concurrently the attached script, that creates a chain of
nested partitions test1,test2,..., and in a separate session:
alter table test1 replica identity full;
Checking this time, I've got from the script:
ERROR: 40P01: deadlock detected
DETAIL: Process 10547 waits for AccessShareLock on relation 30449
of database
29898; blocked by process 9714.
Process 9714 waits for AccessExclusiveLock on relation 30454 of
database 29898;
blocked by process 10547.
HINT: See server log for query details.
LOCATION: DeadLockReport, deadlock.c:1140
Time: 1001.917 ms (00:01.002)