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 1pQCcQ-0007lF-L4 for pgsql-hackers@arkaria.postgresql.org; Thu, 09 Feb 2023 19:30:07 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pQCcP-0003Gp-J3 for pgsql-hackers@arkaria.postgresql.org; Thu, 09 Feb 2023 19:30:05 +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 1pQCcO-00039J-6Y for pgsql-hackers@lists.postgresql.org; Thu, 09 Feb 2023 19:30:05 +0000 Received: from wout5-smtp.messagingengine.com ([64.147.123.21]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pQCcI-00081H-Tw for pgsql-hackers@lists.postgresql.org; Thu, 09 Feb 2023 19:30:03 +0000 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.west.internal (Postfix) with ESMTP id 40BE5320093A; Thu, 9 Feb 2023 14:29:55 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Thu, 09 Feb 2023 14:29:55 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=anarazel.de; h= cc:cc: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=1675970994; x=1676057394; bh=58+8KDXjYA Ld+Yrl9tLHj/VRwpaSQwDed0GB1Rv8AUs=; b=OJE/xD+JKymYTg4iBEKuIPPAGK vbJyK2ueAo/Yq7Gpf/7VnUoLigiC91kVLa9uYZP6rHtK/m6jjD4Zcm/NKhuihTXB VrxMrPUyzhTS7jV7oV1kxtzvpSUER9id9x5EdgRTY50ekj5FZlzqqkAibrzHW1/D fPDMVGszkAmwTMMjJ6JLJqe5tBO6Y5lPtyBnYj3B0G28VRNEsxLrD+95AgYdtEx6 b7LDWfbg1xyRD7aO48ahxsUF0pY4g8Ju1FP9M2KEArjAaXVN3X7kd74BaHTn//xg RkH7lBtW3RgdEzNl32r5aZoxV28Vf81tZ/1pTel4jfWGA65aWI4fyuXX6qoA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc: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=1675970994; x=1676057394; bh=58+8KDXjYALd+Yrl9tLHj/VRwpaS QwDed0GB1Rv8AUs=; b=glXBQGoXo+ltMWcjlh2MmSfO+IcinQrGr2CYmqPcQh0h MXamao+v3b4WuA+BLtoACAZhWiBsKHzD9P2Er8fytJFm0n97frQBYUMfZLvgJSZ5 yDZeriuMVUQgn2gsQtxBRJFlDNtcwcV8vA3ZyVEVGZDWiUZy+zd5hl2o3Ap0kkyr YEoKCcDdk2OcY6++YIv0+V4KVX6jeKk7A+OdQInoiy8x3d8jD/6RXmHKAMtnTGfo a0wFCVQlytf52bRXQ7M40g18n/eUzyMt2qMXmo1uh1/rio7spqKUm4jsUe9fiZuR OfT44iljlInK/kdQWl2ufLMnlDg1EKbkgBGPz8F1kA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrudehfedguddvfecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpeffhffvvefukfhfgggtuggjsehttdertddttddvnecuhfhrohhmpeetnhgu rhgvshcuhfhrvghunhguuceorghnughrvghssegrnhgrrhgriigvlhdruggvqeenucggtf frrghtthgvrhhnpedvffefvefhteevffegieetfefhtddvffejvefhueetgeeludehteev udeitedtudenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhroh hmpegrnhgurhgvshesrghnrghrrgiivghlrdguvg X-ME-Proxy: Feedback-ID: id4a34324:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 9 Feb 2023 14:29:54 -0500 (EST) Date: Thu, 9 Feb 2023 11:29:52 -0800 From: Andres Freund To: Robert Haas Cc: Tom Lane , Nathan Bossart , Michael Paquier , Thomas Munro , Fujii Masao , Postgres hackers Subject: Re: Weird failure with latches in curculio on v15 Message-ID: <20230209192952.jvx56yuutlxuvjjf@awork3.anarazel.de> References: <20230206004631.GA277434@nathanxps13> <20230208174350.GB451849@nathanxps13> <20230208222554.GB546776@nathanxps13> <20230209002413.GA603595@nathanxps13> <3907196.1675957889@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, On 2023-02-09 11:12:21 -0500, Robert Haas wrote: > On Thu, Feb 9, 2023 at 10:51 AM Tom Lane wrote: > > I'm fairly concerned about the idea of making it common for people > > to write their own main loop for the archiver. That means that, if > > we have a bug fix that requires the archiver to do X, we will not > > just be patching our own code but trying to get an indeterminate > > set of third parties to add the fix to their code. I'm somewhat concerned about that too, but perhaps from a different angle. First, I think we don't do our users a service by defaulting the in-core implementation to something that doesn't scale to even a moderately busy server. Second, I doubt we'll get the API for any of this right, without an acutual user that does something more complicated than restoring one-by-one in a blocking manner. > I don't know what kind of bug we could really have in the main loop > that would be common to every implementation. They're probably all > going to check for interrupts, do some work, and then wait for I/O on > some things by calling select() or some equivalent. But the work, and > the wait for the I/O, would be different for every implementation. I > would anticipate that the amount of common code would be nearly zero. I don't think it's that hard to imagine problems. To be reasonably fast, a decent restore implementation will have to 'restore ahead'. Which also provides ample things to go wrong. E.g. - WAL source is switched, restore module needs to react to that, but doesn't, we end up lots of wasted work, or worse, filename conflicts - recovery follows a timeline, restore module doesn't catch on quickly enough - end of recovery happens, restore just continues on > > If we think we need primitives to let the archiver hooks get all > > the pending files, or whatever, by all means add those. But don't > > cede fundamental control of the archiver. The hooks need to be > > decoration on a framework we provide, not the framework themselves. > > I don't quite see how you can make asynchronous and parallel archiving > work if the archiver process only calls into the archive module at > times that it chooses. That would mean that the module has to return > control to the archiver when it's in the middle of archiving one or > more files -- and then I don't see how it can get control back at the > appropriate time. Do you have a thought about that? I don't think archiver is the hard part, that already has a dedicated process, and it also has something of a queuing system already. The startup process imo is the complicated one... If we had a 'restorer' process, startup fed some sort of a queue with things to restore in the near future, it might be more realistic to do something you describe? Greetings, Andres Freund