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 1kbBfM-0006GG-6E for pgsql-bugs@arkaria.postgresql.org; Sat, 07 Nov 2020 00:01:12 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kbBfJ-00030j-NA for pgsql-bugs@arkaria.postgresql.org; Sat, 07 Nov 2020 00:01:09 +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 1kbBfJ-00030c-Gk for pgsql-bugs@lists.postgresql.org; Sat, 07 Nov 2020 00:01:09 +0000 Received: from wout4-smtp.messagingengine.com ([64.147.123.20]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kbBfF-0001nw-QT for pgsql-bugs@lists.postgresql.org; Sat, 07 Nov 2020 00:01:08 +0000 Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.west.internal (Postfix) with ESMTP id A9AF04AC; Fri, 6 Nov 2020 19:01:03 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Fri, 06 Nov 2020 19:01:04 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:subject:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=i0l+tkEmI6wR+k+Fc kWBKcd0vZO4Z7ZeaLpusBhVEDg=; b=LcxMirtO4CqnXd3Zo0Gtm0OnHW2EmuDf0 +2vl9N03mEGsJq4BFZyo1I2fVhs5mKrbAJPeSae1xJX49lExzMvBQ+kwqDzCejNG YJMQEqbPLm3x1HCH3UilN/10c+jAXMX67QfFsGpqHgA4y+BudIJGz34ekQbkLTmM 1vhBA+gBT4UNZs7jSh01C9TmVl+b6TvN5diO70UhOoxzgJENjpt9btuadsvLU4NS Wash5Vl/eTWIDAlLVtjreGfzu5mJhRUsiwkjqMZT8v411iF3aU3m504YKRWGxBBO SHFsCoe40gsyah7wB9MpmBm461UscMuyTtp22r+WuklBd73FDofIQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedruddutddgudehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvffukfggtggujggfsehttdertddtredvnecuhfhrohhmpeetlhhvrghr ohcujfgvrhhrvghrrgcuoegrlhhvhhgvrhhrvgesrghlvhhhrdhnohdqihhprdhorhhgqe enucggtffrrghtthgvrhhnpeevgfelveegueejgefhgeetgefhgeehieefheehleetteei udeiiefhgffgheffteenucfkphepudeltddrleehrdduledrudegkeenucevlhhushhtvg hrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegrlhhvhhgvrhhrvgesrghl vhhhrdhnohdqihhprdhorhhg X-ME-Proxy: Received: from perhan.alvh.no-ip.org (unknown [190.95.19.148]) by mail.messagingengine.com (Postfix) with ESMTPA id 46AA3306005F; Fri, 6 Nov 2020 19:01:02 -0500 (EST) Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id 34BE12A0FDA; Fri, 6 Nov 2020 21:01:00 -0300 (-03) Date: Fri, 6 Nov 2020 21:01:00 -0300 From: Alvaro Herrera To: Amit Kapila Cc: Petr Jelinek , Tom Lane , Henry Hinze , PostgreSQL mailing lists , Peter Eisentraut Subject: Re: BUG #16643: PG13 - Logical replication - initial startup never finishes and gets stuck in startup loop Message-ID: <20201107000100.GA30839@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 2020-Nov-05, Amit Kapila wrote: > On Wed, Nov 4, 2020 at 7:19 PM Alvaro Herrera wrote: > > > > On 2020-Nov-04, Amit Kapila wrote: > > > > > On Thu, Oct 15, 2020 at 8:20 PM Alvaro Herrera wrote: > > > > > > * STREAM COMMIT bug? > > > > In apply_handle_stream_commit, we do CommitTransactionCommand, but > > > > apparently in a tablesync worker we shouldn't do it. > > > > > > In the tablesync stage, we don't allow streaming. See pgoutput_startup > > > where we disable streaming for the init phase. As far as I understand, > > > for tablesync we create the initial slot during which streaming will > > > be disabled then we will copy the table (here logical decoding won't > > > be used) and then allow the apply worker to get any other data which > > > is inserted in the meantime. Now, I might be missing something here > > > but if you can explain it a bit more or share some test to show how we > > > can reach here via tablesync worker then we can discuss the possible > > > solution. > > > > Hmm, okay, that sounds like there would be no bug then. Maybe what we > > need is just an assert in apply_handle_stream_commit that > > !am_tablesync_worker(), as in the attached patch. Passes tests. > > > > +1. But do we want to have this Assert only in stream_commit API or > all stream APIs as well? Well, the only reason I care about this is that apply_handle_commit contains a comment that we must not do CommitTransactionCommand in the syncworker case; so if you look at apply_handle_stream_commit and note that it doesn't concern it about that, you become concerned that it might be broken. I don't think the other routines handling the "stream" thing have that issue.