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 1lFCZ8-0006hW-6n for pgsql-docs@arkaria.postgresql.org; Thu, 25 Feb 2021 09:04:10 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lFCZ5-00029a-CS for pgsql-docs@arkaria.postgresql.org; Thu, 25 Feb 2021 09:04:07 +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 1lFCZ5-00029T-6r for pgsql-docs@lists.postgresql.org; Thu, 25 Feb 2021 09:04:07 +0000 Received: from oss.nttdata.com ([49.212.34.109]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lFCZ1-00015Q-Hd for pgsql-docs@lists.postgresql.org; Thu, 25 Feb 2021 09:04:06 +0000 Received: from hnk.local (p2034055-ipbf1505funabasi.chiba.ocn.ne.jp [220.107.215.55]) by oss.nttdata.com (Postfix) with ESMTPSA id 9CE31627A3; Thu, 25 Feb 2021 18:03:57 +0900 (JST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.102.3 at oss.nttdata.com Subject: Re: incoorect restore_command To: Michael Paquier Cc: Philipp Gramzow , pgsql-docs@lists.postgresql.org References: <161397938841.15451.13129264141285167267@wrigleys.postgresql.org> <478b5b00-5ab3-a1b5-65f4-19b4409c720b@philphonic.de> <3c8a08bb-3eaa-cdc6-08f9-3298342722c2@oss.nttdata.com> From: Fujii Masao Message-ID: <06d9fc43-7ea9-20cc-191e-401136bc86fa@oss.nttdata.com> Date: Thu, 25 Feb 2021 18:03:57 +0900 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:78.0) Gecko/20100101 Thunderbird/78.7.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252; 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 2021/02/25 15:54, Michael Paquier wrote: > On Wed, Feb 24, 2021 at 08:15:59PM +0900, Fujii Masao wrote: >> But I have one question; why do those commands use different >> archive directories? Isn't it better to use the same one? > > storage.sgml uses /var/lib/pgsql/data for the location of the data, > and the archive path is a mix between /mnt/server/archivedir/ and > /var/lib/pgsql/archive/. However, the former is used for > pg_archivecleanup and in postgresql.conf.sample, so why not just using > /mnt/server/archivedir/ in backup.sgml? Please see the attached. -archive_command = 'test ! -f /var/lib/pgsql/backup_in_progress || (test ! -f /var/lib/pgsql/archive/%f && cp %p /var/lib/pgsql/archive/%f)' +archive_command = 'test ! -f /var/lib/pgsql/backup_in_progress || (test ! -f /mnt/server/archivedir/%f && cp %p /mnt/server/archivedir/%f)' Regarding the section "Standalone Hot Backups", all the directories and file seem to be placed under /var/lib/pgsql, so at least for me it looks a bit strange to change only the path of archive directory. So I don't think that we need to do this change. -tar -rf /var/lib/pgsql/backup.tar /var/lib/pgsql/archive/ +tar -rf /var/lib/pgsql/backup.tar /mnt/server/archivedir/ Same as above. -archive_command = 'gzip < %p > /var/lib/pgsql/archive/%f' +archive_command = 'gzip < %p > /mnt/server/archivedir/%f.gz' You will then need to use gunzip during recovery: -restore_command = 'gunzip < /mnt/server/archivedir/%f > %p' +restore_command = 'gunzip < /mnt/server/archivedir/%f.gz > %p' LGTM. Thanks for the patch! Regards, -- Fujii Masao Advanced Computing Technology Center Research and Development Headquarters NTT DATA CORPORATION