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 1tduE5-00AY6u-Kx for pgsql-general@arkaria.postgresql.org; Fri, 31 Jan 2025 16:50:42 +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 1tduE4-001gnM-87 for pgsql-general@arkaria.postgresql.org; Fri, 31 Jan 2025 16:50:40 +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 1tduE3-001gnD-To for pgsql-general@lists.postgresql.org; Fri, 31 Jan 2025 16:50:39 +0000 Received: from fout-a3-smtp.messagingengine.com ([103.168.172.146]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1tduE0-002ZFm-2Y for pgsql-general@lists.postgresql.org; Fri, 31 Jan 2025 16:50:39 +0000 Received: from phl-compute-08.internal (phl-compute-08.phl.internal [10.202.2.48]) by mailfout.phl.internal (Postfix) with ESMTP id 8FF3213801AC; Fri, 31 Jan 2025 11:50:35 -0500 (EST) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-08.internal (MEProxy); Fri, 31 Jan 2025 11:50:35 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= 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=1738342235; x=1738428635; bh=PG3S8fPDnePx+1hMZZcZs+5sbzLU6pMZgnEmh6mmcG8=; b= EtT4DbxJ/WHS5QL9CiJa5naMAZbFNbqREsVkTzGzQyO7T4lVL9Rgq6FL3KABv21g JdB8sC07Fi0a/dJ6m0rr5XMBHoDwLGJRHTuG+8nl7YGjBJDfacj5gHqa/5KDEvqR Gi0nuzz7dYRuFANWxozP/BVh6raPKFdjIUa/WKLS1HbjFfzHcCSs8cDLmD2DQa84 iZtwcEgFGFcC7pyub0SQJSdzJw9MqwJTGLwuPgA0dNbWZ4o52qkQ0MKb9aiujSHE UkMpH7Lbe8515PeZyThtE7fgViZoKGyDIHnIcWAPSF8fQYfRUkpEm5HM+sragW+6 1wEgNK785RU87OxhY8nrhg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=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=1738342235; x=1738428635; bh=P G3S8fPDnePx+1hMZZcZs+5sbzLU6pMZgnEmh6mmcG8=; b=zsu7EixGKzATt7VTW /+gskHwGO02yxeOjfWGpZ+zPhUd5GSQGHxHQVpXT7wUtenqbbfpNBAovCTbKEhmE 4STC0/CIMq2EUKlcTV+MBdFt0HrXuK6unAoqEvauMteqGVhKqo5SWFZjdvmowVQJ UM+p0v9JuTd3QCrj+g/lLbSBIaHqguuZ0Um/2NHsQ5/y1ygPRxrwaJMP2CgrYkdM wWdI1vmyVDLoJK/7CC4THcnI/hZQx+RQzwosKgQH84+g4jMzPQZfpZZs3NfnakS7 Z0NEoApIpBw4UkPMmrMlNVTMtfqBVUTrIZ1CFmPyYjVbo2fctECUXi42ifh7zcdk rqDaA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgdelfedtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnh htshculddquddttddmnecujfgurhepkfffgggfuffvfhfhjggtgfesthekredttddvjeen ucfhrhhomheptegurhhirghnucfmlhgrvhgvrhcuoegrughrihgrnhdrkhhlrghvvghrse grkhhlrghvvghrrdgtohhmqeenucggtffrrghtthgvrhhnpeffleegieefgfevudehtdfh keeutdffjeevgeffgeejvedthefgudeiteefheejheenucevlhhushhtvghrufhiiigvpe dtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegrughrihgrnhdrkhhlrghvvghrsegrkhhl rghvvghrrdgtohhmpdhnsggprhgtphhtthhopedvpdhmohguvgepshhmthhpohhuthdprh gtphhtthhopehkughgrdguvghvsehgmhgrihhlrdgtohhmpdhrtghpthhtohepphhgshhq lhdqghgvnhgvrhgrlheslhhishhtshdrphhoshhtghhrvghsqhhlrdhorhhg X-ME-Proxy: Feedback-ID: i76984098:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 31 Jan 2025 11:50:34 -0500 (EST) Message-ID: <70c20a65-4624-4509-ac6a-ef7f0119ea28@aklaver.com> Date: Fri, 31 Jan 2025 08:50:34 -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 , PostgreSQL General References: Content-Language: en-US From: Adrian Klaver In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 1/31/25 01:47, Koen De Groote wrote: Comments in line. > I'm running postgres 16.6 > > My backup strategy is: basebackup and WAL archive. These get uploaded to > the cloud. > > The restore is on an isolated machine and is performed daily. It > downloads the basebackup, unpacks it, sets a recovery.signal, and a > script is provided as restore_command, to download the WAL archives %f > and unpack them into %p > What is the complete pg_basebackup command? > In the script, the final unpacking is simply "gzip -dc %f > %p". The gz > files are first checked with "gzip -t". > > If a WAL archive is asked that doesn't exist yet, the script naturally > cannot find it, and exits with status code 1. This is the end of the > recovery. I don't understand the above. What is determining that a particular WAL file should be asked for? > > There are a few tables that are known to receive new entries multiple > times per day. However, the state of the recovery showed the latest item > to be 2 days in the past. Checking the live DB, there are an expected > amount of items since that ID. How active is the primary database you are pulling from? > > I checked the logs, the last WAL archive that got downloaded is indeed > the last one that was available. The one that failed to download on the > restore machine, was uploaded to the cloud 8 minutes later, according to > the upload logs on the live DB. Available where? If that was the last one available how could the subsequent one be a failure to download? > > The postgres logs themselves seem perfectly normal. It logs all these > WAL recoveries, switches the timeline, and becomes available. > > What could be going wrong? My main issue is that I don't know where to > start looking, since nothing in the logs seems abnormal. > > Regards, > Koen De Groote -- Adrian Klaver adrian.klaver@aklaver.com