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 1gSrtR-0007Y2-J9 for pgsql-hackers@arkaria.postgresql.org; Fri, 30 Nov 2018 23:08:17 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gSrtQ-0001nl-4l for pgsql-hackers@arkaria.postgresql.org; Fri, 30 Nov 2018 23:08:16 +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 1gSrtP-0001ne-Tl for pgsql-hackers@lists.postgresql.org; Fri, 30 Nov 2018 23:08:15 +0000 Received: from wout2-smtp.messagingengine.com ([64.147.123.25]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gSrtN-0003Fj-9k for pgsql-hackers@lists.postgresql.org; Fri, 30 Nov 2018 23:08:15 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id 4E7E09A5; Fri, 30 Nov 2018 18:08:10 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Fri, 30 Nov 2018 18:08:10 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paquier.xyz; h= date:from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=fm3; bh=eslixG/hwotcui8o8oChHVCUNif R+wcTurdeujCIBKs=; b=SI+iDt/7wiJsXkCG+CsNavPNlhXQdiOqrO6Df3P87Wi ZXbBO2XHEnz+MasnGapYQWh6Mvu3XpX5UxMpEQpwaKtbm29ykQ/JEEtx6qZSu9bZ opW7Y4VtEuHeBBfq1tkOerBvY1zO1fkf11T/4ebKKzPdHyuxxtTeHU7DdkU1O0sD kkT11GCKQCWci1f1tg8p7n0YNxGyFX9BrZuI/eJnaSot4g5t+S10hosTYMl91b4i w1yB2TVnxD3mJ0vWh1rrNyCa4q9TkelAOvxdtrleYeq2UAdtus30bmJbtTJClcOM Md3N0pOnOxVYYiWODzDFOudJB5ycMLc3gP0HV2UJxsw== 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=eslixG /hwotcui8o8oChHVCUNifR+wcTurdeujCIBKs=; b=JhB8fL8mLF8fjrGZ4wqQ+0 IYHIUE6fksVaWx3XG8zN5Vyk7xy1XlNFJsNAxIiRNA2qjEJPw/o+xqr+x0mbo/eN djmSyfR+PknqEC5vv/NjDFAXKfDrz4VsyciczKssUrlBCde+gPQUpPjOtUffc3Tg LEx4HMosCcH3KnnPar6KHVbxqa9aRVHGq8Ple9NOGdH/lxYP9FjAdbPhbDo1hxyK MqxAvmIP8nphxwNNxOvFmqA+hTHKsAk7fJjs7AFdOn3wao16O9aqQK9/bT8t7PHV a14zBa84ZzcZj9D8kGMTRb+Bwb6uQfzdNdi2WOIOH8tYMWufB7ehZbn8Wwlba5iA == X-ME-Sender: X-ME-Proxy: Received: from paquier.xyz (c137162.net61215.cablenet.ne.jp [61.215.137.162]) by mail.messagingengine.com (Postfix) with ESMTPA id A83DB102A0; Fri, 30 Nov 2018 18:08:07 -0500 (EST) Date: Sat, 1 Dec 2018 08:08:04 +0900 From: Michael Paquier To: Simon Riggs Cc: Alvaro Herrera , Andres Freund , PostgreSQL Hackers Subject: Re: pgsql: Avoid duplicate XIDs at recovery when building initial snapshot Message-ID: <20181130230804.GC1846@paquier.xyz> References: <20181022174155.wxxu2qt3bcrbrqy5@alap3.anarazel.de> <20181022221538.d73yxdypbmmzmi2l@alvherre.pgsql> <20181023014338.GA1658@paquier.xyz> <20181101060911.GG1727@paquier.xyz> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="zCKi3GIZzVBPywwA" Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --zCKi3GIZzVBPywwA Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Nov 30, 2018 at 02:55:47PM +0000, Simon Riggs wrote: > 1df21ddb looks OK to me and was simple enough to backpatch safely. Thanks for the feedback! > Seems excessive to say that the WAL record is corrupt, it just contains > duplicates, just as exported snapshots do. There's a few other imprecise > things around in WAL, that is why we need the RunningXact data in the fir= st > place. So we have a choice of whether to remove the duplicates eagerly or > lazily. >=20 > For GetRunningTransactionData(), we can do eager or lazy, since its not a > foreground process. I don't object to changing it to be eager in this pat= h, > but this patch is more complex than 1df21ddb and I don't think we should > backpatch this change, assuming it is acceptable. Yes, I would avoid a backpatch for this more complicated one, and we need a solution for already-generated WAL. It is not complicated to handle duplicates for xacts and subxacts however holding ProcArrayLock for a longer time stresses me as it is already a bottleneck. > This patch doesn't do it, but the suggestion that we touch > GetSnapshotData() in the same way so we de-duplicate eagerly is a differe= nt > matter and would need careful performance testing to ensure we don't slow > down 2PC users. Definitely. That's a much hotter code path. I am not completely sure if that's an effort worth pursuing either.. -- Michael --zCKi3GIZzVBPywwA Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAlwBwtQACgkQnvQgOdby QH1EHBAAlMWPycXIXFK74B9OtXBh7w7XZQDeHVSLhRMR/kHZh+OiZVqMW8XdifW1 IChD78osypNhHSeF8RC63twB/nxxMfIuy8uqQ1rVG1MBLBTbROS4QN1RKPTEJY8j mx8EEcygXOwVJuJYLKfkrjIuUwTc3Wg6WljCnXm/cHJE5RmXZSQvJ38EKdkee40E rsPQGyFAbRduPYB1BpF6KANZBRe1FXQi+9N/Iap+e0RFPkeYuZzt0g8ZCLtflPKw o2j2s5dhvmQZohHi1MEAnDk9ITLXLfjfAP8yAWjgEtcxQwFwwLj3eeWVqn/s/qnH eccAtuK7AfRoRT9mOCQ22kIQeFPRiEtl2PRqK1Xk3gukZN8CtL/5wJGcPu6oVekr DVPV9hPEqIkmE5PxJeYq0a2jeorY+n5LtZzwcWIHOwKK8u7qupJSfKWeFjTW3N86 COv9T5sQqKCl3O/BkMdUETQZ44uhTS8mg/lubw1G3qRcfBjCFvkJgqCL6AuCKhW4 +vPDL5rdNlYUOOKo8WXFOxQPxOG359qJAI24ROwZ6Z2hDiKgAFJN1psnnUg71ohi ZOwEb7D6U0kmqZweeGf13ZGi0vqehj9R4UABkPlQcMwPTLY85ttM+VZdLFh6IFyB yEEq8Z+M/lBFrqLF9B7yGYGy/JHyOY6i05Tict2A3RyWJZ86FDA= =AVsJ -----END PGP SIGNATURE----- --zCKi3GIZzVBPywwA--