Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fowtn-0002ou-9E for pgsql-general@arkaria.postgresql.org; Sun, 12 Aug 2018 20:23:39 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fowtk-00053z-Q8 for pgsql-general@arkaria.postgresql.org; Sun, 12 Aug 2018 20:23:36 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fowtk-00053s-ID for pgsql-general@lists.postgresql.org; Sun, 12 Aug 2018 20:23:36 +0000 Received: from out1-smtp.messagingengine.com ([66.111.4.25]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fowtg-0004QD-UK for pgsql-general@lists.postgresql.org; Sun, 12 Aug 2018 20:23:36 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 8EB77213FC; Sun, 12 Aug 2018 16:23:31 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Sun, 12 Aug 2018 16:23:31 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc; s=fm3; bh=Rh61hNlzCHYBgWRdlT4uYADgYIRWo aw85mpZ82nM/ZQ=; b=nYHTDlVrWMtvNmOkpjLsirJrrV5huYy2hcHrefjbchGCu Hjwr2BmocDniKNfbeIgZfvYqthw5nQh0fX1UDOP5UrTrS0/7eut53f4FGhiTSS7u hBE9EGk9xHZj3sRpYbqP7UzGWbX4bcfRYrDmHc3VuK42jJNd56MWOkHj9bKefRRp HhSl7MiB1QxCxBzOgzwBoZMkNJDwBvqNv3/7iOWHVkOVYTLDlxXBxOunIHmnpEM0 IKaxtA9NxGLh7t/V4bEvV2bswU6niDgiMfnrm7KZiktDZGH2SKrr5gwFRp5N3sjZ ZZFyZ4vPZvif0XLfP2suvTNtMP1GEZt3yfFO4DzEQ== 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-sender:x-me-sender:x-sasl-enc; s=fm3; bh=Rh61hN lzCHYBgWRdlT4uYADgYIRWoaw85mpZ82nM/ZQ=; b=jw2oTQB6cbWFfd6Hu7zagr uTzbjFusNa6Q8TXpkvsYzIlQMj2xHnTAJOpLqmRPwSiUbiwR5lvxZ99iOaZDDk2y WcYsigzMdmNuHFDIyfvECkO99lbn1eEHCbdXYNNfRikmUb6cghmldalIloXdD8kT u930p9uRz3FIDDX0K5FCKI4Xo2mhara/pfRl6W/vZrmgG0CMknrsZmPL37SrUJC6 A/PwACtwVgTe1bOpQtsaHcPwkBPgxbhanyIqGwC12dpLBusJS693DLdTXqU13SZR Est6+9uR7zWPJgeMwyIo/6k8HQk0/u5selVPd+ocXywPrNWmIpa8ml2oF9KzJGxw == X-ME-Proxy: X-ME-Sender: Received: from [192.168.1.3] (unknown [71.212.134.3]) by mail.messagingengine.com (Postfix) with ESMTPA id 75DDB10255; Sun, 12 Aug 2018 16:23:30 -0400 (EDT) Subject: Re: Replication failure, slave requesting old segments To: Phil Endecott , pgsql-general@lists.postgresql.org References: <1534000735768@dmwebmail.dmwebmail.chezphil.org> <1534103588284@dmwebmail.dmwebmail.chezphil.org> From: Adrian Klaver Message-ID: <444ada2d-8896-cd74-57dd-531999190182@aklaver.com> Date: Sun, 12 Aug 2018 13:23:29 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <1534103588284@dmwebmail.dmwebmail.chezphil.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 08/12/2018 12:53 PM, Phil Endecott wrote: > Phil Endecott wrote: >> On the master, I have: >> >> wal_level = replica >> archive_mode = on >> archive_command = 'ssh backup test ! -f backup/postgresql/archivedir/%f && >> scp %p backup:backup/postgresql/archivedir/%f' >> >> On the slave I have: >> >> standby_mode = 'on' >> primary_conninfo = 'user=postgres host=master port=5432' >> restore_command = 'scp backup:backup/postgresql/archivedir/%f %p' >> >> hot_standby = on > >> 2018-08-11 00:05:50.364 UTC [615] LOG: restored log file "0000000100000007000000D0" from archive >> scp: backup/postgresql/archivedir/0000000100000007000000D1: No such file or directory >> 2018-08-11 00:05:51.325 UTC [7208] LOG: started streaming WAL from primary at 7/D0000000 on timeline 1 >> 2018-08-11 00:05:51.325 UTC [7208] FATAL: could not receive data from WAL stream: ERROR: requested WAL segment 0000000100000007000000D0 has already been removed > > > I am wondering if I need to set wal_keep_segments to at least 1 or 2 for > this to work. I currently have it unset and I believe the default is 0. Given that WAL's are only 16 MB I would probably bump it up to be on safe side, or use: https://www.postgresql.org/docs/9.6/static/warm-standby.html 26.2.6. Replication Slots Though the above does not limit storage of WAL's, so a long outage could result in WAL's piling up. > > My understanding was that when using archive_command/restore_command to copy > WAL segments it would not be necessary to use wal_keep_segments to retain > files in pg_xlog on the server; the slave can get everything using a > combination of copying files using the restore_command and streaming. > But these lines from the log: > > 2018-08-11 00:12:15.797 UTC [7954] LOG: redo starts at 7/D0F956C0 > 2018-08-11 00:12:16.068 UTC [7954] LOG: consistent recovery state reached at 7/D0FFF088 > > make me think that there is an issue when the slave reaches the end of the > copied WAL file. I speculate that the useful content of this WAL segment > ends at FFF088, which is followed by an empty gap due to record sizes. But > the slave tries to start streaming from this point, D0FFF088, not D1000000. > If the master still had a copy of segment D0 then it would be able to stream > this gap followed by the real content in the current segment D1. > > Does that make any sense at all? > > > Regards, Phil. > > > > -- Adrian Klaver adrian.klaver@aklaver.com