From 3fe942f97bd9000242719c42370fc84cf7137314 Mon Sep 17 00:00:00 2001 From: Arthur Zakirov Date: Thu, 9 Aug 2018 19:02:38 +0300 Subject: [PATCH] Fix bug: Sometimes we may miss WAL segments and threads --- src/parsexlog.c | 6 ++---- tests/page.py | 11 ++++++----- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/parsexlog.c b/src/parsexlog.c index 254eb663..2e7fac7a 100644 --- a/src/parsexlog.c +++ b/src/parsexlog.c @@ -305,6 +305,8 @@ extractPageMap(const char *archivedir, XLogRecPtr startpoint, TimeLineID tli, /* By default there is some error */ thread_args[i].ret = 1; + threads_need++; + /* Adjust startpoint to the next thread */ if (nextSegNoToRead == 0) XLByteToSeg(startpoint, nextSegNoToRead); @@ -317,10 +319,6 @@ extractPageMap(const char *archivedir, XLogRecPtr startpoint, TimeLineID tli, if (nextSegNoToRead > endSegNo) break; XLogSegNoOffsetToRecPtr(nextSegNoToRead, 0, startpoint); - /* Skip over the page header */ - startpoint += SizeOfXLogLongPHD; - - threads_need++; } /* Run threads */ diff --git a/tests/page.py b/tests/page.py index 14819baa..c0756c08 100644 --- a/tests/page.py +++ b/tests/page.py @@ -255,11 +255,6 @@ class PageBackupTest(ProbackupTest, unittest.TestCase): '\n Unexpected Error Message: {0}\n CMD: {1}'.format( repr(self.output), self.cmd)) - # GET RESTORED PGDATA AND COMPARE - if self.paranoia: - pgdata_restored = self.pgdata_content(node.data_dir) - self.compare_pgdata(pgdata, pgdata_restored) - node.slow_start() full_result_new = node.execute("postgres", "SELECT * FROM t_heap") @@ -278,6 +273,12 @@ class PageBackupTest(ProbackupTest, unittest.TestCase): "--recovery-target-action=promote"]), '\n Unexpected Error Message: {0}\n CMD: {1}'.format( repr(self.output), self.cmd)) + + # GET RESTORED PGDATA AND COMPARE + if self.paranoia: + pgdata_restored = self.pgdata_content(node.data_dir) + self.compare_pgdata(pgdata, pgdata_restored) + node.slow_start() page_result_new = node.execute("postgres", "SELECT * FROM t_heap")