Skip to content

Commit 3fe942f

Browse files
committed
Fix bug: Sometimes we may miss WAL segments and threads
1 parent ff73983 commit 3fe942f

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

src/parsexlog.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,8 @@ extractPageMap(const char *archivedir, XLogRecPtr startpoint, TimeLineID tli,
305305
/* By default there is some error */
306306
thread_args[i].ret = 1;
307307

308+
threads_need++;
309+
308310
/* Adjust startpoint to the next thread */
309311
if (nextSegNoToRead == 0)
310312
XLByteToSeg(startpoint, nextSegNoToRead);
@@ -317,10 +319,6 @@ extractPageMap(const char *archivedir, XLogRecPtr startpoint, TimeLineID tli,
317319
if (nextSegNoToRead > endSegNo)
318320
break;
319321
XLogSegNoOffsetToRecPtr(nextSegNoToRead, 0, startpoint);
320-
/* Skip over the page header */
321-
startpoint += SizeOfXLogLongPHD;
322-
323-
threads_need++;
324322
}
325323

326324
/* Run threads */

tests/page.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -255,11 +255,6 @@ def test_page_archive(self):
255255
'\n Unexpected Error Message: {0}\n CMD: {1}'.format(
256256
repr(self.output), self.cmd))
257257

258-
# GET RESTORED PGDATA AND COMPARE
259-
if self.paranoia:
260-
pgdata_restored = self.pgdata_content(node.data_dir)
261-
self.compare_pgdata(pgdata, pgdata_restored)
262-
263258
node.slow_start()
264259

265260
full_result_new = node.execute("postgres", "SELECT * FROM t_heap")
@@ -278,6 +273,12 @@ def test_page_archive(self):
278273
"--recovery-target-action=promote"]),
279274
'\n Unexpected Error Message: {0}\n CMD: {1}'.format(
280275
repr(self.output), self.cmd))
276+
277+
# GET RESTORED PGDATA AND COMPARE
278+
if self.paranoia:
279+
pgdata_restored = self.pgdata_content(node.data_dir)
280+
self.compare_pgdata(pgdata, pgdata_restored)
281+
281282
node.slow_start()
282283

283284
page_result_new = node.execute("postgres", "SELECT * FROM t_heap")

0 commit comments

Comments
 (0)