RE: Added schema level support for publication.

From: "tanghy(dot)fnst(at)fujitsu(dot)com" <tanghy(dot)fnst(at)fujitsu(dot)com>
To: vignesh C <vignesh21(at)gmail(dot)com>
Cc: Greg Nancarrow <gregn4422(at)gmail(dot)com>, Ajin Cherian <itsajin(at)gmail(dot)com>, Rahila Syed <rahilasyed90(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>
Subject: RE: Added schema level support for publication.
Date: 2021-07-27 06:51:22
Message-ID: OS0PR01MB6113CC160D0F134448567FDDFBE99@OS0PR01MB6113.jpnprd01.prod.outlook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Monday, July 26, 2021 1:25 PM vignesh C <vignesh21(at)gmail(dot)com<mailto:vignesh21(at)gmail(dot)com>> wrote:

>

> On Mon, Jul 26, 2021 at 7:41 AM tanghy(dot)fnst(at)fujitsu(dot)com<mailto:tanghy(dot)fnst(at)fujitsu(dot)com> <tanghy(dot)fnst(at)fujitsu(dot)com<mailto:tanghy(dot)fnst(at)fujitsu(dot)com>> wrote:

> >

> > On Friday, July 23, 2021 8:18 PM vignesh C <vignesh21(at)gmail(dot)com<mailto:vignesh21(at)gmail(dot)com>> wrote:

> > >

> > > I have changed it to not report any error, this issue is fixed in the

> > > v14 patch attached at [1].

> > > [1] - https://www.postgresql.org/message-

> > > id/CALDaNm3DTj535ezfmm8QHLOtOkcHF2ZcCfSjfR%3DVbTbLZXFRsA%40mail.g

> > > mail.com

> > >

> >

> > Thanks for your new patch. But there's a conflict when apply patch v14 on the latest HEAD (it seems caused by commit #678f5448c2d869), please rebase it.

> >

>

> Thanks for reporting it, it is rebased at the v15 patch attached at [1].

> [1] - https://www.postgresql.org/message-id/CALDaNm27LRWF9ney%3DcVeD-0jc2%2BJ5Y0wNQhighZB%3DAat4VbNBA%40mail.gmail.com

Thanks for your new patch. I applied your patch and it succeeded.

Here are some comments on the tests in your patch. The attached file included changes about the comments, please have a look.

1. src/test/regress/sql/publication.sql

There are some existing tests to verify that we can't add table to ‘for all tables publication', should we add some tests about adding schema to ‘for all tables publication’ / ‘for table publication’?

I added some cases in the attached file.

Besides, the following existing comment seems not suitable. It uses 'SET' but the comment says 'add'. And since we can add table or schema, I think we should point out what we add is table, thoughts?

-- fail - can't add to for all tables publication

ALTER PUBLICATION testpub_foralltables SET TABLE pub_test.testpub_nopk;

2. src/test/subscription/t/001_rep_changes.pl

2.1

+# Insert some data into few tables and verify that inserted data is replicated.

+$node_publisher->safe_psql('postgres', "INSERT INTO sch1.tab1 VALUES(generate_series(11,20))");

+$node_publisher->safe_psql('postgres', "INSERT INTO sch2.tab1 VALUES(generate_series(11,20))");

+

+$node_publisher->wait_for_catchup('tap_sub_schema');

There are two spaces between "INTO" and "sch1.tab1".

2.2

Most of publication names are lowercase, and some of them are uppercase. I think it will be better if all of them are lowercase.

I modified them in the attached file.

2.3

+# Verify that the subscription relation list is updated after refresh.

+$result = $node_subscriber->safe_psql('postgres',

+ "SELECT count(*) FROM pg_subscription_rel WHERE srsubid IN (SELECT oid FROM pg_subscription WHERE subname = 'tap_sub_schema')");

+is($result, qq(5),

+ 'check subscription relation status was dropped on subscriber');

Should it be 'check subscription relation status is not yet dropped on subscriber' here?

2.4

+# Drop publications as we don't need them anymore

+$node_publisher->safe_psql('postgres', "DROP PUBLICATION tap_pub_schema");

There is only one publication, so the comment here should be 'Drop publication as we don't need it anymore'.

3.

There are some existing test cases about publication for table and publication for all tables in 002_pg_dump.pl, so I think we could add some test cases about publication for schema.

I tried to add some cases in the attached file.

Regards

Tang

Attachment Content-Type Size
test_patch application/octet-stream 8.3 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Greg Nancarrow 2021-07-27 06:53:16 Re: Slim down integer formatting
Previous Message Peter Smith 2021-07-27 06:11:41 Re: [HACKERS] logical decoding of two-phase transactions