Re: [BUG]Invalidate relcache when setting REPLICA IDENTITY

From: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
To: "houzj(dot)fnst(at)fujitsu(dot)com" <houzj(dot)fnst(at)fujitsu(dot)com>
Cc: Euler Taveira <euler(at)eulerto(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, "tanghy(dot)fnst(at)fujitsu(dot)com" <tanghy(dot)fnst(at)fujitsu(dot)com>
Subject: Re: [BUG]Invalidate relcache when setting REPLICA IDENTITY
Date: 2021-11-12 05:20:14
Message-ID: CAA4eK1+4ZygC9__M6d-rxTe-squk3L26D6zuyuZdaHRygioeKA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Nov 12, 2021 at 10:27 AM houzj(dot)fnst(at)fujitsu(dot)com
<houzj(dot)fnst(at)fujitsu(dot)com> wrote:
>
> On Friday, November 12, 2021 10:46 AM I wrote:
> > On Friday, November 12, 2021 8:15 AM Euler Taveira <euler(at)eulerto(dot)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.
>

But won't that generate invalidation for the rel twice in the case
(change Replica Identity from Nothing to some index) you mentioned in
the previous email?

--
With Regards,
Amit Kapila.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2021-11-12 05:32:55 Re: [BUG]Invalidate relcache when setting REPLICA IDENTITY
Previous Message houzj.fnst@fujitsu.com 2021-11-12 04:57:33 RE: [BUG]Invalidate relcache when setting REPLICA IDENTITY