Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hitT5-0004TW-MO for pgsql-bugs@arkaria.postgresql.org; Thu, 04 Jul 2019 04:35:36 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hitT2-0007xP-Mn for pgsql-bugs@arkaria.postgresql.org; Thu, 04 Jul 2019 04:35:32 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hitT0-0007ve-W6 for pgsql-bugs@lists.postgresql.org; Thu, 04 Jul 2019 04:35:32 +0000 Received: from wout4-smtp.messagingengine.com ([64.147.123.20]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hitSs-00088w-6a for pgsql-bugs@lists.postgresql.org; Thu, 04 Jul 2019 04:35:30 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id DF4173FA; Thu, 4 Jul 2019 00:35:17 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Thu, 04 Jul 2019 00:35:18 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paquier.xyz; h= date:from:to:subject:message-id:references:mime-version :content-type:in-reply-to; s=fm2; bh=sfqks8s3lhp4V/9mFsFarDtIQXh bP33oCNa6Tr4jcNw=; b=PXnh7IBnKSu6D3JJ5im9qxdYLc12QoUEkeQ13i3z5LK olGL5sEO9t6x/aACE7tGvv/hiIY5Ph1o4gpOtfu+1Ts6QFZaFWeHYq4dOsVkLOAo OEjDzoH1IGi/IDo/Pz6Rsgpnh3DxpB4/ZRy+eFRa1rCYAU1vQ/y7Pz6o5cebXWFJ jaO5MXx9uGxUt/pykPHQX3K44gyKm4vOq9CbupVo4TvyGWetjh+EKK+WIsZbDPCI 4J6/ssbtuAdvXD8xHCOKUh73p9peHkWAKDIXmNG7x8toggUwHwhc8/gQSNViN2cC TFvePYT5sGvRBtkzDOiqg35ObI8QpBgQcuGf8FQwOzw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=sfqks8 s3lhp4V/9mFsFarDtIQXhbP33oCNa6Tr4jcNw=; b=lkxfjakikZ6YH45UlnkSXY nr3EsSQ2F1bQg328uWGUZI5CgU5IJb0+zHzLWoWTzOSLT0MuLZHrPKO3b8/EovBl U812x/hvvCl93J5Fnd8qimeThhKqardWJYdmLIrku+dwYEqtAm80rUVUzVCB0Co2 YfCN5JcOIaYUw1AArU/ORCMMI3iTBWn98+0AQNHPbvURKEW9XDuIHvJk6tjlop8P URPTna1h7BNU4CmnizX0ErbJyRoXMeoznNkzW64NUrzVNPpEYsziwkfUYvGMekIV udttuPNdDxGQbjRtfqA2tB6UAgSrIW0NUhW011dvZaZk4sPwTOQMsC7uC8tRBPbQ == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduvddrfedugdekhecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecufghrlhcuvffnffculdejtddmnecujfgurhepfffhvf fukfhfgggtuggjsehgtderredttddvnecuhfhrohhmpefoihgthhgrvghlucfrrghquhhi vghruceomhhitghhrggvlhesphgrqhhuihgvrhdrgiihiieqnecukfhppeduudekrddvge durddvhedtrddujeeknecurfgrrhgrmhepmhgrihhlfhhrohhmpehmihgthhgrvghlsehp rghquhhivghrrdighiiinecuvehluhhsthgvrhfuihiivgeptd X-ME-Proxy: Received: from paquier.xyz (mp76f1fab2.ap.nuro.jp [118.241.250.178]) by mail.messagingengine.com (Postfix) with ESMTPA id 9AC988005C; Thu, 4 Jul 2019 00:35:15 -0400 (EDT) Date: Thu, 4 Jul 2019 13:35:12 +0900 From: Michael Paquier To: marko@joh.to, pgsql-bugs@lists.postgresql.org Subject: Re: BUG #15888: Bogus "idle in transaction" state for logical decoding client after creating a slot Message-ID: <20190704043512.GK3084@paquier.xyz> References: <15888-52d02086ac2085e8@postgresql.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="fDP66DSfTvWAYVew" Content-Disposition: inline In-Reply-To: <15888-52d02086ac2085e8@postgresql.org> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --fDP66DSfTvWAYVew Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Jul 03, 2019 at 08:03:24AM +0000, PG Bug reporting form wrote: > Run: >=20 > pg_recvlogical -S foo -f /dev/null -d dbname --create-slot --start >=20 > and pg_stat_activity will show something like this until that session > disconnects: >=20 > which is quite obviously bogus. I think that's the transaction which is started when exporting the snapshot at logical slot creation. Or in short: #2 0x000055b5f8e5720f in StartTransactionCommand () at xact.c:2699 #3 0x000055b5f90fab4e in SnapBuildExportSnapshot (builder=3D0x55b5fa3427b0) at snapbuild.c:575 #4 0x000055b5f90fe5df in CreateReplicationSlot (cmd=3D0x55b5fa2914e8) at walsender.c:843 SnapBuildExportSnapshot() needs to keep a transaction context opened to keep the wanted xmin around. In PG >=3D 10, this problem gets "solved" by using NOEXPORT_SNAPSHOT in the CREATE_REPLICATION_SLOT command. One idea would be to enforce a commit in this case from CreateReplicationSlot/streamutil.c? We know that pg_recvlogical is not going to use this snapshot anyway... -- Michael --fDP66DSfTvWAYVew Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAl0dggAACgkQnvQgOdby QH0VWQ//cFFdmf7lrypOFQDW6O8v3fQzrw2qnQorcUPnuv4i6wWv9sAm6tuL9UA5 vntocfZ7fm+3Q+5MP66WiTJkgt46m+CZOUNG/kuy/JC6p55CpSKujCv1+3Z7ub2g lKoWF395qf9SZ51U5RLeEQIroljGwC4Hh1P2nhbf0vHdIEHvI6KuBRj6vIGStCC4 n49eO7HSbDUE9dG+L9y089IlHz/ARC4roYOW221AmQtkCUlUIyJjzQYnqWJ6pzcE 007W650K9YFLM7rDqrmeSTJ+EtVypgR5Geo0l2hz2iO5jVHb7jwBTI23tok2ugAd OZQwhioWuGWPYuIXi/zyZmPxAQ9airqy/pr9is04qM2O+MzsTTZh+6IJRK03SozT 9eM7q6hN+4k7X3oZB7AOxy5NW4DEZ51UQM4PiJbJfDJwYvlQvYpu2Yu8zjc/THB0 2SQEC99uTZHe6qCPiV80/whc7pFuyVZJvO+7Uei7fU+6+ORu/dKyznj/qu663LAS GOzBM92PREEm2mM/TcD1DS4sE1ztGQdn7w3UWhOz+aCLiLili4xF1BjlXI5UU6/C ySJinQg4m4mi6TwiJXwmKvhnfeLUWNVrLDQbvkhmV8/7mMLzItc4L8jtUZ5dpCHv Ar6ivJo55iyf9aYUQoB+WmFuhBPSZtHwW8mB0K6ylRK3R+ZkRJ4= =a5po -----END PGP SIGNATURE----- --fDP66DSfTvWAYVew--