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 1oJY9q-0001wb-4w for pgsql-hackers@arkaria.postgresql.org; Thu, 04 Aug 2022 10:32:50 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oJY9o-0002pR-Un for pgsql-hackers@arkaria.postgresql.org; Thu, 04 Aug 2022 10:32:48 +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 1oJY9o-0002mf-KM for pgsql-hackers@lists.postgresql.org; Thu, 04 Aug 2022 10:32:48 +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 1oJY9h-0007af-R3 for pgsql-hackers@postgresql.org; Thu, 04 Aug 2022 10:32:48 +0000 Received: from [172.20.20.20] (c-24-126-12-114.hsd1.wv.comcast.net [24.126.12.114]) (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 60F36546A5; Thu, 4 Aug 2022 10:32:39 +0000 (UTC) Message-ID: Date: Thu, 4 Aug 2022 06:32:38 -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: Race between KeepFileRestoredFromArchive() and restartpoint Content-Language: en-US To: Kyotaro Horiguchi , noah@leadboat.com Cc: pgsql-hackers@postgresql.org, don@seiler.us References: <20220802143727.GA3796043@rfd.leadboat.com> <20220804062456.GA3844351@rfd.leadboat.com> <20220804.170640.1425291966829818860.horikyota.ntt@gmail.com> From: David Steele In-Reply-To: <20220804.170640.1425291966829818860.horikyota.ntt@gmail.com> 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 8/4/22 04:06, Kyotaro Horiguchi wrote: > At Wed, 3 Aug 2022 23:24:56 -0700, Noah Misch wrote in >>>> I think in this case a HINT might be sufficient to at least keep people from >>>> wasting time tracking down a problem that has already been fixed. >> >> Here's a patch to add that HINT. I figure it's better to do this before next >> week's minor releases. In the absence of objections, I'll push this around >> 2022-08-05 14:00 UTC. > > +1 Looks good to me as well. >>>> However, there is another issue [1] that might argue for a back patch if >>>> this patch (as I believe) would fix the issue. >>> >>>> [1] https://www.postgresql.org/message-id/CAHJZqBDxWfcd53jm0bFttuqpK3jV2YKWx%3D4W7KxNB4zzt%2B%2BqFg%40mail.gmail.com >>> >>> That makes sense. Each iteration of the restartpoint recycle loop has a 1/N >>> chance of failing. Recovery adds >N files between restartpoints. Hence, the >>> WAL directory grows without bound. Is that roughly the theory in mind? >> >> On further reflection, I don't expect it to happen that way. Each failure >> message is LOG-level, so the remaining recycles still happen. (The race >> condition can yield an ERROR under PreallocXlogFiles(), but recycling is >> already done at that point.) > > I agree to this. Hmmm, OK. We certainly have a fairly serious issue here, i.e. pg_wal growing without bound. Even if we are not sure what is causing it, how confident are we that the patches applied to v15 would fix it? Regards, -David