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 1jiVlw-0003yP-Pv for pgsql-general@arkaria.postgresql.org; Tue, 09 Jun 2020 04:22:01 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jiVlv-0006M9-Cr for pgsql-general@arkaria.postgresql.org; Tue, 09 Jun 2020 04:21:59 +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 1jiVlt-0006M1-Js for pgsql-general@lists.postgresql.org; Tue, 09 Jun 2020 04:21:59 +0000 Received: from out1-smtp.messagingengine.com ([66.111.4.25]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jiVlm-0001DB-Gv for pgsql-general@lists.postgresql.org; Tue, 09 Jun 2020 04:21:56 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 7680F5C0106; Tue, 9 Jun 2020 00:21:49 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Tue, 09 Jun 2020 00:21:49 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= from:subject:to:references:message-id:date:mime-version :in-reply-to:content-type:content-transfer-encoding; s=fm3; bh=b PfOdpor1+OcGwsNYKPORi7GcJmfvaj3H7ZORkNql/k=; b=a60bGr4BKJ8BpCEVS MXlIMB3wWK60kAT4LfpZQYvTPxp0y2/o/4e3gT7pkM/0ZOVUB6hyz1Qzvyb0xbIM n4DW19jAmSyYYMUsOo2tiq9QIhnIGWTAfISwpaRMdBzSdRm6VFpapDrpOZ/NkegV R0rin73ne4VMpcjYhpbvm1xgKHdQZ9yGQHAjF6biMYPgEA6Sj9IXaEYl2Mdrnjac YRAVS1xwlHaXcKl8VWhsGnegdq3pqXnG6kpRMxBZaOi+K+qyUV2xwQnzSOo3uljp a/29pN5nGHnvMM0LDMx7cCgmFSF2rs8zfacKwUkVKoYkximc0j/6G/V1/erm3CnW D7UPg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; bh=bPfOdpor1+OcGwsNYKPORi7GcJmfvaj3H7ZORkNql /k=; b=KirULE105TxWPfCYs/OzT1Zw8ieJJFGPj4SOq7aZJnDT57LKVllLHI3SO mg5jw55Cmu1mNqD/OFYcfeKWWfciCNhBO8/0guub1x/+wZKyrxilGqA0teKyjzl5 6o78LKQ3MZEzwFe3hTSMfErsYUpEisAZ7x2O0KgFT5D5gcION3OVuoeq29dvcaql oQKyIVkeILy4dfDPREQzOtNMN6vvrShNXNwk/Zy5Nup4jI3YVvvpktSYACIJQC3B LgF58Jt7LPgiAaY5ZdfVAFyS1Gn4j2LqsNqG3OAYK9GCEGE7MgOC5riFtEBU1mec M7U7BMXKKeE3wl6k33u+ONqz4/XTw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduhedrudehfedgkeegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucgoufhushhpvggtthffohhmrghinhculdegledmne cujfgurhephffuvfhfkffffgggjggtgfesthejredttdefjeenucfhrhhomheptegurhhi rghnucfmlhgrvhgvrhcuoegrughrihgrnhdrkhhlrghvvghrsegrkhhlrghvvghrrdgtoh hmqeenucggtffrrghtthgvrhhnpeejgedvtdegfefhteeggeeghfetjedugfekteeitedt fedvlefhtdfhfedvtddtfeenucffohhmrghinhepphhgsggrtghkrhgvshhtrdhorhhgpd hpohhsthhgrhgvshhprhhordgtohhmpdhpghgsrghrmhgrnhdrohhrghdpghhithhhuhgs rdhiohenucfkphepjeehrddujedvrdehrddvfedunecuvehluhhsthgvrhfuihiivgeptd enucfrrghrrghmpehmrghilhhfrhhomheprggurhhirghnrdhklhgrvhgvrhesrghklhgr vhgvrhdrtghomh X-ME-Proxy: Received: from [192.168.1.3] (75-172-5-231.tukw.qwest.net [75.172.5.231]) by mail.messagingengine.com (Postfix) with ESMTPA id 27B6B30618B7; Tue, 9 Jun 2020 00:21:48 -0400 (EDT) From: Adrian Klaver Subject: Re: Something else about Redo Logs disappearing To: Peter , pgsql-general@lists.postgresql.org References: <20200609000253.GA21670@gate.oper.dinoex.org> <20200609023326.GA61487@gate.oper.dinoex.org> Message-ID: Date: Mon, 8 Jun 2020 21:21:47 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.9.0 MIME-Version: 1.0 In-Reply-To: <20200609023326.GA61487@gate.oper.dinoex.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 6/8/20 7:33 PM, Peter wrote: > > Actually, the affair had some good side: as usual I was checking > my own designs first and looking for flaws, and indeed I found one: > > If you do copy out the archive logs not directly to tape, but to > some disk area for further processing, then there is an issue with > possible loss. If you do it like the docs say, with a command like > this: > > archive_command = 'test ! -f /mnt/server/archivedir/%f && cp %p > +/mnt/server/archivedir/%f' # Unix > > 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.) " Generally for peace of mind folks use third party tools like: pg_backrest(https://pgbackrest.org/), pg_probackup(https://postgrespro.com/products/extensions/pg_probackup) or Barman(https://www.pgbarman.org/). as they offer safety checks for your backups. I use pg_backrest, but it does not look promising for running on BSD: https://fluca1978.github.io/2019/03/04/pgbackrest_FreeBSD.html Not sure about pg_probackup. Barman is Python package: http://docs.pgbarman.org/release/2.10/#installation-from-sources > > But the target of the copy may not yet been written to disk. If > at that point a power loss happens, the log may become missing/damaged/ > incomplete, while the database may or may not consider it done > when restarting. > > Therefore, mounting such a target filesystem in all-synchronous mode > might be a good idea. (UFS: "-o sync", ZFS: "set sync=always") > > cheerio, > PMc > > -- Adrian Klaver adrian.klaver@aklaver.com