0002-allow_pageinspect_handle_UNUSED_hash_pages.patch
application/x-patch
Filename: 0002-allow_pageinspect_handle_UNUSED_hash_pages.patch
Type: application/x-patch
Part: 1
Message:
Re: pageinspect and hash indexes
Patch
Format: unified
Series: patch 0002
| File | + | − |
|---|---|---|
| contrib/pageinspect/hashfuncs.c | 5 | 0 |
diff --git a/contrib/pageinspect/hashfuncs.c b/contrib/pageinspect/hashfuncs.c
index 812a03f..6ba8847 100644
--- a/contrib/pageinspect/hashfuncs.c
+++ b/contrib/pageinspect/hashfuncs.c
@@ -70,6 +70,7 @@ verify_hash_page(bytea *raw_page, int flags)
errmsg("index table contains corrupted page")));
pageopaque = (HashPageOpaque) PageGetSpecialPointer(page);
+
if (pageopaque->hasho_page_id != HASHO_PAGE_ID)
ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
@@ -77,6 +78,10 @@ verify_hash_page(bytea *raw_page, int flags)
errdetail("Expected %08x, got %08x.",
HASHO_PAGE_ID, pageopaque->hasho_page_id)));
+ /* Check if it is an unused hash page. */
+ if (pageopaque->hasho_flag == LH_UNUSED_PAGE)
+ return page;
+
/* Check that page type is sane. */
pagetype = pageopaque->hasho_flag & LH_PAGE_TYPE;
if (pagetype != LH_OVERFLOW_PAGE && pagetype != LH_BUCKET_PAGE &&