public inbox for [email protected]  
help / color / mirror / Atom feed
From: [email protected] <[email protected]>
To: Ajin Cherian <[email protected]>
Cc: Amit Kapila <[email protected]>
Cc: Euler Taveira <[email protected]>
Cc: Greg Nancarrow <[email protected]>
Cc: vignesh C <[email protected]>
Cc: Peter Smith <[email protected]>
Cc: [email protected] <[email protected]>
Cc: Dilip Kumar <[email protected]>
Cc: Rahila Syed <[email protected]>
Cc: Peter Eisentraut <[email protected]>
Cc: Önder Kalacı <[email protected]>
Cc: japin <[email protected]>
Cc: Michael Paquier <[email protected]>
Cc: David Steele <[email protected]>
Cc: Craig Ringer <[email protected]>
Cc: Amit Langote <[email protected]>
Cc: PostgreSQL Hackers <[email protected]>
Subject: RE: row filtering for logical replication
Date: Thu, 9 Dec 2021 02:37:14 +0000
Message-ID: <OS0PR01MB5716EB3137D194030EB694F194709@OS0PR01MB5716.jpnprd01.prod.outlook.com> (raw)
In-Reply-To: <CAFPTHDYB4nbxCMAFQGowJtDf7E6uBc==_HupBKy7MaMhM+9QQA@mail.gmail.com>
References: <CAHut+PvSHjUsrrgVeE43hN8AZVPa8VqQ=GH1LYJFSubp2W_dhA@mail.gmail.com>
	<CAHut+PtRdXzPpm3qv3cEYWWfVUkGT84EopEHxwt95eo_cG_3eQ@mail.gmail.com>
	<OS0PR01MB571625D4A5CC1DAB4045B2BB94919@OS0PR01MB5716.jpnprd01.prod.outlook.com>
	<CAHut+Pu1AMDUwBNKeevLKOO2=M6ZBXpddi-s7fhqBpMxMWUQpA@mail.gmail.com>
	<CAFPTHDZgxAbLA98HZkN-JNHoHXSBGtK4eAGQrXam5JQY6Zx7wg@mail.gmail.com>
	<OS0PR01MB61132C0E4FFEE73D34AE9823FB999@OS0PR01MB6113.jpnprd01.prod.outlook.com>
	<CAJcOf-d0=Pnv8qpBaN5WM5wtmhT3EJ64crWtfPBtiwtK8iUEwg@mail.gmail.com>
	<CAHut+Pv-D4rQseRO_OzfEz2dQsTKEnKjBCET9Z-iJppyT1XNMQ@mail.gmail.com>
	<CALDaNm2bq-Zab3i5pvuA3UTxHvo3BqPwmgXbyznpw5vz4=fxpA@mail.gmail.com>
	<OS0PR01MB57162EB465A0E6BCFDF9B3F394609@OS0PR01MB5716.jpnprd01.prod.outlook.com>
	<CAA4eK1KZ+N=vfgqeUuZfRLRC+WyNBFvU9Ei7kF-7OPXnTX2WrA@mail.gmail.com>
	<OS0PR01MB5716F2C3904CB807050010A394619@OS0PR01MB5716.jpnprd01.prod.outlook.com>
	<CAA4eK1KVUs2s3PTcTTRj3qdmUzEDG7PQ5Xq_b1J7zMsi2OvE5w@mail.gmail.com>
	<OS0PR01MB57168FD9932E3F42406EB13B94629@OS0PR01MB5716.jpnprd01.prod.outlook.com>
	<CAJcOf-dz0srExG0NPPgXh5X8eL2uxk7C=cZoGTbf8cNqoRUY6w@mail.gmail.com>
	<CAA4eK1+8UqT5b3Ha42Wt07668yxs9KkKvV5r==vT9KfRUGCs-g@mail.gmail.com>
	<[email protected]>
	<CAA4eK1+hVXfOSScbf5LUB=5is=wYaC6NBhLxuvetbWQnZRnsVQ@mail.gmail.com>
	<CAHut+PtJnnM8MYQDf7xCyFAp13U_0Ya2dv-UQeFD=ghixFLZiw@mail.gmail.com>
	<[email protected]>
	<CAA4eK1+C2Z8bmGT_7xo4T+fZqqTr1i56Hidv9krmaEDUACwGjA@mail.gmail.com>
	<[email protected]>
	<CAA4eK1K-+GhHqG+8yJb-neWxR_B+yeXTj7cCg9OqxTmPK3seRA@mail.gmail.com>
	<CAHut+PugCTDwoS6Ysaocj+AjqSUuxB5qL6F=7_E2v59E9MZm7A@mail.gmail.com>
	<CAFPTHDYB4nbxCMAFQGowJtDf7E6uBc==_HupBKy7MaMhM+9QQA@mail.gmail.com>

On Wednesday, December 8, 2021 7:52 PM Ajin Cherian <[email protected]>
> On Tue, Dec 7, 2021 at 5:36 PM Peter Smith <[email protected]> wrote:
> >
> > We were mid-way putting together the next v45* when your latest
> > attachment was posted over the weekend. So we will proceed with our
> > original plan to post our v45* (tomorrow).
> >
> > After v45* is posted we will pause to find what are all the
> > differences between your unified patch and our v45* patch set. Our
> > intention is to integrate as many improvements as possible from your
> > changes into the v46* etc that will follow tomorrow’s v45*. On some
> > points, we will most likely need further discussion.
> 
> 
> Posting an update for review comments, using contributions majorly from
> Peter Smith.
> I've also included changes based on Euler's combined patch, specially changes
> to documentation and test cases.
> I have left out Hou-san's 0005, in this patch-set. Hou-san will provide a rebased
> update based on this.
> 
> This patch addresses the following review comments:

Hi,

Thanks for updating the patch.
I noticed a possible issue.

+				/* Check row filter. */
+				if (!pgoutput_row_filter(data, relation, oldtuple, NULL, relentry))
+					break;
+
+				maybe_send_schema(ctx, change, relation, relentry);
+
 				/* Switch relation if publishing via root. */
 				if (relentry->publish_as_relid != RelationGetRelid(relation))
 				{
...
					/* Convert tuple if needed. */
					if (relentry->map)
						tuple = execute_attr_map_tuple(tuple, relentry->map);

Currently, we execute the row filter before converting the tuple, I think it could
get wrong result if we are executing a parent table's row filter and the column
order of the parent table is different from the child table. For example:

----
create table parent(a int primary key, b int) partition by range (a);
create table child (b int, a int primary key);
alter table parent attach partition child default;
create publication pub for table parent where(a>10) with(PUBLISH_VIA_PARTITION_ROOT);

The column number of 'a' is '1' in filter expression while column 'a' is the
second one in the original tuple. I think we might need to execute the filter
expression after converting.

Best regards,
Hou zj


view thread (489+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]
  Subject: RE: row filtering for logical replication
  In-Reply-To: <OS0PR01MB5716EB3137D194030EB694F194709@OS0PR01MB5716.jpnprd01.prod.outlook.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox