Skip to content

Commit 813b456

Browse files
committed
Add page id to bloom index
Added to ensure that bloom index pages can be distinguished from other pages by pg_filedump. Because there wasn't any public/production versions before, it doesn't pay attention to any compatibility issues. Per notice from Tom Lane
1 parent e7bcde8 commit 813b456

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

contrib/bloom/bloom.h

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,13 @@
3131
/* Opaque for bloom pages */
3232
typedef struct BloomPageOpaqueData
3333
{
34-
OffsetNumber maxoff;
35-
uint16 flags;
34+
OffsetNumber maxoff; /* number of index tuples on page */
35+
uint16 flags; /* see bit definitions below */
36+
uint16 unused; /* placeholder to force maxaligning of size
37+
* of BloomPageOpaqueData and to place
38+
* bloom_page_id exactly at the end of page
39+
*/
40+
uint16 bloom_page_id; /* for identification of BLOOM indexes */
3641
} BloomPageOpaqueData;
3742

3843
typedef BloomPageOpaqueData *BloomPageOpaque;
@@ -41,6 +46,16 @@ typedef BloomPageOpaqueData *BloomPageOpaque;
4146
#define BLOOM_META (1<<0)
4247
#define BLOOM_DELETED (2<<0)
4348

49+
/*
50+
* The page ID is for the convenience of pg_filedump and similar utilities,
51+
* which otherwise would have a hard time telling pages of different index
52+
* types apart. It should be the last 2 bytes on the page. This is more or
53+
* less "free" due to alignment considerations.
54+
*
55+
* See comments above GinPageOpaqueData.
56+
*/
57+
#define BLOOM_PAGE_ID 0xFF83
58+
4459
/* Macros for accessing bloom page structures */
4560
#define BloomPageGetOpaque(page) ((BloomPageOpaque) PageGetSpecialPointer(page))
4661
#define BloomPageGetMaxOffset(page) (BloomPageGetOpaque(page)->maxoff)

contrib/bloom/blutils.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,7 @@ BloomInitPage(Page page, uint16 flags)
359359
opaque = BloomPageGetOpaque(page);
360360
memset(opaque, 0, sizeof(BloomPageOpaqueData));
361361
opaque->flags = flags;
362+
opaque->bloom_page_id = BLOOM_PAGE_ID;
362363
}
363364

364365
/*

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy