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 1oI2o1-0005H0-P9 for pgsql-hackers@arkaria.postgresql.org; Sun, 31 Jul 2022 06:52:05 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oI2nz-0007Ij-My for pgsql-hackers@arkaria.postgresql.org; Sun, 31 Jul 2022 06:52:03 +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 1oI2nz-0007Ia-DE for pgsql-hackers@lists.postgresql.org; Sun, 31 Jul 2022 06:52:03 +0000 Received: from mail-oa1-x29.google.com ([2001:4860:4864:20::29]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1oI2nx-0001UT-9d for pgsql-hackers@postgresql.org; Sun, 31 Jul 2022 06:52:02 +0000 Received: by mail-oa1-x29.google.com with SMTP id 586e51a60fabf-10ea9ef5838so4866657fac.3 for ; Sat, 30 Jul 2022 23:52:01 -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=r0hVMxZCaDlBhGOh5Ip02sKMaOqp9gVA63/1cFzQ6U4=; b=S8wPP5dt8sQT67cBty3odOHOa+/wtUhDpWyRqp+eUOGdAUGbS7nPjsS3sxd/BKrVBf NnSWtD1w20fFHnix33K/1oFW5KZDkykEc4RmzN5a5rI/4Tyn1RXOqdEtfbmkx48TiyUY Uio+KSp4zzFPrintuSo6Tikj2pBX13q3Dz4HE= 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=r0hVMxZCaDlBhGOh5Ip02sKMaOqp9gVA63/1cFzQ6U4=; b=pwyTz2B6DLkDVQxGevcm24bq0jVXdHuRExp/moQVndVrhMtDxdpTrH9o0no4jXHxhw YlDbpnGECwVU69sNR+KIfgu1Ing3xMQyECD5c27Y1SAPna1uuvqd20m1kdDw5znEDa6K /YXFuZO92SKZapl2MNcO6uIJjWMzuiFgkb4jANPyaKxnPPjjV5Oflz4nJo1qQKTb8ldg YbNv8yd0V83Lhu69KQZVJ0kXbGfC2wOHUD3fneVAu+E24Ll/lfYI2WZfdFTXCzblFzbM ywvHAtMUzOTRb3m2wol0hyFHLxVCEnR4St7BvkpC7dCYdiquOa0afFI87sdZ+cyEuLqQ srBQ== X-Gm-Message-State: AJIora+6AHLlOIoMv7oSpHVCsbHjVhGLN89Szo1qSry6893rIiG0PC0A TqoTvUgTxJHkbhnjiFCbz5UIOA== X-Google-Smtp-Source: AGRyM1sAg+R9knnMRqwsrNjC/YIoNXdgftQmkh5JEB0BP8SVROcIHXdYfpLMw8gf+TS8lDWwOErbYA== X-Received: by 2002:a05:6870:e245:b0:de:9321:9ea3 with SMTP id d5-20020a056870e24500b000de93219ea3mr4801776oac.79.1659250320298; Sat, 30 Jul 2022 23:52:00 -0700 (PDT) Received: from rfd.leadboat.com ([2600:1702:a20:5750::2e]) by smtp.gmail.com with ESMTPSA id u5-20020a4ac385000000b0043571d9c098sm2091376oop.43.2022.07.30.23.51.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 30 Jul 2022 23:51:59 -0700 (PDT) Date: Sat, 30 Jul 2022 23:51:56 -0700 From: Noah Misch To: Nathan Bossart Cc: David Steele , Kyotaro Horiguchi , robertmhaas@gmail.com, masao.fujii@oss.nttdata.com, pgsql-hackers@postgresql.org Subject: Re: remove more archiving overhead Message-ID: <20220731065156.GA3694276@rfd.leadboat.com> References: <20220707182251.GA2255242@nathanxps13> <20220707220716.GA2258527@nathanxps13> <20220708.105652.1551158050191356887.horikyota.ntt@gmail.com> <44dbf5e4-8eec-da56-daba-755128b3723e@pgmasters.net> <20220708165450.GA2356733@nathanxps13> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220708165450.GA2356733@nathanxps13> 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 Fri, Jul 08, 2022 at 09:54:50AM -0700, Nathan Bossart wrote: > Since it's okay to return true or false in the identical/persisted file > case, I didn't think it deserved emphasis. I think returning false is not-okay: > --- a/doc/src/sgml/backup.sgml > +++ b/doc/src/sgml/backup.sgml > @@ -681,14 +681,28 @@ test ! -f /mnt/server/archivedir/00000001000000A900000065 && cp pg_wal/0 > any pre-existing archive file. This is an important safety feature to > preserve the integrity of your archive in case of administrator error > (such as sending the output of two different servers to the same archive > - directory). > + directory). It is advisable to test your proposed archive library to ensure > + that it does not overwrite an existing file. > > > > - It is advisable to test your proposed archive library to ensure that it > - indeed does not overwrite an existing file, and that it returns > - false in this case. > - The example command above for Unix ensures this by including a separate > + In rare cases, PostgreSQL may attempt to > + re-archive a WAL file that was previously archived. For example, if the > + system crashes before the server makes a durable record of archival success, > + the server will attempt to archive the file again after restarting (provided > + archiving is still enabled). When an archive library encounters a > + pre-existing file, it may return true if the WAL file has > + identical contents to the pre-existing archive and the pre-existing archive > + is fully persisted to storage. Alternatively, the archive library may > + return false anytime a pre-existing file is encountered, > + but this will require manual action by an administrator to resolve. If a Inviting the administrator to resolve things is more dangerous than just returning true. I recommend making this text more opinionated and simpler: libraries must return true. Alternately, if some library has found a good reason to return false, this paragraph could give the reason. I don't know of such a reason, though. > + pre-existing file contains different contents than the WAL file being > + archived, the archive library must return false. > +