Re: Problem with logical replication

From: Euler Taveira <euler(dot)taveira(at)2ndquadrant(dot)com>
To: Masahiko Sawada <masahiko(dot)sawada(at)2ndquadrant(dot)com>
Cc: Michael Paquier <michael(at)paquier(dot)xyz>, Dilip Kumar <dilipbalaut(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Problem with logical replication
Date: 2020-05-13 00:45:45
Message-ID: CAH503wDzL6Od8QVYHtWdp2UdPZVRJbuphR7V79ckbOK14uXyXw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, 12 May 2020 at 06:36, Masahiko Sawada <
masahiko(dot)sawada(at)2ndquadrant(dot)com> wrote:

> On Mon, 11 May 2020 at 16:28, Michael Paquier <michael(at)paquier(dot)xyz> wrote:
> >
> > On Sun, May 10, 2020 at 07:08:03PM -0300, Euler Taveira wrote:
> > > I attached a patch with the described solution. I also included a test
> that
> > > covers this scenario.
> >
> > - Assert(RelationGetReplicaIndex(rel) == RelationGetRelid(idxrel));
> > + Assert(GetRelationIdentityOrPK(rel) == RelationGetRelid(idxrel));
> >
> > Not much a fan of adding a routine to relcache.c to do the work of two
> > routines already present, so I think that we had better add an extra
> > condition based on RelationGetPrimaryKeyIndex, and give up on
> > GetRelationIdentityOrPK() in execReplication.c.
>
> Although, I think this solution is fragile, I updated the patch
accordingly.
(When/If someone changed GetRelationIdentityOrPK() it will break this
assert)

> In any case, it seems to me that the comment of
> build_replindex_scan_key needs to be updated.
>
> * This is not generic routine, it expects the idxrel to be replication
> * identity of a rel and meet all limitations associated with that.
>
> It is implicit that a primary key can be a replica identity so I think this
comment is fine.

--
Euler Taveira http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

Attachment Content-Type Size
v2-0001-Fix-assert-failure-with-REPLICA-IDENTITY-FULL-in-the.patch text/x-patch 4.1 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tomas Vondra 2020-05-13 01:01:38 Re: WIP: BRIN multi-range indexes
Previous Message Peter Geoghegan 2020-05-13 00:34:32 Re: new heapcheck contrib module