RE: [BUG]Invalidate relcache when setting REPLICA IDENTITY - Mailing list pgsql-hackers

From houzj.fnst@fujitsu.com
Subject RE: [BUG]Invalidate relcache when setting REPLICA IDENTITY
Date
Msg-id OS0PR01MB571683D4E41904CF5D7C7B7794959@OS0PR01MB5716.jpnprd01.prod.outlook.com
Whole thread Raw
In response to RE: [BUG]Invalidate relcache when setting REPLICA IDENTITY  ("houzj.fnst@fujitsu.com" <houzj.fnst@fujitsu.com>)
Responses Re: [BUG]Invalidate relcache when setting REPLICA IDENTITY
List pgsql-hackers
On Friday, November 12, 2021 10:46 AM I wrote:
> On Friday, November 12, 2021 8:15 AM Euler Taveira <euler@eulerto.com>
> wrote:
> > I reviewed your patch and I think the fix could be simplified by
> >
> > if (OidIsValid(indexOid))
> > CacheInvalidateRelcache(rel);
> >
> > If indexOid is valid it is a REPLICA IDENTITY INDEX. A few lines above
> > there is a check for a valid indexOid that makes sure the index is
> > already marked as a replica identity; if so, it bail out. If it is
> > not, the relation should be invalidated. Am I missing something?
>
> Thanks for reviewing !
> But I am not sure it's better to simplify the code like "if (OidIsValid(indexOid))
> CacheInvalidate".

Oh, I got confused with the logic in relation_mark_replica_identity, sorry for that.
I now realize that you are right, we can just check "if (OidIsValid(indexOid))" here
to simplify the code.

Attach the new version patch which simplify the check as pointed out by Euler.

Best regards,
Hou zj




Attachment

pgsql-hackers by date:

Previous
From: Greg Nancarrow
Date:
Subject: Re: Optionally automatically disable logical replication subscriptions on error
Next
From: Amit Kapila
Date:
Subject: Re: [BUG]Invalidate relcache when setting REPLICA IDENTITY