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 1mKnKD-0005Np-KL for pgsql-hackers@arkaria.postgresql.org; Mon, 30 Aug 2021 19:52:10 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mKnKC-0000Mx-A4 for pgsql-hackers@arkaria.postgresql.org; Mon, 30 Aug 2021 19:52:08 +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 1mKnKB-0000Mo-Gt for pgsql-hackers@lists.postgresql.org; Mon, 30 Aug 2021 19:52:08 +0000 Received: from out4-smtp.messagingengine.com ([66.111.4.28]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mKnK8-00011d-6p for pgsql-hackers@postgresql.org; Mon, 30 Aug 2021 19:52:07 +0000 Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id A23FE5C0193; Mon, 30 Aug 2021 15:52:01 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Mon, 30 Aug 2021 15:52:01 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding: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= fm3; bh=MlpHCgk2kEDEdClSWrZhWNmHZhJUynFKm4twBtNWhB0=; b=dUdpz/0v Ay3fxl/pHSaHHXhgkRk+NrMCeD3bfNlBZkGtPkle/jlrW5fRY5fgJwX+8p/YKA6B XtGrf5jXrEJ0AAIa2PvacByT/LJLsMwg8Ia7wwk8W6ZyEkJd9hLxC0jJtujyAerg nB3xdl/QNGRVMhXvIuWFjipdpckG+D2InNgqxO3b5i8v+rECXaIc0xn7wsv/hESU /di+IPrTo21Z+zJBeyAEFHHWQTJhjMnm6CYdezBbeX5dqwKobdO5TZd966PeYMU8 2dmkfWEsg5ayuzAk0vwk/m4i/0yQmeFbVDUJND3jDwA4wRZRdY0tF31S++/dDmAS eOM+2x7zfACpsw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrudduledgudegvdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpeffhffvuffkgggtugfgjgesthekredttddtjeenucfhrhhomhepfdgrlhhv hhgvrhhrvgesrghlvhhhrdhnohdqihhprdhorhhgfdcuoegrlhhvhhgvrhhrvgesrghlvh hhrdhnohdqihhprdhorhhgqeenucggtffrrghtthgvrhhnpefhudeftdfhleevgeejtdff udelkeeiudfgtdfgtddtveetjeelteeghfeuiefgteenucffohhmrghinhepvghnthgvrh hprhhishgvuggsrdgtohhmnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehm rghilhhfrhhomheprghlvhhhvghrrhgvsegrlhhvhhdrnhhoqdhiphdrohhrgh X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 30 Aug 2021 15:51:59 -0400 (EDT) Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id A4D372A07E0; Mon, 30 Aug 2021 15:51:54 -0400 (-04) Date: Mon, 30 Aug 2021 15:51:54 -0400 From: "alvherre@alvh.no-ip.org" To: Andres Freund Cc: "Bossart, Nathan" , Robert Haas , Kyotaro Horiguchi , "x4mmm@yandex-team.ru" , "a.lubennikova@postgrespro.ru" , "hlinnaka@iki.fi" , "matsumura.ryo@fujitsu.com" , "masao.fujii@gmail.com" , "pgsql-hackers@postgresql.org" Subject: Re: archive status ".ready" files may be created too early Message-ID: <202108301951.x66z53s4lq6p@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20210829023722.cz6nbehyupp3hemk@alap3.anarazel.de> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2021-Aug-28, Andres Freund wrote: > While rebasing the aio patchset ontop of HEAD I noticed that this commit added > another atomic operation to XLogWrite() with archiving enabled. The WAL write > path is really quite hot, and at least some of the > NotifySegmentsReadyForArchive() calls are done while WALWriteLock is held. > > I think we should at least try to make the fast-path where no segment > boundaries were crossed use no atomic operations. I think the best way to achieve this is is to rely completely on walwriter doing the segment notification, so that the WAL write done by backend would only do a latch set. -- Álvaro Herrera Valdivia, Chile — https://www.EnterpriseDB.com/