RE: [BUG]Invalidate relcache when setting REPLICA IDENTITY
Zhijie Hou (Fujitsu) <houzj.fnst@fujitsu.com>
From: "houzj.fnst@fujitsu.com" <houzj.fnst@fujitsu.com>
To: Euler Taveira <euler@eulerto.com>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>, "tanghy.fnst@fujitsu.com" <tanghy.fnst@fujitsu.com>, Amit Kapila <amit.kapila16@gmail.com>
Date: 2021-11-12T04:57:33Z
Lists: pgsql-hackers
Attachments
- v5-0001-Invalidate-relcache-entry-when-changing-REPLICA-IDEN.patch (application/octet-stream) patch v5-0001
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
Commits
-
Invalidate relcache when changing REPLICA IDENTITY index.
- 2c0443c59570 10.20 landed
- 40fb634b1a7b 11.15 landed
- 9816e2d31826 12.10 landed
- 63c3eeddc2db 13.6 landed
- 232fd72a5eab 14.2 landed
- 354a1f8d220f 15.0 landed