Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Zfwde-00009f-8f for pgsql-bugs@arkaria.postgresql.org; Sat, 26 Sep 2015 21:04:10 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1Zfwdd-0001di-DG for pgsql-bugs@arkaria.postgresql.org; Sat, 26 Sep 2015 21:04:09 +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.84) (envelope-from ) id 1Zfwdc-0001dD-Df for pgsql-bugs@postgresql.org; Sat, 26 Sep 2015 21:04:08 +0000 Received: from mout.gmx.com ([74.208.4.200]) by magus.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.84) (envelope-from ) id 1ZfwdZ-0007Jf-9d for pgsql-bugs@postgresql.org; Sat, 26 Sep 2015 21:04:07 +0000 Received: from anaphora.localdomain ([5.102.218.194]) by mail.gmx.com (mrgmxus001) with ESMTPSA (Nemesis) id 0LfSiF-1aURtA1qav-00p1rw; Sat, 26 Sep 2015 23:04:01 +0200 Subject: Re: BUG #13644: 2xRecovery without new writes, causes archiving failure To: Michael Paquier References: <20150926032247.3022.98224@wrigleys.postgresql.org> Cc: PostgreSQL mailing lists From: Amir Rohan X-Enigmail-Draft-Status: N1110 Message-ID: <5607083E.7040109@mail.com> Date: Sun, 27 Sep 2015 00:03:58 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/mixed; boundary="------------020303090106020304080809" X-Provags-ID: V03:K0:iF1+AX7Eq9vhyTeYzXibvZuFv+6wE+0NgaLBNR6rQ/RWRMfqyqT l8L1qCbxEhHZUiTYeoX5Pb2201wlcoIOCoeCncgpHjQKV37fTmPpr8aUofr41mC25J1G3Iv m4EXamGu/guuaXxuBoZoEd7p3QRuK5mcjWFrEiC7HUnlOKls2OL4zgcfZEDPa4KVrJCy3AS N93u4B7idVamYtwWh96/g== X-UI-Out-Filterresults: notjunk:1;V01:K0:O4FWJZxFgtk=:K4kno0vt1mSv8rFB7WTUpV AL5zeJixYuoLwi1kLLbl/bc8Rk0RkWHI/OZLAKeQ+XI/+qlNGcaMqPz19uB5SlKsZj0RCu0sp GeMNj0sLpZAAqPcOccONvyOpZm0rH2gd5BbjhXlrupcXTCUfv1dIwE4ZTKASJa+39AR4X0Kr8 T69cw5JsG8FBTsl03eujheM4Otn38LLOAs7BiIOtTD3xAIE5SHsWpjrPHpo94xSCvHQKNlSpU rnlT6FxTQ7i4AELygmg3SlKx/iPm9GsVGUh0Fum8jBK2TYu05L9DxTNF9jg5s7w33X1d2iteD 22Eb9j6EIEr+4SqtAxMmzYeV//17G0xYTaFDV+heG6AsXFK/za5qRz9RXoEWbhWPZuDwKDzxY TgFEMLOUVOw4XIKtEFVpvTwsHTFWPf8hg9UttCBbPKIYhP82bPiVgdJZOwl3gDd+R/bvzlJ31 Z/Z3cX4vOMmh4UNF+fwnKtIJCEOIIszdp944tRkdIljKpXOL6K0Rpjxbx+rLfoidC1ZcnbSjU m1gcBHnnkg+M5TAu71xU0Lv845nVVvMzMicThFh6q7gsk9P55Y3RJPpFOl4VuYs5iE7+vPQvb qodWcIUkCQ763vn0E8JqilBk/8wFhZP8NsUrtrdHSqVUGAu9QHvLzubNNRL/Wztg3g6WY3cIm WK5/1YWQVq94l5akWWSpqpzNm2zrUkzFix9/a/plpYEeNYMRnRQO4cXrq+DFbuvHnlSkzkisP R1pm74tAK/YTyr3A X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org This is a multi-part message in MIME format. --------------020303090106020304080809 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit On 09/26/2015 02:39 PM, Michael Paquier wrote: > On Sat, Sep 26, 2015 at 12:22 PM, Amir Rohan wrote: >> DETAIL: The failed archive command was: test ! -f >> /var/lib/pgsql/archive/00000002.history && cp pg_xlog/00000002.history >> /var/lib/pgsql/archive/00000002.history > > That's a symptom that the second node already selected timeline 2, my > first guess is that the restore_command for the second node recovered > failed to get 00000002.history because it may have been set > incorrectly. > I guess you mean the 3rd node here, which is the 2nd recovery. You seem to agree that the 3rd node (2nd recovery) picked timeline 2 instead of starting a 3rd. So, at least I have that right. What does "Set incorrectly" mean in this case? the 2nd node (1st recovery) creates 00000002.history, I checked. >> I expected the last server to create timeline 3, but it looks as if it >> thinks it's timeline2. While in terms of data it's at the same WAL point, >> in terms of events, it should be at timeline 3. That's what I make >> of it anyway. > > I am not able to see any problems with neither 9.5 nor HEAD, when > recovering the second node in your scenario, it fetches correctly > 00000002.history from the archive in my case and the node is able to > select the timeline 3 when recovery is pointing to select the latest > timeline. > I can reproduced this 100% of the time with HEAD from the last few days, and haven't tried with anything else. See attached log+shell-script I used to reproduce. The log shows the contents of the archive directory at various points in the process I described in the initial post. Amir --------------020303090106020304080809 Content-Type: text/x-log; name="pg.log" Content-Transfer-Encoding: 8bit Content-Disposition: attachment; filename="pg.log" Fixing configuration /tmp/pgtest/data/* server starting LOG: redirecting log output to logging collector process HINT: Future log output will appear in directory "pg_log". >>>==========LOG=========== LOG: database system was shut down at 2015-09-26 23:05:26 IDT LOG: MultiXact member wraparound protections are now enabled LOG: autovacuum launcher started LOG: database system is ready to accept connections <<<==========LOG=========== SELECT 1000 Making backup... total 37576 -rw-r--r--. 1 postgres postgres 38475776 Sep 26 23:05 base.tar waiting for server to shut down.... done server stopped Check archive (after #1 stop) ... -rw-------. 1 postgres postgres 16777216 Sep 26 23:05 /tmp/pgtest/archive/000000010000000000000001 -rw-------. 1 postgres postgres 16777216 Sep 26 23:05 /tmp/pgtest/archive/000000010000000000000002 -rw-------. 1 postgres postgres 302 Sep 26 23:05 /tmp/pgtest/archive/000000010000000000000002.00000028.backup Bringing up 2d server... Fixing configuration /tmp/pgtest/data/* server starting LOG: redirecting log output to logging collector process HINT: Future log output will appear in directory "pg_log". cp: cannot stat ‘/tmp/pgtest/backups/000000010000000000000003’: No such file or directory LOG: redo done at 0/20000B8 cp: cannot stat ‘/tmp/pgtest/backups/000000010000000000000002’: No such file or directory cp: cannot stat ‘/tmp/pgtest/backups/00000002.history’: No such file or directory LOG: selected new timeline ID: 2 cp: cannot stat ‘/tmp/pgtest/backups/00000001.history’: No such file or directory LOG: archive recovery complete LOG: MultiXact member wraparound protections are now enabled LOG: autovacuum launcher started LOG: database system is ready to accept connections waiting for server to shut down.... done server stopped Check archive (after #2 stop) ... -rw-------. 1 postgres postgres 16777216 Sep 26 23:05 /tmp/pgtest/archive/000000010000000000000001 -rw-------. 1 postgres postgres 16777216 Sep 26 23:05 /tmp/pgtest/archive/000000010000000000000002 -rw-------. 1 postgres postgres 302 Sep 26 23:05 /tmp/pgtest/archive/000000010000000000000002.00000028.backup -rw-------. 1 postgres postgres 16777216 Sep 26 23:05 /tmp/pgtest/archive/000000020000000000000002 -rw-------. 1 postgres postgres 16777216 Sep 26 23:05 /tmp/pgtest/archive/000000020000000000000003 -rw-------. 1 postgres postgres 41 Sep 26 23:05 /tmp/pgtest/archive/00000002.history Bringing up 3d server... Fixing configuration /tmp/pgtest/data/* server starting LOG: redirecting log output to logging collector process HINT: Future log output will appear in directory "pg_log". >>>==========LOG=========== cp: cannot stat ‘/tmp/pgtest/backups/000000010000000000000002’: No such file or directory cp: cannot stat ‘/tmp/pgtest/backups/00000002.history’: No such file or directory LOG: selected new timeline ID: 2 cp: cannot stat ‘/tmp/pgtest/backups/00000001.history’: No such file or directory LOG: archive recovery complete LOG: MultiXact member wraparound protections are now enabled LOG: autovacuum launcher started LOG: database system is ready to accept connections LOG: archive command failed with exit code 1 DETAIL: The failed archive command was: test ! -f /tmp/pgtest/archive/00000002.history && cp pg_xlog/00000002.history /tmp/pgtest/archive/00000002.history LOG: archive command failed with exit code 1 DETAIL: The failed archive command was: test ! -f /tmp/pgtest/archive/00000002.history && cp pg_xlog/00000002.history /tmp/pgtest/archive/00000002.history LOG: archive command failed with exit code 1 DETAIL: The failed archive command was: test ! -f /tmp/pgtest/archive/00000002.history && cp pg_xlog/00000002.history /tmp/pgtest/archive/00000002.history WARNING: archiving transaction log file "00000002.history" failed too many times, will try again later <<<==========LOG=========== Check archive (after #3 start) ... -rw-------. 1 postgres postgres 16777216 Sep 26 23:05 /tmp/pgtest/archive/000000010000000000000001 -rw-------. 1 postgres postgres 16777216 Sep 26 23:05 /tmp/pgtest/archive/000000010000000000000002 -rw-------. 1 postgres postgres 302 Sep 26 23:05 /tmp/pgtest/archive/000000010000000000000002.00000028.backup -rw-------. 1 postgres postgres 16777216 Sep 26 23:05 /tmp/pgtest/archive/000000020000000000000002 -rw-------. 1 postgres postgres 16777216 Sep 26 23:05 /tmp/pgtest/archive/000000020000000000000003 -rw-------. 1 postgres postgres 41 Sep 26 23:05 /tmp/pgtest/archive/00000002.history waiting for server to shut down....... done server stopped --------------020303090106020304080809 Content-Type: application/x-shellscript; name="2xrecovery.sh" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="2xrecovery.sh" IyEvYmluL3NoCgpzZXQgLWUgCgpleHBvcnQgQ09ORl9ESVI9L3RtcC9jb25m ICAKCmV4cG9ydCBCQVNFRElSPS90bXAvcGd0ZXN0CmV4cG9ydCBQR0RBVEE9 JHtCQVNFRElSfS9kYXRhCmV4cG9ydCAgICAgTE9HX0RJUj0ke1BHREFUQX0v cGdfbG9nCmV4cG9ydCBBUkNISVZFX0RJUj0ke0JBU0VESVJ9L2FyY2hpdmUg CmV4cG9ydCBCQUNLVVBfRElSPSR7QkFTRURJUn0vYmFja3VwcyAKCmZ1bmN0 aW9uIGZpeF9jb25maWcgewoJZWNobyAiRml4aW5nIGNvbmZpZ3VyY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IGFyY2hpdmUgKGFmdGVyICMxIHN0b3ApIC4u LiIKbHMgLWwgJHtBUkNISVZFX0RJUn0vKgoKIyBjcmVhdGUgbmV3IHNlcnZl cgplY2hvICJCcmluZ2luZyB1cCAyZCBzZXJ2ZXIuLi4iCnJtIC1SZiAke1BH REFUQX0vKiAKY2QgJHtQR0RBVEF9ICYmIHRhciB4dmYgJHtCQUNLVVBfRElS fS9iYXNlLnRhciAyPiYxID4gL2Rldi9udWxsCmNwICR7Q09ORl9ESVJ9Lyou Y29uZiAke1BHREFUQX07CmZpeF9jb25maWcKCnBnX2N0bCBzdGFydCAgCnNs ZWVwIDMKdGFpbCAgJHtMT0dfRElSfS8qLmxvZwpwZ19jdGwgc3RvcCAtbSBz bWFydAoKZWNobyAiQ2hlY2sgYXJjaGl2ZSAoYWZ0ZXIgIzIgc3RvcCkgLi4u IgpscyAtbCAke0FSQ0hJVkVfRElSfS8qCgplY2hvICJCcmluZ2luZyB1cCAz ZCBzZXJ2ZXIuLi4iCnJtIC1SZiAke1BHREFUQX0vKiAKY2QgJHtQR0RBVEF9 ICYmIHRhciB4dmYgJHtCQUNLVVBfRElSfS9iYXNlLnRhciAyPiYxID4gL2Rl di9udWxsCmNwICR7Q09ORl9ESVJ9LyouY29uZiAke1BHREFUQX07CmZpeF9j b25maWcKCnBnX2N0bCBzdGFydCAKc2xlZXAgMwp0YWlsX29mX2xvZwplY2hv ICJDaGVjayBhcmNoaXZlIChhZnRlciAjMyBzdGFydCkgLi4uIgpscyAtbCAk e0FSQ0hJVkVfRElSfS8qCnBnX2N0bCBzdG9wIC1tIHNtYXJ0CgogCmNkICNQ R0RBVEEK --------------020303090106020304080809 Content-Type: text/plain Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs --------------020303090106020304080809--