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 1fowVf-0001Z6-Qk for pgsql-general@arkaria.postgresql.org; Sun, 12 Aug 2018 19:58:44 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fowVc-0006tf-Sg for pgsql-general@arkaria.postgresql.org; Sun, 12 Aug 2018 19:58:40 +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 1fowVb-0006tY-0w for pgsql-general@lists.postgresql.org; Sun, 12 Aug 2018 19:58:40 +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 1fowVS-0003rJ-GV for pgsql-general@lists.postgresql.org; Sun, 12 Aug 2018 19:58:38 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 7A31121B6A; Sun, 12 Aug 2018 15:58:27 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Sun, 12 Aug 2018 15:58:27 -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=Lul4BMog7+sfR5Mh5X0UYrCrHPFrY yT716HCfLNR1Lg=; b=oDbZ4rjFc/hoUYsbgh0ZHkeG8dOXT5CieeaVU8o6eivga /4+0+aGHse1Ayjy1+JCoMvKX6Bl3YtkBKRy8M9cvHiAA1N6oM49i4hjvLuVctcFs dM4SfYvg9CCWr5H/LXZnS/qfWl+F/p/9oODeV64j6ZeXa1JBGeqR/5Z1x9V4J1By DBTGcIMA5zTJf56z8OvbjSrI2cNCp8CuqPZZJTku2nHY6ZRDXazwtu4gsK/lotmb FsSoVRcQ8GhewK4RjowQr5+pH97XKGpVG0JeVaq4ffSqFXBSuoN9FQS6XMr93b3H LlF+FV23TUFzvBH0yE7UEawVldgPvkNXH9Djimc9g== 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=Lul4BM og7+sfR5Mh5X0UYrCrHPFrYyT716HCfLNR1Lg=; b=jA2b2RDWXnWkPvgtPgBcBL onqzMi/aIJb3ZEBcZ629LrBbvyHzY53maZ3Fu1N9dZhWis43RQ+VIIH3izHoGfat tgURgyxIIqov4RcEllL+WUdN4CLMwACWZJWv0sCyTxrfgaY1MZ8BXBug2u3MlQGL oRGrne0cq24CVNkARexmY8ioLnAi1JX916kcbDuNRGIRUCd9ufndHz1wbvhjZhRW Or/YwE8pGUmuUfjghTm8zfgBTxI1XkIbFHUtVczRy/81Um7wMeXrplBqfGdEIXyq W8X33IhQ85/cMQVWKF0s9rsW7yVPzUXRZ74DtfrUrPfrzMQ6w3+uweec6pkf+tAg == 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 CCF1B10273; Sun, 12 Aug 2018 15:58:26 -0400 (EDT) Subject: Re: Replication failure, slave requesting old segments To: Phil Endecott , pgsql-general@lists.postgresql.org References: <1534101938762@dmwebmail.dmwebmail.chezphil.org> From: Adrian Klaver Message-ID: Date: Sun, 12 Aug 2018 12:58:26 -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: <1534101938762@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/12/2018 12:25 PM, Phil Endecott wrote: > Hi Adrian, > > Adrian Klaver wrote: >> 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. > > The files on the backup server were all 16 MB. WAL files are created/recycled as 16 MB files, which is not the same as saying they are complete for the purposes of restoring. In other words you could be looking at a 16 MB file full of 0's. > > >> 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. > > When I kicked it, the master wrote D1 to D4 to the backup.  It did not > change D0 (its modification time on the backup is from before the "kick"). > The slave re-read D0, again, as it had been doing throughout this period, > and then read D1 to D4. Well something happened because the slave could not get all the information it needed from the D0 in the archive and was trying to get it from the masters pg_xlog. > > >> Best guess is the archiving did not work as expected during: >> >> "(During this time the master was also down for a shorter period.)" > > Around the time the master was down, the WAL segment names were CB and CC. > Files CD to CF were written between the master coming up and the slave > coming up.  The slave had no trouble restoring those segments when it > started. > The problematic segments D0 and D1 were the ones that were "current" > when the > slave restarted, at which time the master was up consistently. > > > Regards, Phil. > > > > > -- Adrian Klaver adrian.klaver@aklaver.com