RE: Added schema level support for publication.
tanghy.fnst@fujitsu.com <tanghy.fnst@fujitsu.com>
From: "tanghy.fnst@fujitsu.com" <tanghy.fnst@fujitsu.com>
To: vignesh C <vignesh21@gmail.com>
Cc: Rahila Syed <rahilasyed90@gmail.com>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>, Ajin Cherian <itsajin@gmail.com>
Date: 2021-06-30T09:49:43Z
Lists: pgsql-hackers
On Tuesday, June 29, 2021 11:25 AM tanghy.fnst@fujitsu.com <tanghy.fnst@fujitsu.com> wrote: > > Thanks for your patch. The warnings are fixed. > > But I found an issue while using your V8 patch, which is similar to [1]. The case > is as below: > Drop a schema from publication and refresh publication at subscriber, then > insert into publisher table, the inserts still replicated to subscriber. The expect > result is that the data is no longer replicated. > I also saw a problem while using "ALTER PUBLICATION ... ADD SCHEMA ...". The case is as below: Add a schema to publication, then refresh publication at subscriber. Insert into publisher table, the inserts couldn't replicate to subscriber. Steps to reproduce the case: ------publisher------ CREATE PUBLICATION testpub FOR SCHEMA public; ------subscriber------ CREATE SUBSCRIPTION testsub CONNECTION 'dbname=postgres port=5432' PUBLICATION testpub; ------publisher------ CREATE SCHEMA s1; CREATE TABLE s1.t1 (a int PRIMARY KEY); insert into s1.t1 values (1); ALTER PUBLICATION testpub ADD SCHEMA s1; ------subscriber------ CREATE SCHEMA s1; CREATE TABLE s1.t1 (a int PRIMARY KEY); ALTER SUBSCRIPTION testsub REFRESH PUBLICATION; postgres=# SELECT * FROM s1.t1; a --- 1 (1 row) ------publisher------ insert into s1.t1 values (2); ------subscriber------ postgres=# SELECT * FROM s1.t1; a --- 1 (1 row) when I executed "ALTER PUBLICATION ... ADD TABLE ...", rel_sync_cache_publication_cb callback function set replicate_valid to false, then it would validate the entry in get_rel_sync_entry function, and marked the pubactions to true. so it worked ok. In the case of "ALTER PUBLICATION ... ADD SCHEMA ...", replicate_valid would not be set to false. Because of this, the pubactions were still false in get_rel_sync_entry function. So I think the reason for it is similar to the one I reported before [1]. [1] https://www.postgresql.org/message-id/OS0PR01MB61134B20314DE45795DD384CFB029%40OS0PR01MB6113.jpnprd01.prod.outlook.com Regards Tang
Commits
-
Include schema/table publications even with exclude options in dump.
- 4aa6fa3cd0a2 18.0 landed
-
Rename some enums to use TABLE instead of REL.
- b3812d0b9bcf 15.0 landed
-
Add tap tests for the schema publications.
- 6b0f6f79eef2 15.0 landed
-
Allow publishing the tables of schema.
- 5a2832465fd8 15.0 landed
-
In pg_dump, use simplehash.h to look up dumpable objects by OID.
- 92316a4582a5 15.0 cited