Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tbIYz-009ajF-61 for pgsql-hackers@arkaria.postgresql.org; Fri, 24 Jan 2025 12:13:30 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1tbIYw-00Drss-O9 for pgsql-hackers@arkaria.postgresql.org; Fri, 24 Jan 2025 12:13:26 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tbIYw-00Drsj-9Y for pgsql-hackers@lists.postgresql.org; Fri, 24 Jan 2025 12:13:26 +0000 Received: from mail.postgrespro.ru ([93.174.131.139]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1tbIYt-001GUe-0c for pgsql-hackers@lists.postgresql.org; Fri, 24 Jan 2025 12:13:25 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mx2023; t=1737720802; bh=wubYalC8vdi/nZAg6Pj75/0AMxMGBGp/KaQBk9Krhcs=; h=Message-ID:Date:User-Agent:Subject:To:Cc:References:From: In-Reply-To:From; b=GTaX5YQ1pRptW04EAF9S9NckusQIm9YaiWI5q7hhj0huAVC4joGu1WZ6JiauylB6x IBGTnXRQonP3TYrguNhXP+VQvtXSzXqBQKOATWUu1HA5X6515oJTC/938XKCel8Di3 9SBYqcSnlxZFsgsVJAnMf6ujAGAt91Yt78RY1XG20/tPA5IwYoC2EBaj5vxSOWi7Qu yOWN4tSwaqKoVslH19kKRx6n/uGN7cQOl5CkpmNKnWcA0WV0lTkAKwPAle55dTKoAZ pC2YtmkI+jadQwTkUdpsoN4IlN8oxgsQxaO/7+I6J0chVKWXFguWuYEtHAVqnNtte4 5PXr9ms9iysGg== Received: from [10.4.14.57] (unknown [93.174.131.141]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (Client did not present a certificate) (Authenticated sender: s.tatarintsev@postgrespro.ru) by mail.postgrespro.ru (Postfix/465) with ESMTPSA id 2F6F960CB8; Fri, 24 Jan 2025 15:13:22 +0300 (MSK) Message-ID: <94dd2698-293d-4660-a50a-9e527d29c87e@postgrespro.ru> Date: Fri, 24 Jan 2025 15:13:21 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: create subscription with (origin = none, copy_data = on) To: Shlok Kyal , "Zhijie Hou (Fujitsu)" Cc: vignesh C , "pgsql-hackers@lists.postgresql.org" , Amit Kapila References: <5eda6a9c-63cf-404d-8a49-8dcb116a29f3@postgrespro.ru> Content-Language: en-US From: Sergey Tatarintsev In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-KSMG-AntiPhishing: NotDetected X-KSMG-AntiSpam-Interceptor-Info: not scanned X-KSMG-AntiSpam-Status: not scanned, disabled by settings X-KSMG-AntiVirus: Kaspersky Secure Mail Gateway, version 2.1.0.7854, bases: 2025/01/24 06:23:00 #27110730 X-KSMG-AntiVirus-Status: NotDetected, skipped X-KSMG-LinksScanning: not scanned, disabled by settings X-KSMG-Message-Action: skipped X-KSMG-Rule-ID: 1 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk 24.01.2025 07:22, Shlok Kyal пишет: > On Thu, 23 Jan 2025 at 17:54, Zhijie Hou (Fujitsu) > wrote: >> On Thursday, January 23, 2025 4:43 PM Shlok Kyal wrote: >>> On Thu, 23 Jan 2025 at 12:35, Shlok Kyal wrote: >>>> On Wed, 22 Jan 2025 at 09:00, Zhijie Hou (Fujitsu) >>>> 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?