Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tdyXc-00B7YN-6Q for pgsql-general@arkaria.postgresql.org; Fri, 31 Jan 2025 21:27:09 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1tdyXb-002et8-9a for pgsql-general@arkaria.postgresql.org; Fri, 31 Jan 2025 21:27:07 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tdyXa-002et0-0P for pgsql-general@lists.postgresql.org; Fri, 31 Jan 2025 21:27:06 +0000 Received: from fhigh-b1-smtp.messagingengine.com ([202.12.124.152]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1tdyXT-002b5j-1r for pgsql-general@lists.postgresql.org; Fri, 31 Jan 2025 21:27:03 +0000 Received: from phl-compute-01.internal (phl-compute-01.phl.internal [10.202.2.41]) by mailfhigh.stl.internal (Postfix) with ESMTP id 7445C2540131; Fri, 31 Jan 2025 16:26:57 -0500 (EST) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-01.internal (MEProxy); Fri, 31 Jan 2025 16:26:57 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= cc:cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm2; t=1738358817; x=1738445217; bh=S1P/PDI0I1bqxtJ5QzKEvELX0+fvZ8npOMd9TOs40Yo=; b= qQohHcfRaVPp0Rl2fhJaUhD71RYS/3AtMH+ymMiYpBRhby/frViLzFxgctr9oj0P IYZlpwlD/4mRhmwNkC1zVU9ck1a91W6evd28FZZW0xd3a/BWJ5+N6VQJYGtNos/y d3zDC17vrsz6uPh+Qxl+p4FRx6KiECTFEj6o3jMeNhKmLZ7BPJUdu+/t/ACIz/Th ku4uDKlelIT2g7u88kHLJaI4ILpz+9DJTMmivSzgycljqXBPGAZIfYbZXRNkw03x dveHM/1e4NFvnNWxzbiIUDWJ6fKxAtU3ocFl+uUcY2nBRAAAmjb3KanW5orznLtv y4j53uuVVmxSxEq/5/poUw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :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:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1738358817; x= 1738445217; bh=S1P/PDI0I1bqxtJ5QzKEvELX0+fvZ8npOMd9TOs40Yo=; b=k KAUaa+Qnw9teDYF4e/tSDVwBYJDrj1ibpwQvRmgJM2pTS/u87CQmmy5nsm+OWU9j saBv8VWVvCx7Y4iUd4xl6kjlP7XV6+aCBMgQkQHBmu9qIOiFY+zBIfuCrt286P3g cVGTdR4xPNJFmWpGoawuVMAJYksgqMJGSoNQ/F7VPQPZUFUtukFhoXYj1vlfPp+S vreKyyy33UnxXouSrYkrNylH/C6KvmEKsIw1OKpMzUpfL9w7L4o/2i5mw7GwbqFH 5VOXXdB4QfmsHoT9u3QLjvNxj8t62H77sUW2/fRzzQ6cKmjVcKV0UaJJJuTNbBQ0 3smmlBCjdxUTVOxSteQSw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgdelkeejucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnh htshculddquddttddmnecujfgurhepkfffgggfuffvvehfhfgjtgfgsehtjeertddtvdej necuhfhrohhmpeetughrihgrnhcumfhlrghvvghruceorggurhhirghnrdhklhgrvhgvrh esrghklhgrvhgvrhdrtghomheqnecuggftrfgrthhtvghrnhepuedufeejjefggfdttdeg hefgkeeuveekkeeiteettdekffehiedvtefhveffgeeunecuffhomhgrihhnpehpohhsth hgrhgvshhqlhdrohhrghenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgr ihhlfhhrohhmpegrughrihgrnhdrkhhlrghvvghrsegrkhhlrghvvghrrdgtohhmpdhnsg gprhgtphhtthhopedvpdhmohguvgepshhmthhpohhuthdprhgtphhtthhopehkughgrdgu vghvsehgmhgrihhlrdgtohhmpdhrtghpthhtohepphhgshhqlhdqghgvnhgvrhgrlheslh hishhtshdrphhoshhtghhrvghsqhhlrdhorhhg X-ME-Proxy: Feedback-ID: i76984098:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 31 Jan 2025 16:26:56 -0500 (EST) Message-ID: Date: Fri, 31 Jan 2025 13:26:55 -0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Postgres restore sometimes restores to a point 2 days in the past To: Koen De Groote Cc: PostgreSQL General References: <70c20a65-4624-4509-ac6a-ef7f0119ea28@aklaver.com> Content-Language: en-US From: Adrian Klaver In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 1/31/25 12:10, Koen De Groote wrote: > > What is the complete pg_basebackup command? > 2/ All my WAL files are archived and uploaded to the cloud. So, I can > just have them downloaded. I should have asked earlier what is the archive command? Are > > What is determining that a particular WAL file should be asked for? > > The postgres server itself does this. Here's the documentation: > https://www.postgresql.org/docs/16/runtime-config-wal.html#GUC-RESTORE-COMMAND > > And here: https://www.postgresql.org/docs/current/warm-standby.html > > > In practice, Postgres will see the "standby.signal" file and start In your OP you say: "It downloads the basebackup, unpacks it, sets a recovery.signal, ..." Are you setting standby.signal or recovery.signal or both? > asking for WAL files. It will read the database it has and determine > what the next WAL filename should be. And then it asks for it. And it > will keep asking for these hexadecimal filenames, 1 at a time, for as > long as the command or set of commands provided to "restore_command" > returns exit code 0. If the process receives any other exit code, it > stops recovery, switches timeline, and considers the database to be up > and running at the state its in. > > It's constantly asking "I want this file now" and the script I have as > the restore command will attempt to download it from the cloud. Then it > will attempt to unzip it and move it into place. If any of these steps > fails, I return exit code 1. > > Regards, > Koen De Groote > > -- Adrian Klaver adrian.klaver@aklaver.com