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 1o9Zeg-0004DH-1j for pgsql-hackers@arkaria.postgresql.org; Thu, 07 Jul 2022 22:07:26 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1o9Zee-0004va-9M for pgsql-hackers@arkaria.postgresql.org; Thu, 07 Jul 2022 22:07:24 +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 1o9Zed-0004uU-V2 for pgsql-hackers@lists.postgresql.org; Thu, 07 Jul 2022 22:07:24 +0000 Received: from mail-pj1-x1031.google.com ([2607:f8b0:4864:20::1031]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1o9Zeb-0003At-6w for pgsql-hackers@postgresql.org; Thu, 07 Jul 2022 22:07:23 +0000 Received: by mail-pj1-x1031.google.com with SMTP id cp18-20020a17090afb9200b001ef79e8484aso227318pjb.1 for ; Thu, 07 Jul 2022 15:07:20 -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=HOsKG6JImSAUxYi44jUwW+e+RFu7mBK6uT5oaD4Gb9Y=; b=qSdic2yxgPih6cGNxjdeR5Kwswb/sVi29tHFX8xuv2tmjg+ILp/qzUDNqtf3MZZdTR TArGgzW5sV9Zpt/ht9+WEnIpnj6pZlIzReNaXi8ESPmVESLSzoJsPE/Lo4LTg1YbUZNY sjacFPe/IwbXygf3f1EPd6U3SC2NL88udN0cKRY5l1XmukPYSDuMMSmfk2JgAeH19gxf qKqdtnRiKpgKBTzDDmk32AzgaYOoJDr0LWQwp3f9zlt8rKMRnlKzSAKAP9dtc3MeIu0a A7MEHZBY8GrxeYebImygt91zbp8jK3PSWL8bvehyRVE//kI/8owgxgrHcMYb0LPn6NW3 LvAA== 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=HOsKG6JImSAUxYi44jUwW+e+RFu7mBK6uT5oaD4Gb9Y=; b=4krcrGozbN7e/s5MDkndXEvZLPGiVMDwChmPJyKzK3oiGnvrEVAJJrYjHOs3JQ704G gVj2+2umOGdvjlBhjkY5wk80KlOHzV0XqjM/RlzuGtnZtPrVUn6BqtoYm7PM3lxBwhO4 k8tCe+O2Uial5Z2qGabhDNG8UdcfVS+4AmxS1Qxs65ZEww6Ufiq746GtARpnVsW/lNOW ZYtQGwx2SiQhPU8IshrXbzQuY3eir8ACw4wlPkv4axzrqTVtKschr2YcoXJd+0T0ssjf E6YJ73HI61onRpbOr+egvrMeFhiWjV4xu4V7imkl6aEbg8cQE7BQCsvfjvRmQT3IjZAA 6ebA== X-Gm-Message-State: AJIora84bIsQdbigNiqtkMlj2l7r7q/yDcNdFfdd0d4pvd5omeP/KtTI MQWDxEYVmbS8Uv4rl2zd5Ps= X-Google-Smtp-Source: AGRyM1sC9+NxipRJHr+Nkjo40D1SPy250vcb5JjYuBgpGbdXyUhjmOYzQGnJI1CfiRX3ICjjkcjTSw== X-Received: by 2002:a17:90b:1206:b0:1ef:7bcd:e8d1 with SMTP id gl6-20020a17090b120600b001ef7bcde8d1mr46869pjb.156.1657231638804; Thu, 07 Jul 2022 15:07:18 -0700 (PDT) Received: from nathanxps13 ([50.54.155.70]) by smtp.gmail.com with ESMTPSA id z3-20020a170902ccc300b0016be368fb30sm9510906ple.212.2022.07.07.15.07.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Jul 2022 15:07:18 -0700 (PDT) Date: Thu, 7 Jul 2022 15:07:16 -0700 From: Nathan Bossart To: David Steele Cc: Robert Haas , Fujii Masao , Kyotaro Horiguchi , "pgsql-hackers@postgresql.org" Subject: Re: remove more archiving overhead Message-ID: <20220707220716.GA2258527@nathanxps13> References: <20220224.141349.1809640551882183816.horikyota.ntt@gmail.com> <20220224175553.GA660690@nathanxps13> <20220407222327.GA1363808@nathanxps13> <768e6cb3-256d-9c0b-1797-62420ffca7ae@oss.nttdata.com> <17147b74-5465-9a7a-ae27-305d1200482c@pgmasters.net> <20220707161825.GA2205004@nathanxps13> <20220707175142.GA2254092@nathanxps13> <20220707182251.GA2255242@nathanxps13> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="3V7upXqbjpZ4EhLz" Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --3V7upXqbjpZ4EhLz Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Thu, Jul 07, 2022 at 05:06:13PM -0400, David Steele wrote: > On 7/7/22 14:22, Nathan Bossart wrote: >> On Thu, Jul 07, 2022 at 10:51:42AM -0700, Nathan Bossart wrote: >> > + library to ensure that it indeed does not overwrite an existing file. When >> > + a pre-existing file is encountered, the archive library may return >> > + true if the WAL file has identical contents to the >> > + pre-existing archive. Alternatively, the archive library can return >> >> This should likely say something about ensuring the pre-existing file is >> persisted to disk before returning true. > > Agreed. > > Also, I'd prefer to remove "indeed" from this sentence (yes, I see that was > in the original text): > > + library to ensure that it indeed does not overwrite an existing Here's an updated patch. -- Nathan Bossart Amazon Web Services: https://aws.amazon.com --3V7upXqbjpZ4EhLz Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v2-0001-add-note-about-re-archiving-in-docs.patch" From 044962852ff86ffd768e124bff9883b6f7591b62 Mon Sep 17 00:00:00 2001 From: Nathan Bossart Date: Thu, 7 Jul 2022 10:43:30 -0700 Subject: [PATCH v2 1/1] add note about re-archiving in docs --- doc/src/sgml/backup.sgml | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/doc/src/sgml/backup.sgml b/doc/src/sgml/backup.sgml index 73a774d3d7..4462bfe7a9 100644 --- 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 can + return false anytime a pre-existing file is encountered, + but this will require manual action by an administrator to resolve. If a + pre-existing file contains different contents than the WAL file being + archived, the archive library must return false. + + + + The example command above for Unix avoids overwriting a pre-existing archive + by including a separate test step. On some Unix platforms, cp has switches such as that can be used to do the same thing less verbosely, but you should not rely on these without verifying that -- 2.25.1 --3V7upXqbjpZ4EhLz--