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 1oJbj4-00055c-VG for pgsql-hackers@arkaria.postgresql.org; Thu, 04 Aug 2022 14:21:27 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oJbj3-000624-21 for pgsql-hackers@arkaria.postgresql.org; Thu, 04 Aug 2022 14:21:25 +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 1oJbj2-00061v-HN for pgsql-hackers@lists.postgresql.org; Thu, 04 Aug 2022 14:21:24 +0000 Received: from mail-qv1-xf2d.google.com ([2607:f8b0:4864:20::f2d]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1oJbiv-00014m-2D for pgsql-hackers@postgresql.org; Thu, 04 Aug 2022 14:21:23 +0000 Received: by mail-qv1-xf2d.google.com with SMTP id u8so13157674qvv.1 for ; Thu, 04 Aug 2022 07:21:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=leadboat.com; s=google; h=user-agent:in-reply-to:content-disposition:mime-version:references :message-id:subject:cc:to:from:date:from:to:cc; bh=7bNvLvuijTMekrOyNhuzeBZ32bUkJfeqcrl1b1tFbBw=; b=L1067sg8tDYF77htuzt9enY+U76sr9A6QIMRMzCGEmnhOE8hvAqUSfzIWal3m3ta7E uyHiOi7+6LdVaZ0E3JerkyMqwzoWSHivf202ZqLUg2ZtdrlcuwGSdzozn1Ysw94UEXe5 Sismf7y6pDYj0QivvbPmpz8UZgWzda9p9taU0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=user-agent:in-reply-to:content-disposition:mime-version:references :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc; bh=7bNvLvuijTMekrOyNhuzeBZ32bUkJfeqcrl1b1tFbBw=; b=iV7zVVx76LcwQhoAgtxoWZxioAtzz14XuuiuxnYbXaDQbnrqyUQFwy5ipCEfBWDbZO Ws4J5b2ebXmrOUrCTG/Y8his1BomEuqGxF5SW75Egc1CCH5WLludjoWaKDSeRPLjsU7w tlbsvZpP3koa02txX2CVx/5XuJpbmzFnGvB6MnVg3pujwYqIYuCFrEfi2wgQpWzhqy71 +tw80/QZlueU1icar+/uNeKlDpGv+qV4axqmuh+QiZydsMYyTLT7S+vKVh2K3yqG9USv piGJMCgOXCiR+tBZ/tKz15zPTAbR8t2SaJQom5NpbDXQ0dBwZWhzDxLJ+IWtgZ1YmKlP QEBg== X-Gm-Message-State: ACgBeo1kHcYEvtEHvSA2lYx1Nj4jz65goVkXlh6Sk7oLyTmbqlyUXt/V 914k70RCVaF7kuaMU2hOnuviTg== X-Google-Smtp-Source: AA6agR45U+8AJ6IqpYXqq3BLPs7KJKzI4ixV7qI0HvgWvO4uoTH9cABB+vnTNQWNVq8fbrfoMZrM7A== X-Received: by 2002:a05:6214:2588:b0:477:22bd:e1e6 with SMTP id fq8-20020a056214258800b0047722bde1e6mr1660221qvb.105.1659622875071; Thu, 04 Aug 2022 07:21:15 -0700 (PDT) Received: from rfd.leadboat.com ([2600:1702:a20:5750::2e]) by smtp.gmail.com with ESMTPSA id p7-20020a05622a00c700b0033e51aea00esm763362qtw.25.2022.08.04.07.21.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 04 Aug 2022 07:21:13 -0700 (PDT) Date: Thu, 4 Aug 2022 07:21:10 -0700 From: Noah Misch To: David Steele Cc: Kyotaro Horiguchi , pgsql-hackers@postgresql.org, don@seiler.us Subject: Re: Race between KeepFileRestoredFromArchive() and restartpoint Message-ID: <20220804142110.GA3878007@rfd.leadboat.com> References: <20220802143727.GA3796043@rfd.leadboat.com> <20220804062456.GA3844351@rfd.leadboat.com> <20220804.170640.1425291966829818860.horikyota.ntt@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Thu, Aug 04, 2022 at 06:32:38AM -0400, David Steele wrote: > 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. Thanks for reviewing. > >>>>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? I'll say 7%; certainly too low to stop investigating. The next things I'd want to see are: - select name, setting, source from pg_settings where setting <> boot_val; - log_checkpoints log entries, and other log entries having the same PID If the theory about checkpoint skipping holds, there should be a period where the volume of WAL replayed greatly exceeds max_wal_size, yet 0-1 restartpoints begin and 0 restartpoints complete.