Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1gEeDP-0002a3-Dh for pgsql-hackers@arkaria.postgresql.org; Mon, 22 Oct 2018 17:42:07 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gEeDM-0005fo-Oj for pgsql-hackers@arkaria.postgresql.org; Mon, 22 Oct 2018 17:42:04 +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_SHA384:256) (Exim 4.89) (envelope-from ) id 1gEeDM-0005fe-H9 for pgsql-hackers@lists.postgresql.org; Mon, 22 Oct 2018 17:42:04 +0000 Received: from wout1-smtp.messagingengine.com ([64.147.123.24]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1gEeDK-0007jw-Ex for pgsql-hackers@lists.postgresql.org; Mon, 22 Oct 2018 17:42:04 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.west.internal (Postfix) with ESMTP id 08D7D35B; Mon, 22 Oct 2018 13:41:59 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Mon, 22 Oct 2018 13:42:00 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=anarazel.de; h= date:from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=fm2; bh=jQhnMf2F+FNrhEGOGDe+qJWAZqO X8wX0yVfn1s8L/+Q=; b=meuIPlqTO9kqIosP/pzdPW7hQfk+LqZWAXLxpgMs9gb N1KkxOLpFN27eg/5m+rsBDOZyDBfHK9/dL2DPpAJ+aru0sF3i4xbWFsTq6t8Oxeh 6w/yv8jVDbXLgFG25/TsaUef2FVpsnwTLOfLJCaVTtRr5hFSgHPBtAQjqPQoDfIh 0Ndq7qIBRqPwsB+9055gQRJGlyuRV4SYnI25T7v5kEz6zRDV8nyxZifgDScwerWd NbBnKotgF8ivbMK+v+IPlxcBCJM1nG/FcBCYlrZ5T5cKY8uyOjaTYONXvEYmQlZX wOVdFVjG/7c1vDRLmYgkimeEhpOi/FrD5qgEq8U/ijQ== 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:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=jQhnMf 2F+FNrhEGOGDe+qJWAZqOX8wX0yVfn1s8L/+Q=; b=itbGZfmzG4reQZl2pkOfij IYLUfLMATpGLAWzFa4pnQuGgrnE9CkCzCjf87kURVXuIL8pQ7wY8GsY0X6mf7/+j 0MjZNYQEhvHO/Hunv7FIGW/HNh+bHxBez+8EFpZjEyhoFyUq0lwRWSYAfwXeOWUA JuTRhyeNfTnBBEjczOox/pyZTgI/MFJtRZuJMYDdot0XjSm/GOP+6n01ycPM1lK7 TjRS3lgeNp2agstT+kM1hG17nDc1yINxJwcga+Wg+EYlIyiYHVVrKGxc6LSOMOKi oHSY5H0hAoFtnz3DS+WPlCnKiD+vwOpMl0VElPz/CkfpLt9+TERLbCJ6rK5TacJQ == X-ME-Sender: X-ME-Proxy: Received: from intern.anarazel.de (unknown [172.58.91.4]) by mail.messagingengine.com (Postfix) with ESMTPA id 1BB52102F3; Mon, 22 Oct 2018 13:41:58 -0400 (EDT) Date: Mon, 22 Oct 2018 10:41:55 -0700 From: Andres Freund To: Alvaro Herrera Cc: Michael Paquier , pgsql-hackers@lists.postgresql.org Subject: Re: pgsql: Avoid duplicate XIDs at recovery when building initial snapshot Message-ID: <20181022174155.wxxu2qt3bcrbrqy5@alap3.anarazel.de> References: <20181014174240.byktkskdymae7kmy@alap3.anarazel.de> <20181022153625.d5r7yui5qoway66u@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181022153625.d5r7yui5qoway66u@alvherre.pgsql> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Hi, On 2018-10-22 12:36:25 -0300, Alvaro Herrera wrote: > On 2018-Oct-14, Andres Freund wrote: > > > On 2018-10-14 13:26:24 +0000, Michael Paquier wrote: > > > Avoid duplicate XIDs at recovery when building initial snapshot > > > I'm unhappy this approach was taken over objections. Without a real > > warning. Even leaving the crummyness aside, did you check other users > > of XLOG_RUNNING_XACTS, e.g. logical decoding? > > Mumble. Is there a real problem here -- I mean, did this break logical > decoding? Maybe we need some more tests to ensure this stuff works > sanely for logical decoding. Hm? My point is that this fix just puts a band-aid onto *one* of the places that read a XLOG_RUNNING_XACTS. Which still leaves the contents of WAL record corrupted. There's not even a note at the WAL-record's definition or its logging denoting that the contents are not what you'd expect. I don't mean that the fix would break logical decoding, but that it's possible that an equivalent of the problem affecting hot standby also affects logical decoding. And even leaving those two users aside, it's possible that there will be further vulernable internal users or extensions parsing the WAL. > FWIW and not directly related, I recently became aware (because of a > customer question) that txid_current_snapshot() is oblivious of > XLOG_RUNNING_XACTS in a standby. AFAICS it's not a really serious > concern, but it was surprising. That's more fundamental than just XLOG_RUNNING_XACTS though, no? The whole way running transactions (i.e. including those that are just detected by looking at their xid) are handled in the known xids struct and in snapshots seems incompatible with that, no? Greetings, Andres Freund