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 1nla0w-0000cJ-9e for pgsql-hackers@arkaria.postgresql.org; Mon, 02 May 2022 17:39:14 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nla0v-0007Wr-4S for pgsql-hackers@arkaria.postgresql.org; Mon, 02 May 2022 17:39:13 +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 1nla0u-0007Wi-RY for pgsql-hackers@lists.postgresql.org; Mon, 02 May 2022 17:39:12 +0000 Received: from mail-pl1-x636.google.com ([2607:f8b0:4864:20::636]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1nla0t-00035B-Dp for pgsql-hackers@postgresql.org; Mon, 02 May 2022 17:39:12 +0000 Received: by mail-pl1-x636.google.com with SMTP id n14so6122576plf.3 for ; Mon, 02 May 2022 10:39:11 -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=w9rXvxhQdDDZIv+fLtg1tIjCjARULHz74Yvh/HV4Q5U=; b=PLlr8FkCGPQ3yWcdb58hvvXyMcv1pem83mgwmMuTL6bHOo4DrzWOPNcZMby+EHV5KY E5+TdJZDgnvngCo39c7CSxZjr8Cm3WPtyehJom6bTmOjwkB+P14RQ1GP/AkL+6P/6SoD P5tmcTNGS24oibfktxD7d4y5EoT/whNq3zcjCvvz/2Pi3Owtf8XfoN00iNAIMacp6Lzq 9/nHdoMN37GM0By9uR3iexIgxUrN/VEy1rVsn2pRsIiNBNQ8ljYt3T4FgP0bIrrz860F nAbg6p615UA/9t/gOCKrFyCKV6aEmypHr1wiRCGcuA/uJrKL6ABWxgdRaJZTRL6+cusr 3DKg== 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=w9rXvxhQdDDZIv+fLtg1tIjCjARULHz74Yvh/HV4Q5U=; b=nuDj4xTVMzsLHBCv6pCwP51KKhiThO7n4tshJguDX21vcl5ggm8CVG31KRPyYArMr9 dy4u8StmUaQxIyzMbu7blZFr5uxYxRLNeSOj/8QicfE0drZK9D19V0JnV4grydcJUIQ4 GZJ/VoGc0d/trBaAG9xcMfoajYJ60eFXAO4RZqTJRlKUW86ngX+2/xw/8BPJvN0Mm7TK ceMf4BN2oomTyEtepRleLzEAmNSjx33XbPFcsdFR7aoDb6n7Q0pvNrU0o5fOXYC/aRRe XSwghAA+sfkQDKjv8W+oJunzN47iVi34kuEnXt4fgaPG1Fkfdh7b0cZ7W5A4VT3s3SZZ 10hg== X-Gm-Message-State: AOAM530013I9QAmKhSyag+CjoCNVAxkV1A6/d5jLsTQTnIkrnQ1bOIOn fIn88Lnd6uPkENxcccoW2RA= X-Google-Smtp-Source: ABdhPJyX7Atk9mEkH8ARTgZru8h7/H/g7uPLmuBpIhAItdUqOEfTm2PZ/91Qsh+j5E5pGrp2CP2mQg== X-Received: by 2002:a17:902:aa46:b0:159:6cb:163 with SMTP id c6-20020a170902aa4600b0015906cb0163mr12535229plr.83.1651513149527; Mon, 02 May 2022 10:39:09 -0700 (PDT) Received: from nathanxps13 ([50.54.155.70]) by smtp.gmail.com with ESMTPSA id 38-20020a630f66000000b003c14af505fasm11269821pgp.18.2022.05.02.10.39.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 May 2022 10:39:09 -0700 (PDT) Date: Mon, 2 May 2022 10:39:07 -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: <20220502173907.GB3351307@nathanxps13> References: <289699.1649694527@sss.pgh.pa.us> <20220411165257.GB1915258@nathanxps13> <20220412.154631.417529439388886590.horikyota.ntt@gmail.com> <20220412162742.GB2062175@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 Mon, May 02, 2022 at 07:48:18PM +0900, Michael Paquier wrote: > Skimming through at the buildfarm logs, it happens that the tests are > able to see this race from time to time. Here is one such example on > rorqual: > https://buildfarm.postgresql.org/cgi-bin/show_stage_log.pl?nm=rorqual&dt=2022-04-20%2004%3A47%3A58&stg=recovery-check > > And here are the relevant logs: > 2022-04-20 05:04:19.028 UTC [3109048][startup][:0] LOG: restored log > file "00000002.history" from archive > 2022-04-20 05:04:19.029 UTC [3109111][walreceiver][:0] LOG: fetching > timeline history file for timeline 2 from primary server > 2022-04-20 05:04:19.048 UTC [3109111][walreceiver][:0] FATAL: could > not link file "pg_wal/xlogtemp.3109111" to "pg_wal/00000002.history": > File exists > [...] > 2022-04-20 05:04:19.234 UTC [3109250][walreceiver][:0] LOG: started > streaming WAL from primary at 0/3000000 on timeline 2 > > The WAL receiver upgrades the ERROR to a FATAL, and restarts > streaming shortly after. Using durable_rename() would not be an issue > here. Thanks for investigating this one. I think I agree that we should simply switch to durable_rename() (without a file existence check beforehand). -- Nathan Bossart Amazon Web Services: https://aws.amazon.com