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 1oFF3h-0005Of-2W for pgsql-bugs@arkaria.postgresql.org; Sat, 23 Jul 2022 13:20:41 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oFF3f-0007l5-Pn for pgsql-bugs@arkaria.postgresql.org; Sat, 23 Jul 2022 13:20:39 +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 1oFF3f-0007kw-HN for pgsql-bugs@lists.postgresql.org; Sat, 23 Jul 2022 13:20:39 +0000 Received: from mail.thelabyrinth.net ([45.56.70.56]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oFF3b-0004L2-Nq for pgsql-bugs@lists.postgresql.org; Sat, 23 Jul 2022 13:20:39 +0000 Received: from [172.20.20.20] (c-24-126-12-186.hsd1.wv.comcast.net [24.126.12.186]) (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 E844454687; Sat, 23 Jul 2022 13:20:32 +0000 (UTC) Message-ID: Date: Sat, 23 Jul 2022 09:20:32 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 Subject: Re: could not link file in wal restore lines Content-Language: en-US To: Michael Paquier , Zsolt Ero Cc: pgsql-bugs@lists.postgresql.org References: From: David Steele 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 7/22/22 23:36, Michael Paquier wrote: > On Fri, Jul 22, 2022 at 04:24:54AM -0500, Zsolt Ero wrote: >> I've opened an issue on pgbackrest, where the developer confirmed that >> those files are not touched by pgbackrest, they are basically copied back >> exactly as they were. The backup/restore is on the same partition as the >> data folder, so no chance of file system changes, etc. Single master, no >> replication. >> >> I'm always doing clean data dir + init_db so there is nothing there before >> the restore. I can replicate this behaviour 100%. >> >> PostgreSQL version: psql (PostgreSQL) 12.11 (Ubuntu 12.11-1.pgdg18.04+1) >> >> OS is Ubuntu 18.04 >> >> pgbackrest issue: https://github.com/pgbackrest/pgbackrest/issues/1815 >> >> log details: >> >> could not link file "pg_wal/000000010000015600000098" to >> "pg_wal/00000001000001570000006E": File exists > > FWIW, the backend code has protections to prevent *exactly* this kind > of problems when recycling WAL segment files at checkpoints with a set > of LWLocks taken on the control file, for one. Perhaps you have > messed up things and you have finished in such a state that backrest > writes to pg_wal/ concurrently with a cluster running and running a > checkpoint, which would explain those link() calls to be failing? During recovery pgbackrest only writes into pg_wal when invoked by restore_command. That generally means pgbackrest should only be writing to RECOVERYXLOG. Zsolt, can you add --log-level-console=info to your archive_command so we can see what parameters are being passed to pgbackrest? This logging will appear in the postgres log. Regards, -David