RE: Data is copied twice when specifying both child and parent table in publication
Wei Wang (Fujitsu) <wangw.fnst@fujitsu.com>
From: "wangw.fnst@fujitsu.com" <wangw.fnst@fujitsu.com>
To: "Hayato Kuroda (Fujitsu)" <kuroda.hayato@fujitsu.com>, Amit Kapila <amit.kapila16@gmail.com>
Cc: Andres Freund <andres@anarazel.de>, vignesh C <vignesh21@gmail.com>, Peter
Smith <smithpb2250@gmail.com>, "Takamichi Osumi (Fujitsu)" <osumi.takamichi@fujitsu.com>, "shiy.fnst@fujitsu.com" <shiy.fnst@fujitsu.com>, "houzj.fnst@fujitsu.com" <houzj.fnst@fujitsu.com>, Amit Langote <amitlangote09@gmail.com>, Peter Eisentraut <peter.eisentraut@enterprisedb.com>, "pgsql-hackers@lists.postgresql.org" <pgsql-hackers@lists.postgresql.org>, Dilip Kumar <dilipbalaut@gmail.com>, Greg Nancarrow <gregn4422@gmail.com>
Date: 2023-03-21T07:42:11Z
Lists: pgsql-hackers
On Mon, Mar 20, 2023 at 21:18 PM Kuroda, Hayato/黒田 隼人 <kuroda.hayato@fujitsu.com> wrote: > Dear Wang, > > I have tested about multilevel partitions, and it worked well. > Followings are my comments for v18-0001. Thanks for your comments and testing. > 01. pg_get_publication_tables > > ``` > + ListCell *lc; > ``` > > This definition can be inside of the "for (i = 0; i < nelems; i++)". Changed. > 02. pg_get_publication_tables > > ``` > - * If the publication publishes partition changes via their > - * respective root partitioned tables, we must exclude partitions > - * in favor of including the root partitioned tables. Otherwise, > - * the function could return both the child and parent tables > - * which could cause data of the child table to be > - * double-published on the subscriber side. > + * Publications support partitioned tables. If > + * publish_via_partition_root is false, all changes are replicated > + * using leaf partition identity and schema, so we only need those. > + * Otherwise, get the partitioned table itself. > ``` > > The comments can be inside of the "else". Since I think there are related operations in the function GetAllTablesPublicationRelations, it might be better to write it above the if-statement. > 03. pg_get_publication_tables > > ``` > + pfree(elems); > ``` > > Only elems is pfree()'d here, but how about other variable like pub_elem and > pub_elem_tables? Added releases to these two variables. Regards, Wang Wei
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