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 1jtzH3-0002rM-BF for pgsql-admin@arkaria.postgresql.org; Fri, 10 Jul 2020 20:05:33 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jtzH2-0001Eo-AR for pgsql-admin@arkaria.postgresql.org; Fri, 10 Jul 2020 20:05:32 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jtzH2-0001Ah-2D for pgsql-admin@lists.postgresql.org; Fri, 10 Jul 2020 20:05:32 +0000 Received: from mail.thelabyrinth.net ([45.56.70.56]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jtzGv-00032f-Lh for pgsql-admin@lists.postgresql.org; Fri, 10 Jul 2020 20:05:31 +0000 Received: from Davids-MacBook-Pro.local (c-73-39-102-148.hsd1.md.comcast.net [73.39.102.148]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: dsteele) by mail.thelabyrinth.net (Postfix) with ESMTPSA id 2642254670; Fri, 10 Jul 2020 20:05:25 +0000 (UTC) Subject: Re: OK to delete old .history files from archive? To: Don Seiler , Pgsql-admin References: From: David Steele Message-ID: <8d7ed172-a84f-613d-9a1c-3c98b22993dd@pgmasters.net> Date: Fri, 10 Jul 2020 16:05:24 -0400 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Hi Don, On 7/3/20 2:02 PM, Don Seiler wrote: > TL;DR: Is it OK to delete .history files from WAL archiveĀ (wal-g/S3) > that are older than the oldest full backup? > > Today we had restores fail complaining that they can't find timelineĀ 21 > when they should only be on timeline 1. The logs show them recovering > 12+ .history files from the WAL archives. Looking at the archives, these > history files are all timestamped between last July and October. The > restore is from a full backup taken last night. > > This happens to be the first restore after adding > "recovery_target_timeline='latest'" to our recovery.conf template. So > I'm guessing that PG just didn't bother with those old .history files > before. > > I believe these old .history files were just not properly cleaned up > from some exercises done last year on previous/other incarnations and > are now just polluting the WAL archive. I don't see why I would need > .history files that are nearly a year older than the backup I'm > restoring from, but just want to confirm it is safe to blow them all away. It should be fine to remove the history files as they do not refer to any valid history in the WAL. Of course, it would be best to keep a copy of them until you test your restore again. Just in case. Regards, -- -David david@pgmasters.net