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 1q1xAl-0004rp-0M for pgsql-hackers@arkaria.postgresql.org; Wed, 24 May 2023 22:41:35 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1q1xAj-0001FC-Pa for pgsql-hackers@arkaria.postgresql.org; Wed, 24 May 2023 22:41:33 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1q1xAj-0001F3-Fo for pgsql-hackers@lists.postgresql.org; Wed, 24 May 2023 22:41:33 +0000 Received: from wout5-smtp.messagingengine.com ([64.147.123.21]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1q1xAg-001xCQ-5G for pgsql-hackers@postgresql.org; Wed, 24 May 2023 22:41:32 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id A54FA3200919; Wed, 24 May 2023 18:41:28 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Wed, 24 May 2023 18:41:29 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paquier.xyz; h= cc:cc:content-type: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=fm1; t=1684968088; x=1685054488; bh=Ic zlKbASwDWPr7uyMBzIp6qOsy65I4/4/GgV7HVlHf8=; b=ROyA20cexXjwbGGjaQ wWLKJFX62GnUtk9/DY27+BFfldgZZhBUzku1Mqv+RFeM6CqM03H1QiTDA+rpCDm1 P0p0sBZRfUs2u37oGvOnQ4CXRw4EhkD9MsQIHF+wqDnisdqhU7HcKWfW/dbQ1ypO sfoT8MYbl48+r5YnRbJaVdvRDO0sOqu6i512tRFX8n87TBqzUfbicjHMbmlOrBOa TW/MHP5lWc/IR6mY2TuN5+1WUzE422gxOXEWWznAdedJPmU7V5+KED1QP90hRejg U2AmOJzxKXqOBIaPsy4X29k7b9wVNnCPTFM6S4Yhjff51TYt90qAv6SP3dRQ5Adv Fi1A== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type: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=1684968088; x=1685054488; bh=IczlKbASwDWPr 7uyMBzIp6qOsy65I4/4/GgV7HVlHf8=; b=Pr+VfAt9WHGIeH9yhDBvWIG5oAM8v P7pGhR1RKfeA8FnDN+JEmxxaNsrL6DVo7Ul2ieoY/nRJrThtpPQi7QotD6BuCdEN noytgdNmPLes2vqNhOucPOIPQ10lgr2yQnVYIO7xDFIinBt200CFogT8hjZtMNtC xMz/XMpF9shqtV85AgfB+57camW/awiV6LFCFm4pY427y8ahMOKi04A719eHAZph RXWQ7s/jd6C6mkpoonmOFfUbdvacr0JWHaVlGoVQxiMaGg0mDGHIxgIclHzVlDUv LVsEXWtfNcgBwOpaxg1Zk7mG62OnaggY93yMwBRcxh0MdoA8ozemk4LxQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrfeejiedguddvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne gfrhhlucfvnfffucdljedtmdenucfjughrpeffhffvvefukfhfgggtuggjsehgtderredt tddvnecuhfhrohhmpefoihgthhgrvghlucfrrghquhhivghruceomhhitghhrggvlhesph grqhhuihgvrhdrgiihiieqnecuggftrfgrthhtvghrnhepteelieefudffhffhtdetleeg geegfffhkeeuveetiefgudduvedutefggeeivdejnecuvehluhhsthgvrhfuihiivgeptd enucfrrghrrghmpehmrghilhhfrhhomhepmhhitghhrggvlhesphgrqhhuihgvrhdrgiih ii X-ME-Proxy: Feedback-ID: i0fe9450f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 24 May 2023 18:41:25 -0400 (EDT) Date: Thu, 25 May 2023 07:41:21 +0900 From: Michael Paquier To: Andres Freund Cc: Robert Haas , John Morris , "pgsql-hackers@postgresql.org" , Stephen Frost Subject: Re: Atomic ops for unlogged LSN Message-ID: References: <20230524214958.mt6f5xokpumvnrio@awork3.anarazel.de> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="Yi95FZybArnsUoXx" Content-Disposition: inline In-Reply-To: <20230524214958.mt6f5xokpumvnrio@awork3.anarazel.de> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --Yi95FZybArnsUoXx Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Wed, May 24, 2023 at 02:49:58PM -0700, Andres Freund wrote: > I was a bit confused by Michael's comment as well, due to the section of code > quoted. But he does have a point: pg_atomic_read_u32() does indeed *not* have > barrier semantics (it'd be way more expensive), and the patch does contain > this hunk: Thanks for the correction. The part about _add was incorrect. > So we indeed loose some "barrier strength" - but I think that's fine. For one, > it's a debugging-only value. But more importantly, I don't see what reordering > the barrier could prevent - a barrier is useful for things like sequencing two > memory accesses to happen in the intended order - but unloggedLSN doesn't > interact with another variable that's accessed within the ControlFileLock > afaict. This stuff is usually tricky enough that I am never completely sure whether it is fine without reading again README.barrier, which is where unloggedLSN is saved in the control file under its LWLock. Something that I find confusing in the patch is that it does not document the reason why this is OK. -- Michael --Yi95FZybArnsUoXx Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmRukpEACgkQnvQgOdby QH1wNA//fp5PdWNvmXQjBt1hYpz6dAZ9cABrPo0rODOCA6339sYUUJYKgePYCf/w sy/baIduTEazXwkwQBI18OUIlO2hbf1405gTpvcThqTdFgiL1KKZYAwF3/zNJcy5 l6cafHvlqGe+YEg8BnrtwbeDfpCYEnLm29U5ehqczSsB3qT1/4cGbvGDtv0qUmr2 7eT1mbAkQ4kzzH8E+GmCpOU6PmAD1gKbnIcoxpVMPjaawEDPJsAoKn1pqExKZuWe Ag6a4MHkpiFnY28Riyc5I8wUJRinKkKZySyZOElHqaLXhTBp/tUUx6FvwSN/ObZz OCuCm3QHeWD5zG/M2MVePmNQp3eX5LHqUceidsK4891e6wNx7a50N0KeuysGd04m yq8O9cprz9vfGIhxi7rfN04ZdPKpLoABXAktg/DSMyDSbrVZCNyEAj2N57bzch8D zsoJIdyt8maHiwC6IV03K1fHWay4/m9fEeq2/MV+EotYijEGk+JEOn+jOGjDUP+7 6L/TUbSHEB/UJdWGr1dCx4fjVx0J3t0F1SBhxikwQaQ34xP+V+w4NuLFvrRX6dfS 8diDDRMqYq48XKlNR2dEtEMLaVnA12wctRukn9SQufIc3gXO04QfyiXYyP4ee2ug nyWs59oL5ue9rrzyZlderFtyB7KfY7metLK/lL2TraBjROIXFV4= =2Sxe -----END PGP SIGNATURE----- --Yi95FZybArnsUoXx--