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 1jiWnm-0005yc-FV for pgsql-general@arkaria.postgresql.org; Tue, 09 Jun 2020 05:27:58 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jiWnl-0005Yr-Ag for pgsql-general@arkaria.postgresql.org; Tue, 09 Jun 2020 05:27:57 +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 1jiWnl-0005Yk-2n for pgsql-general@lists.postgresql.org; Tue, 09 Jun 2020 05:27:57 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jiWne-0007Mh-Mq for pgsql-general@lists.postgresql.org; Tue, 09 Jun 2020 05:27:56 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 0595RKxX2191827; Tue, 9 Jun 2020 01:27:20 -0400 From: Tom Lane To: Adrian Klaver cc: Peter , pgsql-general@lists.postgresql.org Subject: Re: Something else about Redo Logs disappearing In-reply-to: References: <20200609000253.GA21670@gate.oper.dinoex.org> <20200609023326.GA61487@gate.oper.dinoex.org> Comments: In-reply-to Adrian Klaver message dated "Mon, 08 Jun 2020 21:21:47 -0700" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2191825.1591680439.1@sss.pgh.pa.us> Date: Tue, 09 Jun 2020 01:27:20 -0400 Message-ID: <2191826.1591680440@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Adrian Klaver writes: > On 6/8/20 7:33 PM, Peter wrote: >> That "cp" is usually not synchronous. So there is the possibility >> that this command terminates successfully, and reports exitcode zero >> back to the Postgres, and then the Postgres will consider that log >> being safely away. > Which is why just following the above command in the docs is: > "(This is an example, not a recommendation, and might not work on all > platforms.) " Yeah. There have been discussions about changing that disclaimer to be more forceful, because in point of fact a plain "cp" is generally not safe enough. You need to fsync the written file, and on many filesystems you also have to fsync the directory it's in. > Generally for peace of mind folks use third party tools like: +1. Rolling your own archive script is seldom advisable. regards, tom lane