Re: [BUG]Invalidate relcache when setting REPLICA IDENTITY

Поиск
Список
Период
Сортировка
От Amit Kapila
Тема Re: [BUG]Invalidate relcache when setting REPLICA IDENTITY
Дата
Msg-id CAA4eK1Jb4mrVWPAjGc+gOo4V3yHU-1NtpMSaH1DG4KytUvp=Cw@mail.gmail.com
обсуждение исходный текст
Ответ на Re: [BUG]Invalidate relcache when setting REPLICA IDENTITY  (Amit Kapila <amit.kapila16@gmail.com>)
Ответы RE: [BUG]Invalidate relcache when setting REPLICA IDENTITY  ("houzj.fnst@fujitsu.com" <houzj.fnst@fujitsu.com>)
Список pgsql-hackers
On Fri, Nov 12, 2021 at 10:50 AM Amit Kapila <amit.kapila16@gmail.com> wrote:
>
> On Fri, Nov 12, 2021 at 10:27 AM houzj.fnst@fujitsu.com
> <houzj.fnst@fujitsu.com> wrote:
> >
> > 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.
> >
>
> 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?
>

Oh, I see the point. I think this is okay because
AddRelcacheInvalidationMessage doesn't allow to add duplicate rel
invalidation. If that is the case I wonder why not simply register
invalidation without any check in the for loop as was the case with
Tang's original patch?


-- 
With Regards,
Amit Kapila.



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Amit Kapila
Дата:
Сообщение: Re: [BUG]Invalidate relcache when setting REPLICA IDENTITY
Следующее
От: "houzj.fnst@fujitsu.com"
Дата:
Сообщение: RE: [BUG]Invalidate relcache when setting REPLICA IDENTITY