Re: Data is copied twice when specifying both child and parent table in publication
Dilip Kumar <dilipbalaut@gmail.com>
From: Dilip Kumar <dilipbalaut@gmail.com>
To: "houzj.fnst@fujitsu.com" <houzj.fnst@fujitsu.com>
Cc: Amit Langote <amitlangote09@gmail.com>,
Greg Nancarrow <gregn4422@gmail.com>, Peter Eisentraut <peter.eisentraut@enterprisedb.com>, "pgsql-hackers@lists.postgresql.org" <pgsql-hackers@lists.postgresql.org>,
Amit Kapila <amit.kapila16@gmail.com>
Date: 2021-10-19T05:37:46Z
Lists: pgsql-hackers
On Tue, Oct 19, 2021 at 8:17 AM houzj.fnst@fujitsu.com <houzj.fnst@fujitsu.com> wrote: > Thanks for the explanation. > > I think one reason that I consider this behavior a bug is that: If we add > both the root partitioned table and the leaf partition explicitly to the > publication (and set publish_via_partition_root = on), the behavior of the > apply worker is inconsistent with the behavior of table sync worker. > > In this case, all changes in the leaf the partition will be applied using the > identity and schema of the partitioned(root) table. But for the table sync, it > will execute table sync for both the leaf and the root table which cause > duplication of data. > > Wouldn't it be better to make the behavior consistent here ? I agree with the point, whether we are doing the initial sync or we are doing transaction streaming the behavior should be the same. I think the right behavior should be that even if user has given both parent table and the child table in the published table list, it should sync it only once, because consider the case where we add a same table twice e.g (CREATE PUBLICATION mypub FOR TABLE t1,t1;) but in that case also we consider this table only once and there will be no duplicate data. -- Regards, Dilip Kumar EnterpriseDB: http://www.enterprisedb.com
Commits
-
Avoid syncing data twice for the 'publish_via_partition_root' option.
- 062a84442424 16.0 landed
-
Fix partition table's REPLICA IDENTITY checking on the subscriber.
- 52d5ea9adb01 14.5 cited
-
Prohibit combining publications with different column lists.
- fd0b9dcebda7 15.0 cited
-
Fix double publish of child table's data.
- 3f06c00cf6dc 13.6 landed
- 614b77d65a38 14.2 landed
- 5e97905a2c76 15.0 landed
-
Support adding partitioned tables to publication
- 17b9e7f9fe23 13.0 cited