Commit fb47544d authored by Robert Haas's avatar Robert Haas

Minor fixes for WAL consistency checking.

Michael Paquier, reviewed and slightly revised by me.

Discussion: http://postgr.es/m/CAB7nPqRzCQb=vdfHvMtP0HMLBHU6z1aGdo4GJsUP-HP8jx+Pkw@mail.gmail.com
parent e28b1156
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
* in a page which can be different when the WAL is generated * in a page which can be different when the WAL is generated
* and when the WAL is applied. * and when the WAL is applied.
* *
* Portions Copyright (c) 2016, PostgreSQL Global Development Group * Portions Copyright (c) 2016-2017, PostgreSQL Global Development Group
* *
* Contains common routines required for masking a page. * Contains common routines required for masking a page.
* *
......
...@@ -9167,7 +9167,6 @@ heap_mask(char *pagedata, BlockNumber blkno) ...@@ -9167,7 +9167,6 @@ heap_mask(char *pagedata, BlockNumber blkno)
if (ItemIdIsNormal(iid)) if (ItemIdIsNormal(iid))
{ {
HeapTupleHeader page_htup = (HeapTupleHeader) page_item; HeapTupleHeader page_htup = (HeapTupleHeader) page_item;
/* /*
......
...@@ -1360,6 +1360,16 @@ checkXLogConsistency(XLogReaderState *record) ...@@ -1360,6 +1360,16 @@ checkXLogConsistency(XLogReaderState *record)
Assert(XLogRecHasBlockImage(record, block_id)); Assert(XLogRecHasBlockImage(record, block_id));
if (XLogRecBlockImageApply(record, block_id))
{
/*
* WAL record has already applied the page, so bypass the
* consistency check as that would result in comparing the full
* page stored in the record with itself.
*/
continue;
}
/* /*
* Read the contents from the current buffer and store it in a * Read the contents from the current buffer and store it in a
* temporary page. * temporary page.
...@@ -1390,7 +1400,7 @@ checkXLogConsistency(XLogReaderState *record) ...@@ -1390,7 +1400,7 @@ checkXLogConsistency(XLogReaderState *record)
/* /*
* Read the contents from the backup copy, stored in WAL record and * Read the contents from the backup copy, stored in WAL record and
* store it in a temporary page. There is not need to allocate a new * store it in a temporary page. There is no need to allocate a new
* page here, a local buffer is fine to hold its contents and a mask * page here, a local buffer is fine to hold its contents and a mask
* can be directly applied on it. * can be directly applied on it.
*/ */
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* individual rmgr, but we make things easier by providing some * individual rmgr, but we make things easier by providing some
* common routines to handle cases which occur in multiple rmgrs. * common routines to handle cases which occur in multiple rmgrs.
* *
* Portions Copyright (c) 2016, PostgreSQL Global Development Group * Portions Copyright (c) 2016-2017, PostgreSQL Global Development Group
* *
* src/include/access/bufmask.h * src/include/access/bufmask.h
* *
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment