0002-allow_pageinspect_handle_UNUSED_OR_EMPTY_hash_pages.patch
application/x-download
Filename: 0002-allow_pageinspect_handle_UNUSED_OR_EMPTY_hash_pages.patch
Type: application/x-download
Part: 1
Message:
Re: pageinspect and hash indexes
Patch
Format: unified
Series: patch 0002
| File | + | − |
|---|---|---|
| contrib/pageinspect/hashfuncs.c | 11 | 0 |
diff --git a/contrib/pageinspect/hashfuncs.c b/contrib/pageinspect/hashfuncs.c
index 812a03f..1f063f0 100644
--- a/contrib/pageinspect/hashfuncs.c
+++ b/contrib/pageinspect/hashfuncs.c
@@ -70,6 +70,17 @@ verify_hash_page(bytea *raw_page, int flags)
errmsg("index table contains corrupted page")));
pageopaque = (HashPageOpaque) PageGetSpecialPointer(page);
+
+ /* Check if it is an unused hash page. */
+ if (pageopaque->hasho_flag == LH_UNUSED_PAGE)
+ return page;
+
+ /* Check if it is an empty hash page. */
+ if (PageIsEmpty(page))
+ ereport(ERROR,
+ (errcode(ERRCODE_INDEX_CORRUPTED),
+ errmsg("index table contains empty page")));
+
if (pageopaque->hasho_page_id != HASHO_PAGE_ID)
ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),