RE: Added missing invalidations for all tables publication - Mailing list pgsql-hackers

From houzj.fnst@fujitsu.com
Subject RE: Added missing invalidations for all tables publication
Date
Msg-id OS0PR01MB5716AF94D9D33EABD935905594CC9@OS0PR01MB5716.jpnprd01.prod.outlook.com
Whole thread Raw
In response to Added missing invalidations for all tables publication  (vignesh C <vignesh21@gmail.com>)
Responses Re: Added missing invalidations for all tables publication  (vignesh C <vignesh21@gmail.com>)
List pgsql-hackers
From Tuesday, August 31, 2021 1:10 AM vignesh C <vignesh21@gmail.com> wrote:
> Hi,
> 
> Relation invalidation was missing in case of create publication and drop
> publication of "FOR ALL TABLES" publication, added so that the publication
> information can be rebuilt. Without these invalidation update/delete
> operations on the relation will be successful in the publisher which will later
> result in conflict in the subscriber.
> Thanks to Amit for identifying the issue at [1]. Attached patch has the fix for the
> same.
> Thoughts?

I have one comment about the testcase in the patch.

+-- Test cache invalidation FOR ALL TABLES publication
+SET client_min_messages = 'ERROR';
+CREATE TABLE testpub_tbl4(a int);
+CREATE PUBLICATION testpub_foralltables FOR ALL TABLES;
+RESET client_min_messages;
+-- fail missing REPLICA IDENTITY
+UPDATE testpub_tbl4 set a = 2;
+ERROR:  cannot update table "testpub_tbl4" because it does not have a replica identity and publishes updates
+HINT:  To enable updating the table, set REPLICA IDENTITY using ALTER TABLE.
+DROP PUBLICATION testpub_foralltables;

The above testcases can pass without the code change in the patch, is it better
to add a testcase which can show different results after applying the patch ?

Best regards,
Hou zj



pgsql-hackers by date:

Previous
From: "houzj.fnst@fujitsu.com"
Date:
Subject: RE: Separate out FileSet from SharedFileSet (was Re: pgsql: pgstat: Bring up pgstat in BaseInit() to fix uninitialized use o)
Next
From: Masahiko Sawada
Date:
Subject: Replication slot drop message is sent after pgstats shutdown.