Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oLB99-0000kB-Qm for pgsql-hackers@arkaria.postgresql.org; Mon, 08 Aug 2022 22:22:51 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oLB97-0000TZ-3y for pgsql-hackers@arkaria.postgresql.org; Mon, 08 Aug 2022 22:22:49 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oLB96-0000TH-M6 for pgsql-hackers@lists.postgresql.org; Mon, 08 Aug 2022 22:22:48 +0000 Received: from out1-smtp.messagingengine.com ([66.111.4.25]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oLB94-0005Hp-3M for pgsql-hackers@postgresql.org; Mon, 08 Aug 2022 22:22:47 +0000 Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id D8C975C00D1; Mon, 8 Aug 2022 18:22:42 -0400 (EDT) Received: from imap49 ([10.202.2.99]) by compute2.internal (MEProxy); Mon, 08 Aug 2022 18:22:42 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=eulerto.com; h= cc:cc:content-type:date:date:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to; s=fm2; t=1659997362; x=1660083762; bh=bbVwCWKMU6 0EreL8q41byibBh2E46qGYAhvoXVdn+u8=; b=hxRDB3S3oT3hML1kRvXiJwYP7b QXaMDCWz0EjMOO9TZtwueWCt3kYOpFo0MIrPvJHj21UlCiHUdE3P5tIHZ1XHFM/Q N/aeOP09jrOyX1pmAVvjuuTI+lrolvLqZj7d+3yr0GdRtiYELol3zanJAdicRM/7 bZCSG2rIkKOkXuPYqFykt0/b9iIzL9ZES9T2xW7ZaLK/0C5PW6dn23xECgIeheRt xbnUTl/mN6jeqQ3YoYvSufxM/f9eA1C5APmh7MzzpjSi1U73agQXUyW/DfrPWyCH sOFa9hwDltMA4+/lPJmdvGOVStLD20c/genAztROb1pyBKXNqsnCiPyiVTIw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:date:date:feedback-id :feedback-id:from:from:in-reply-to:in-reply-to:message-id :mime-version:references:reply-to:sender:subject:subject:to:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; t=1659997362; x=1660083762; bh=bbVwCWKMU60EreL8q41byibBh2E4 6qGYAhvoXVdn+u8=; b=bjesLfby8vvVozv+7Ree7zYnPNWnhvYGxmJRi6XWg7lM 4epg3ZVIFyJT5l9IVhysRKU45d8cMt1SKM7d//L12Gg4cyaFF3x698odkyy0SCrC XFuDbx84+h6bA0DI0V3JklT0gtlGAkyh7IFdIWfTFna4dXsp3W6d/yedkctzfC0y 2V7MhSSf6HlzucL80q70Q3zsYyUPJZw4eLU9qj9ZEvsduSTELGuRoB+Tly8Kwbp2 lIFqMLK5dsc/24upRzwvS3cMs2VxDWPl2xS+tLAKGlWQlv+Od905dWuC/3+jorBW tPF4GXACgBvipDHiAdtqJve5y8DhEEd4h4zrrkl4OA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrvdefledguddtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepofgfggfkjghffffhvfevufgtsegrtderreerredtnecuhfhrohhmpedfgfhu lhgvrhcuvfgrvhgvihhrrgdfuceovghulhgvrhesvghulhgvrhhtohdrtghomheqnecugg ftrfgrthhtvghrnhepgfffjedviedvkedviedvteduieekudeivedthffhuddvteegleet ieffkeeghfdvnecuffhomhgrihhnpegvnhhtvghrphhrihhsvggusgdrtghomhenucevlh hushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegvuhhlvghrsegv uhhlvghrthhordgtohhm X-ME-Proxy: Feedback-ID: i0c21471d:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id 6A07715A0087; Mon, 8 Aug 2022 18:22:42 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.7.0-alpha0-758-ge0d20a54e1-fm-20220729.001-ge0d20a54 Mime-Version: 1.0 Message-Id: <94124b46-d856-4cd7-83d7-9f4035ac9831@www.fastmail.com> In-Reply-To: References: <73b06a32-56ab-4056-86ff-e307f3c316f1@www.fastmail.com> <20220322010410.m6ccotflls45d7vq@alap3.anarazel.de> <29bd8c6e-9c87-4a72-abea-52218a387e2e@www.fastmail.com> <594ad346-da36-4f53-91ad-da366787c67f@www.fastmail.com> Date: Mon, 08 Aug 2022 19:22:22 -0300 From: "Euler Taveira" To: "Amit Kapila" Cc: "Peter Smith" , "Andres Freund" , "Marcos Pegoraro" , pgsql-hackers Subject: Re: logical replication restrictions Content-Type: multipart/alternative; boundary=02c68161a5df47aaa92213e9247a895a List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --02c68161a5df47aaa92213e9247a895a Content-Type: text/plain On Wed, Aug 3, 2022, at 10:27 AM, Amit Kapila wrote: > Your explanation makes sense to me. The other point to consider is > that there can be cases where we may not apply operation for the > transaction because of empty transactions (we don't yet skip empty > xacts for prepared transactions). So, won't it be better to apply the > delay just before we apply the first change for a transaction? Do we > want to apply the delay during table sync as we sometimes do need to > enter apply phase while doing table sync? I thought about the empty transactions but decided to not complicate the code mainly because skipping transactions is not a code path that will slow down this feature. As explained in the documentation, there is no harm in delaying a transaction for more than min_apply_delay; it cannot apply earlier. Having said that I decided to do nothing. I'm also not sure if it deserves a comment or if this email is a possible explanation for this decision. Regarding the table sync that was mention by Melih, I sent a new version (v6) that fixed this oversight. The current logical replication worker design make it difficult to apply the delay in the catchup phase; tablesync workers are not closed as soon as the COPY finishes (which means possibly running out of workers sooner). After all tablesync workers have reached READY state, the apply delay is activated. The documentation was correct; the code wasn't. -- Euler Taveira EDB https://www.enterprisedb.com/ --02c68161a5df47aaa92213e9247a895a Content-Type: text/html Content-Transfer-Encoding: quoted-printable
On Wed, Aug 3, = 2022, at 10:27 AM, Amit Kapila wrote:
Your explanation makes sense to me. The other= point to consider is
that there can be cases where we may= not apply operation for the
transaction because of empty = transactions (we don't yet skip empty
xacts for prepared t= ransactions). So, won't it be better to apply the
delay ju= st before we apply the first change for a transaction? Do we
want to apply the delay during table sync as we sometimes do need to<= br>
enter apply phase while doing table sync?
I thought about the empty transactions but decided to not com= plicate the code
mainly because skipping transactions is n= ot a code path that will slow down
this feature. As explai= ned in the documentation, there is no harm in delaying a
t= ransaction for more than min_apply_delay; it cannot apply earlier. Havin= g said
that I decided to do nothing. I'm also not sure if = it deserves a comment or if
this email is a possible expla= nation for this decision.

Regarding the tab= le sync that was mention by Melih, I sent a new version (v6)
that fixed this oversight. The current logical replication worker des= ign make
it difficult to apply the delay in the catchup ph= ase; tablesync workers are not
closed as soon as the COPY = finishes (which means possibly running out of
workers soon= er). After all tablesync workers have reached READY state, the
=
apply delay is activated. The documentation was correct; the code w= asn't.


<= div class=3D"signature">--
Euler Tavei= ra
=

--02c68161a5df47aaa92213e9247a895a--