Re: [BUG]Invalidate relcache when setting REPLICA IDENTITY

From: "Euler Taveira" <euler(at)eulerto(dot)com>
To: "houzj(dot)fnst(at)fujitsu(dot)com" <houzj(dot)fnst(at)fujitsu(dot)com>, "Amit Kapila" <amit(dot)kapila16(at)gmail(dot)com>
Cc: 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 00:14:45
Message-ID: 0fe01530-78b1-4cbf-8af8-99f01667fe5e@www.fastmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Nov 11, 2021, at 9:01 AM, houzj(dot)fnst(at)fujitsu(dot)com wrote:
> Also attach the patches for back branch and remove some unnecessary
> changes from pgindent.
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?

I also modified your test case to include a DELETE command, wait the initial
table sync to avoid failing a subsequent test and improve some comments.

--
Euler Taveira
EDB https://www.enterprisedb.com/

Attachment Content-Type Size
v3-0001-Invalidate-relcache-entry-when-changing-REPLICA-I.patch text/x-patch 5.1 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2021-11-12 00:17:41 Re: simplifying foreign key/RI checks
Previous Message Alvaro Herrera 2021-11-11 23:38:50 Re: simplifying foreign key/RI checks