1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-12 05:01:15 +03:00

hash: Support WAL consistency checking.

Kuntal Ghosh, reviewed by Amit Kapila and Ashutosh Sharma, with
a few tweaks by me.

Discussion: http://postgr.es/m/CAGz5QCJLERUn_zoO0eDv6_Y_d0o4tNTMPeR7ivTLBg4rUrJdwg@mail.gmail.com
This commit is contained in:
Robert Haas
2017-03-14 14:58:56 -04:00
parent 2609e91fcf
commit bb4a39637a
4 changed files with 41 additions and 4 deletions

View File

@@ -14,6 +14,7 @@
*/
#include "postgres.h"
#include "access/bufmask.h"
#include "access/hash.h"
#include "access/hash_xlog.h"
#include "access/xlogutils.h"
@@ -961,3 +962,38 @@ hash_redo(XLogReaderState *record)
elog(PANIC, "hash_redo: unknown op code %u", info);
}
}
/*
* Mask a hash page before performing consistency checks on it.
*/
void
hash_mask(char *pagedata, BlockNumber blkno)
{
Page page = (Page) pagedata;
HashPageOpaque opaque;
mask_page_lsn(page);
mask_page_hint_bits(page);
mask_unused_space(page);
opaque = (HashPageOpaque) PageGetSpecialPointer(page);
if (opaque->hasho_flag & LH_UNUSED_PAGE)
{
/*
* Mask everything on a UNUSED page.
*/
mask_page_content(page);
}
else if ((opaque->hasho_flag & LH_BUCKET_PAGE) ||
(opaque->hasho_flag & LH_OVERFLOW_PAGE))
{
/*
* In hash bucket and overflow pages, it is possible to modify the
* LP_FLAGS without emitting any WAL record. Hence, mask the line
* pointer flags. See hashgettuple() for details.
*/
mask_lp_flags(page);
}
}