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 1o8lss-0000JG-TF for pgsql-hackers@arkaria.postgresql.org; Tue, 05 Jul 2022 16:58:46 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1o8lsr-00040C-FI for pgsql-hackers@arkaria.postgresql.org; Tue, 05 Jul 2022 16:58:45 +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 1o8lsr-000403-67 for pgsql-hackers@lists.postgresql.org; Tue, 05 Jul 2022 16:58:45 +0000 Received: from mail-pg1-x52f.google.com ([2607:f8b0:4864:20::52f]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1o8lso-0008SU-S1 for pgsql-hackers@postgresql.org; Tue, 05 Jul 2022 16:58:44 +0000 Received: by mail-pg1-x52f.google.com with SMTP id bh13so5946207pgb.4 for ; Tue, 05 Jul 2022 09:58:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=YuBkWtnRC7IDyZq1vPRiW/RXL0RsxYgdQ9GYITPjyd4=; b=kLZaJxqSllggL+WnXUK9KOK+hw//CabgG4c0r75P8AZoYJ3G/Ljthptyg3B7SEEXNH haPOd+Tj3eGYXWa5K415kEiXOW4pK6FWvidOybef037mSsi6nYPv0pcp7hck1Yk2yjdn HPR8NdQXpODqBQrcYECZFTkDMMa6MK9mMK/UF3AG5VpWQX5/aGo8O/nhGt5yKov0L1UH VsWXDwTXvKHbVfzLbKm3NzWN+htCdnezQXVX/ItpuP1yw/qUD5c7WzTEFOltWMI6Q47f o0cJqrcjqI6kR/FWm5dmfAa9SxrrUiz+9/I6GyZw815Y8MfIFgb3KAL7ct10ikZUQEBS sxew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=YuBkWtnRC7IDyZq1vPRiW/RXL0RsxYgdQ9GYITPjyd4=; b=fH8X80KezkCpPU1Tuwbdu1DgnhzvU0gUMlhD0tth/tVYld2oAaR1DKMGb/62HtYR3b HkADj/ktZjpvJM3Ii3ZkjrRz5xuqn7TAkVeGu7lfSFvOzsKhVaVOKG/5rPtLhCxXA8AW mY8GTc6siswmEXJsG6NefiLzjzamrTufJNEB7G/dUp0I6SYiUmfJ1SIQFu9CBWS3TghX zsEd78WtzHsCoelT3Ap6yqJX0apwqjqEAUy0Lq++zeg+k4ihKB3iC3INn8sbXeste8Uh J33abv1lozx5KQJPNCSxp4gVlVGjuRUja6AOoFpIEvSiUbmn2pUzvZCQ5T/1/KJYqZUK 21jQ== X-Gm-Message-State: AJIora8PVODDhtXyC+QPCGs80gBLNb2C33nVVbBio+SSzwmGLsF7LHMF rbPI2AzVVNcc2RYc11vx87Y= X-Google-Smtp-Source: AGRyM1tqtC+9A1UyePgtayViLFsv+TLbQPZTTh+FHNcGfTnLcupOSeOwDzpobAiP0/TNscBD5JqNaA== X-Received: by 2002:a63:5302:0:b0:412:219:928f with SMTP id h2-20020a635302000000b004120219928fmr16825026pgb.425.1657040321680; Tue, 05 Jul 2022 09:58:41 -0700 (PDT) Received: from nathanxps13 ([50.54.155.70]) by smtp.gmail.com with ESMTPSA id j7-20020a17090aeb0700b001ef8146f35asm6203140pjz.19.2022.07.05.09.58.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Jul 2022 09:58:41 -0700 (PDT) Date: Tue, 5 Jul 2022 09:58:38 -0700 From: Nathan Bossart To: Michael Paquier Cc: Kyotaro Horiguchi , tgl@sss.pgh.pa.us, robertmhaas@gmail.com, pgsql-hackers@postgresql.org Subject: Re: avoid multiple hard links to same WAL file after a crash Message-ID: <20220705165838.GA1232533@nathanxps13> References: <289699.1649694527@sss.pgh.pa.us> <20220411165257.GB1915258@nathanxps13> <20220412.154631.417529439388886590.horikyota.ntt@gmail.com> <20220412162742.GB2062175@nathanxps13> <20220502173907.GB3351307@nathanxps13> <20220502230613.GA3398932@nathanxps13> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Tue, Jul 05, 2022 at 10:19:49AM +0900, Michael Paquier wrote: > On Thu, May 05, 2022 at 08:10:02PM +0900, Michael Paquier wrote: >> I'd agree with removing all the callers at the end. pgrename() is >> quite robust on Windows, but I'd keep the two checks in >> writeTimeLineHistory(), as the logic around findNewestTimeLine() would >> consider a past TLI history file as in-use even if we have a crash >> just after the file got created in the same path by the same standby, >> and the WAL segment init part. Your patch does that. > > As v16 is now open for business, I have revisited this change and > applied 0001 to change all the callers (aka removal of the assertion > for the WAL receiver when it overwrites a TLI history file). The > commit log includes details about the reasoning of all the areas > changed, for clarity, as of the WAL recycling part, the TLI history > file part and basic_archive. Thanks! I wonder if we should add a comment in writeTimeLineHistoryFile() about possible concurrent use by a WAL receiver and the startup process and why that is okay. -- Nathan Bossart Amazon Web Services: https://aws.amazon.com