change_metapage_usage_hash-v2.patch
application/octet-stream
Filename: change_metapage_usage_hash-v2.patch
Type: application/octet-stream
Part: 1
Message:
Re: Setting pd_lower in GIN metapage
Patch
Format: unified
Series: patch v2
| File | + | − |
|---|---|---|
| src/backend/access/hash/hashpage.c | 6 | 3 |
diff --git a/src/backend/access/hash/hashpage.c b/src/backend/access/hash/hashpage.c index f279dce..185b6d7 100644 --- a/src/backend/access/hash/hashpage.c +++ b/src/backend/access/hash/hashpage.c @@ -403,7 +403,7 @@ _hash_init(Relation rel, double num_tuples, ForkNumber forkNum) XLogBeginInsert(); XLogRegisterData((char *) &xlrec, SizeOfHashInitMetaPage); - XLogRegisterBuffer(0, metabuf, REGBUF_WILL_INIT); + XLogRegisterBuffer(0, metabuf, REGBUF_WILL_INIT | REGBUF_STANDARD); recptr = XLogInsert(RM_HASH_ID, XLOG_HASH_INIT_META_PAGE); @@ -592,8 +592,11 @@ _hash_init_metabuffer(Buffer buf, double num_tuples, RegProcedure procid, metap->hashm_firstfree = 0; /* - * Set pd_lower just past the end of the metadata. This is to log full - * page image of metapage in xloginsert.c. + * Set pd_lower just past the end of the metadata. This is required for + * correctness as otherwise, the pd_lower would be pointing to the + * position as set by _hash_pageinit and that can lead to logging the + * incorrect metadata while backing up full page image in xloginsert.c. + * Note, it also helps in page masking by allowing to mask unused space. */ ((PageHeader) page)->pd_lower = ((char *) metap + sizeof(HashMetaPageData)) - (char *) page;