summaryrefslogtreecommitdiff
path: root/src/backend/access/gin/ginxlog.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/access/gin/ginxlog.c')
-rw-r--r--src/backend/access/gin/ginxlog.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/backend/access/gin/ginxlog.c b/src/backend/access/gin/ginxlog.c
index 8468fe825cf..2995e7b06a7 100644
--- a/src/backend/access/gin/ginxlog.c
+++ b/src/backend/access/gin/ginxlog.c
@@ -13,6 +13,7 @@
*/
#include "postgres.h"
+#include "access/bufmask.h"
#include "access/gin_private.h"
#include "access/xlogutils.h"
#include "utils/memutils.h"
@@ -758,3 +759,34 @@ gin_xlog_cleanup(void)
MemoryContextDelete(opCtx);
opCtx = NULL;
}
+
+/*
+ * Mask a GIN page before running consistency checks on it.
+ */
+void
+gin_mask(char *pagedata, BlockNumber blkno)
+{
+ Page page = (Page) pagedata;
+ GinPageOpaque opaque;
+
+ mask_page_lsn(page);
+ opaque = GinPageGetOpaque(page);
+
+ mask_page_hint_bits(page);
+
+ /*
+ * GIN metapage doesn't use pd_lower/pd_upper. Other page types do. Hence,
+ * we need to apply masking for those pages.
+ */
+ if (opaque->flags != GIN_META)
+ {
+ /*
+ * For GIN_DELETED page, the page is initialized to empty. Hence, mask
+ * the page content.
+ */
+ if (opaque->flags & GIN_DELETED)
+ mask_page_content(page);
+ else
+ mask_unused_space(page);
+ }
+}