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 1fobkA-0001Sn-6k for pgsql-general@arkaria.postgresql.org; Sat, 11 Aug 2018 21:48:18 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fobk7-0006Ag-Mc for pgsql-general@arkaria.postgresql.org; Sat, 11 Aug 2018 21:48:15 +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 1fobk5-0006AX-T1 for pgsql-general@lists.postgresql.org; Sat, 11 Aug 2018 21:48:15 +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 1fobjx-0000rC-B6 for pgsql-general@lists.postgresql.org; Sat, 11 Aug 2018 21:48:13 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 59B70215F2; Sat, 11 Aug 2018 17:48:03 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Sat, 11 Aug 2018 17:48:03 -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=qFpVDBND76i6o2Z1J0uTnlJPXM8bn t3FEFT1enulg3s=; b=UBas9uBabpM7000T/zT/RZPoVio/x30s+DGkLE/7nfucz cKtk+EGFtkUt4IEv+gDocgPPjUlxWu5Cl+QA8yBG8zJx7VDZZHDkIRODw1CPtvDY SD9dXaAY/JuYzJ4aKyug3H09gO/X1/4sC4SZZcad658UMmEBJcdxSNQMsVWIUBkC wthQneg6oGlbAwwG+vYbMLujSrZOAADX2UJwY9wy2yHKtld8BgCZW+78hxVkjd1d cJmd/1jbH1ee+BBZLtTc8mTaMtDJIlSEG2NFe7ObDRNNOUCMtMmF8JFrTIN9yp3X EAlnaF9sio/HWsEvp/SVkN1CRO1K+nVwa7JrJi7Pw== 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=qFpVDB ND76i6o2Z1J0uTnlJPXM8bnt3FEFT1enulg3s=; b=RKn9hRoHSkOg/TgonoNyAX 8021qx/Yh67sWYpeN02AN3/7Azj/6sVAA1Ar8M55uYOS87y/9X9PdKindWnuqFAm rJiEUXIqVpgxa7mjCPUNyGWV0EZ8HW1mIQXtaxNjztRoH+tR/Q6f6xhQdzQTLBUr HRK4kJCm/iJp75uooAgPVbxxYmusngnbyjUOj2oPT/AIFRbSNLIjZ6YAymt6Mz7d 9AIh6Cuhg6/LZtqPfpw0x2DEgW5Wqx4rmR+6Qp+F1m99uDdGTsNlQ3OaLVGBFRBb YG5rs9CjDEHWqUpN52Go2rp3uimF0DoXj7ixV5n1Mt7jZPbTkW1YY8PFQShF04Gw == 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 19694E4563; Sat, 11 Aug 2018 17:48:02 -0400 (EDT) Subject: Re: Replication failure, slave requesting old segments To: Phil Endecott , pgsql-general@lists.postgresql.org References: <1534016525090@dmwebmail.dmwebmail.chezphil.org> From: Adrian Klaver Message-ID: Date: Sat, 11 Aug 2018 14:48:01 -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: <1534016525090@dmwebmail.dmwebmail.chezphil.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 08/11/2018 12:42 PM, Phil Endecott wrote: > Hi Adrian, > > Adrian Klaver wrote: >> Looks like the master recycled the WAL's while the slave could not >> connect. > > Yes but... why is that a problem?  The master is copying the WALs to > the backup server using scp, where they remain forever.  The slave gets To me it looks like that did not happen: 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 Above 0000000100000007000000D0 is gone/recycled on the master and the archived version does not seem to be complete as the streaming replication is trying to find it. Below you kick the master and it coughs up the files to the archive including *D0 and *D1 on up to *D4 and then the streaming picks using *D5. 2018-08-11 00:55:49.741 UTC [7954] LOG: restored log file "0000000100000007000000D0" from archive 2018-08-11 00:56:12.304 UTC [7954] LOG: restored log file "0000000100000007000000D1" from archive 2018-08-11 00:56:35.481 UTC [7954] LOG: restored log file "0000000100000007000000D2" from archive 2018-08-11 00:56:57.443 UTC [7954] LOG: restored log file "0000000100000007000000D3" from archive 2018-08-11 00:57:21.723 UTC [7954] LOG: restored log file "0000000100000007000000D4" from archive scp: backup/postgresql/archivedir/0000000100000007000000D5: No such file or directory 2018-08-11 00:57:22.915 UTC [7954] LOG: unexpected pageaddr 7/C7000000 in log segment 00000001000000070000 00D5, offset 0 2018-08-11 00:57:23.114 UTC [12348] LOG: started streaming WAL from primary at 7/D5000000 on timeline 1 Best guess is the archiving did not work as expected during: "(During this time the master was also down for a shorter period.)" > them from there before it starts streaming.  So it shouldn't matter > if the master recycles them, as the slave should be able to get everything > using the combination of scp and then streaming. > > Am I missing something about how this sort of replication is supposed to > work? > > > Thanks, Phil. > > > > > -- Adrian Klaver adrian.klaver@aklaver.com