pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Sergey Tatarintsev <s.tatarintsev@postgrespro.ru>
To: Shlok Kyal <shlok.kyal.oss@gmail.com>
To: Zhijie Hou (Fujitsu) <houzj.fnst@fujitsu.com>
Cc: vignesh C <vignesh21@gmail.com>
Cc: pgsql-hackers@lists.postgresql.org <pgsql-hackers@lists.postgresql.org>
Cc: Amit Kapila <amit.kapila16@gmail.com>
Subject: Re: create subscription with (origin = none, copy_data = on)
Date: Fri, 24 Jan 2025 15:13:21 +0300
Message-ID: <94dd2698-293d-4660-a50a-9e527d29c87e@postgrespro.ru> (raw)
In-Reply-To: <CANhcyEWBPSur8_cYLWRseEyJUXrESuVAzVqjF4t66RFdhE8Ghg@mail.gmail.com>
References: <5eda6a9c-63cf-404d-8a49-8dcb116a29f3@postgrespro.ru>
	<CALDaNm35cXbQ-zsvp3gpWPvyksQ1AE5Ucaqj2WvduQaofkL3Rg@mail.gmail.com>
	<CALDaNm0x=Lf8iz4WqR9U2474jzT0VmwTBeXB5LjBa7T3UPX-zg@mail.gmail.com>
	<CAA4eK1LO-nRNeYp4y-=5nLG0HHFnrCZaychbyvUaV43=cWOsbQ@mail.gmail.com>
	<CALDaNm1m53OZuVb3MbyYMnDkY7VPz_inJ9kJAPEW-OC503646w@mail.gmail.com>
	<OS0PR01MB571609BC15B09B8E1ECB063494E12@OS0PR01MB5716.jpnprd01.prod.outlook.com>
	<CANhcyEULzgCkjpYTAqnm55J8qaAprnpSs790u7uYZPomUa8tYg@mail.gmail.com>
	<CANhcyEWh0L5BYmginoz_e4jNDYZG7-BHErSrSm9ivmd-Qn3m6A@mail.gmail.com>
	<OS0PR01MB571650356AD2366C17EE9E4294E02@OS0PR01MB5716.jpnprd01.prod.outlook.com>
	<CANhcyEWBPSur8_cYLWRseEyJUXrESuVAzVqjF4t66RFdhE8Ghg@mail.gmail.com>


24.01.2025 07:22, Shlok Kyal пишет:
> On Thu, 23 Jan 2025 at 17:54, Zhijie Hou (Fujitsu)
> <houzj.fnst@fujitsu.com> wrote:
>> On Thursday, January 23, 2025 4:43 PM Shlok Kyal <shlok.kyal.oss@gmail.com> wrote:
>>> On Thu, 23 Jan 2025 at 12:35, Shlok Kyal <shlok.kyal.oss@gmail.com> wrote:
>>>> On Wed, 22 Jan 2025 at 09:00, Zhijie Hou (Fujitsu)
>>>> <houzj.fnst@fujitsu.com> wrote:
>>>>> Thanks for the patch.
>>>>>
>>>>> I agree that covering the partitioned table case when checking the
>>>>> non-local origin data on publisher is an improvement. But I think
>>>>> adding or extending the SQL functions may not be the appropriate way
>>>>> to fix because the new functions cannot be used in older PG version and is
>>> also not backpatchable.
>>>>> I am thinking it would be better to use the existing
>>>>> pg_partition_ancestors() and pg_partition_tree() to verify the same,
>>>>> which can be used in all supported PG versions and is also backpatchable.
>>>>>
>>>>> And here is another version which fixed the issue like that. I have
>>>>> not added tests for it, but I think it's doable to write the
>>>>> something like the testcases provided by Sergey. This patch does not
>>>>> fix the foreign tabel as that seems to be a separate issue which can be fixed
>>> independtly.
>>>>> Hi Sergey, if you have the time, could you please verify whether
>>>>> this patch resolves the partition issue you reported? I've confirmed
>>>>> that it passes the partitioned tests in the scripts, but I would
>>>>> appreciate your confirmation for the same.
>>>> Hi Hou-san,
>>>>
>>>> I tested the patch, and it is working fine on HEAD.
>>>> I also tried to apply the patches to back branches PG17 and PG 16. But
>>>> the patch does not apply.
>>>>
>>>> This 'origin' option was added in PG 16. So, this patch will not be
>>>> required for PG 15 and back branches.
>>>>
>>> I have created a patch which applies to both PG17 and PG 16. The
>>> v6-0002 is the test patch. It applies to all the branches (HEAD, PG17,
>>> PG16) correctly.
>> Thanks for the patch. I think the testcases could be improved.
>>
>> It's not clear why a separate schema is created for tables. I assume it was
>> initially intended to test TABLES IN SCHEMA but was later modified. If the
>> separate schema is still necessary, could you please add comments to clarify
>> its purpose?
>> Besides, the new table name 'ts' seems a bit unconventional. It would be better
>> to align with the naming style of existing test cases for consistency and
>> clarity.
> I think the schema is not required. I have removed it.
>
>> Also, Sergey had suggested adding an more test to verify scenarios where the
>> table's ancestors are subscribed. It appears this hasn't been added yet. I
>> think it would be better to add it.
> I have added the test in the latest patch.
>
> Thanks and Regards,
> Shlok Kyal

Hello!

I think there is another problem - publisher can modify publication 
during the execution of "CREATE SUBSCRIPTION" (Rarely, this situation 
occurred in my tests.)

I.e.:

1. Publisher: CREATE PUBLICATION ... FOR TABLE t1;

2. Subscriber (starts CREATE SUBSCRIPTION ...): check_publications_origin()

3. Publisher: ALTER PUBLICATION ... ADD TABLE t2;

4. Subscriber (still process CREATE SUBSCRIPTION ...): fetch_table_list()

So, we check publication with only t1, but fetch t1,t2

I think we must start transaction on publisher while executing 
CreateSubscription() on subscriber (Or may be take an lock on publisher )

Thoughts?







view thread (24+ messages)  latest in thread

Message-ID: <94dd2698-293d-4660-a50a-9e527d29c87e@postgrespro.ru>
Permalink:  ../94dd2698-293d-4660-a50a-9e527d29c87e@postgrespro.ru/
Also on:    postgresql.org/message-id/94dd2698-293d-4660-a50a-9e527d29c87e@postgrespro.ru

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-hackers@postgresql.org
  Cc: s.tatarintsev@postgrespro.ru, shlok.kyal.oss@gmail.com, houzj.fnst@fujitsu.com, vignesh21@gmail.com, amit.kapila16@gmail.com
  Subject: Re: create subscription with (origin = none, copy_data = on)
  In-Reply-To: <94dd2698-293d-4660-a50a-9e527d29c87e@postgrespro.ru>
  References: <5eda6a9c-63cf-404d-8a49-8dcb116a29f3@postgrespro.ru> <CALDaNm35cXbQ-zsvp3gpWPvyksQ1AE5Ucaqj2WvduQaofkL3Rg@mail.gmail.com> <CALDaNm0x=Lf8iz4WqR9U2474jzT0VmwTBeXB5LjBa7T3UPX-zg@mail.gmail.com> <CAA4eK1LO-nRNeYp4y-=5nLG0HHFnrCZaychbyvUaV43=cWOsbQ@mail.gmail.com> <CALDaNm1m53OZuVb3MbyYMnDkY7VPz_inJ9kJAPEW-OC503646w@mail.gmail.com> <OS0PR01MB571609BC15B09B8E1ECB063494E12@OS0PR01MB5716.jpnprd01.prod.outlook.com> <CANhcyEULzgCkjpYTAqnm55J8qaAprnpSs790u7uYZPomUa8tYg@mail.gmail.com> <CANhcyEWh0L5BYmginoz_e4jNDYZG7-BHErSrSm9ivmd-Qn3m6A@mail.gmail.com> <OS0PR01MB571650356AD2366C17EE9E4294E02@OS0PR01MB5716.jpnprd01.prod.outlook.com> <CANhcyEWBPSur8_cYLWRseEyJUXrESuVAzVqjF4t66RFdhE8Ghg@mail.gmail.com> <94dd2698-293d-4660-a50a-9e527d29c87e@postgrespro.ru>

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

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