PostgreSQL Source Code  git master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
hash.h
Go to the documentation of this file.
1 /*-------------------------------------------------------------------------
2  *
3  * hash.h
4  * header file for postgres hash access method implementation
5  *
6  *
7  * Portions Copyright (c) 1996-2017, PostgreSQL Global Development Group
8  * Portions Copyright (c) 1994, Regents of the University of California
9  *
10  * src/include/access/hash.h
11  *
12  * NOTES
13  * modeled after Margo Seltzer's hash implementation for unix.
14  *
15  *-------------------------------------------------------------------------
16  */
17 #ifndef HASH_H
18 #define HASH_H
19 
20 #include "access/amapi.h"
21 #include "access/itup.h"
22 #include "access/sdir.h"
23 #include "fmgr.h"
24 #include "lib/stringinfo.h"
25 #include "storage/bufmgr.h"
26 #include "storage/lockdefs.h"
27 #include "utils/hsearch.h"
28 #include "utils/relcache.h"
29 
30 /*
31  * Mapping from hash bucket number to physical block number of bucket's
32  * starting page. Beware of multiple evaluations of argument!
33  */
34 typedef uint32 Bucket;
35 
36 #define InvalidBucket ((Bucket) 0xFFFFFFFF)
37 
38 #define BUCKET_TO_BLKNO(metap,B) \
39  ((BlockNumber) ((B) + ((B) ? (metap)->hashm_spares[_hash_log2((B)+1)-1] : 0)) + 1)
40 
41 /*
42  * Special space for hash index pages.
43  *
44  * hasho_flag tells us which type of page we're looking at. For
45  * example, knowing overflow pages from bucket pages is necessary
46  * information when you're deleting tuples from a page. If all the
47  * tuples are deleted from an overflow page, the overflow is made
48  * available to other buckets by calling _hash_freeovflpage(). If all
49  * the tuples are deleted from a bucket page, no additional action is
50  * necessary.
51  */
52 #define LH_UNUSED_PAGE (0)
53 #define LH_OVERFLOW_PAGE (1 << 0)
54 #define LH_BUCKET_PAGE (1 << 1)
55 #define LH_BITMAP_PAGE (1 << 2)
56 #define LH_META_PAGE (1 << 3)
57 #define LH_BUCKET_BEING_POPULATED (1 << 4)
58 #define LH_BUCKET_BEING_SPLIT (1 << 5)
59 #define LH_BUCKET_NEEDS_SPLIT_CLEANUP (1 << 6)
60 #define LH_PAGE_HAS_DEAD_TUPLES (1 << 7)
61 
62 #define LH_PAGE_TYPE \
63  (LH_OVERFLOW_PAGE|LH_BUCKET_PAGE|LH_BITMAP_PAGE|LH_META_PAGE)
64 
65 /*
66  * In an overflow page, hasho_prevblkno stores the block number of the previous
67  * page in the bucket chain; in a bucket page, hasho_prevblkno stores the
68  * hashm_maxbucket value as of the last time the bucket was last split, or
69  * else as of the time the bucket was created. The latter convention is used
70  * to determine whether a cached copy of the metapage is too stale to be used
71  * without needing to lock or pin the metapage.
72  *
73  * hasho_nextblkno is always the block number of the next page in the
74  * bucket chain, or InvalidBlockNumber if there are no more such pages.
75  */
76 typedef struct HashPageOpaqueData
77 {
78  BlockNumber hasho_prevblkno; /* see above */
79  BlockNumber hasho_nextblkno; /* see above */
80  Bucket hasho_bucket; /* bucket number this pg belongs to */
81  uint16 hasho_flag; /* page type code, see above */
82  uint16 hasho_page_id; /* for identification of hash indexes */
84 
86 
87 #define H_NEEDS_SPLIT_CLEANUP(opaque) ((opaque)->hasho_flag & LH_BUCKET_NEEDS_SPLIT_CLEANUP)
88 #define H_BUCKET_BEING_SPLIT(opaque) ((opaque)->hasho_flag & LH_BUCKET_BEING_SPLIT)
89 #define H_BUCKET_BEING_POPULATED(opaque) ((opaque)->hasho_flag & LH_BUCKET_BEING_POPULATED)
90 #define H_HAS_DEAD_TUPLES(opaque) ((opaque)->hasho_flag & LH_PAGE_HAS_DEAD_TUPLES)
91 
92 /*
93  * The page ID is for the convenience of pg_filedump and similar utilities,
94  * which otherwise would have a hard time telling pages of different index
95  * types apart. It should be the last 2 bytes on the page. This is more or
96  * less "free" due to alignment considerations.
97  */
98 #define HASHO_PAGE_ID 0xFF80
99 
100 typedef struct HashScanPosItem /* what we remember about each match */
101 {
102  ItemPointerData heapTid; /* TID of referenced heap item */
103  OffsetNumber indexOffset; /* index item's location within page */
105 
106 
107 /*
108  * HashScanOpaqueData is private state for a hash index scan.
109  */
110 typedef struct HashScanOpaqueData
111 {
112  /* Hash value of the scan key, ie, the hash key we seek */
114 
115  /*
116  * We also want to remember which buffer we're currently examining in the
117  * scan. We keep the buffer pinned (but not locked) across hashgettuple
118  * calls, in order to avoid doing a ReadBuffer() for every tuple in the
119  * index.
120  */
122 
123  /* remember the buffer associated with primary bucket */
125 
126  /*
127  * remember the buffer associated with primary bucket page of bucket being
128  * split. it is required during the scan of the bucket which is being
129  * populated during split operation.
130  */
132 
133  /* Current position of the scan, as an index TID */
135 
136  /* Current position of the scan, as a heap TID */
138 
139  /* Whether scan starts on bucket being populated due to split */
141 
142  /*
143  * Whether scanning bucket being split? The value of this parameter is
144  * referred only when hashso_buc_populated is true.
145  */
147  /* info about killed items if any (killedItems is NULL if never used) */
148  HashScanPosItem *killedItems; /* tids and offset numbers of killed items */
149  int numKilled; /* number of currently stored items */
151 
153 
154 /*
155  * Definitions for metapage.
156  */
157 
158 #define HASH_METAPAGE 0 /* metapage is always block 0 */
159 
160 #define HASH_MAGIC 0x6440640
161 #define HASH_VERSION 2 /* 2 signifies only hash key value is stored */
162 
163 /*
164  * spares[] holds the number of overflow pages currently allocated at or
165  * before a certain splitpoint. For example, if spares[3] = 7 then there are
166  * 7 ovflpages before splitpoint 3 (compare BUCKET_TO_BLKNO macro). The
167  * value in spares[ovflpoint] increases as overflow pages are added at the
168  * end of the index. Once ovflpoint increases (ie, we have actually allocated
169  * the bucket pages belonging to that splitpoint) the number of spares at the
170  * prior splitpoint cannot change anymore.
171  *
172  * ovflpages that have been recycled for reuse can be found by looking at
173  * bitmaps that are stored within ovflpages dedicated for the purpose.
174  * The blknos of these bitmap pages are kept in mapp[]; nmaps is the
175  * number of currently existing bitmaps.
176  *
177  * The limitation on the size of spares[] comes from the fact that there's
178  * no point in having more than 2^32 buckets with only uint32 hashcodes.
179  * There is no particular upper limit on the size of mapp[], other than
180  * needing to fit into the metapage. (With 8K block size, 128 bitmaps
181  * limit us to 64 GB of overflow space...)
182  */
183 #define HASH_MAX_SPLITPOINTS 32
184 #define HASH_MAX_BITMAPS 128
185 
186 typedef struct HashMetaPageData
187 {
188  uint32 hashm_magic; /* magic no. for hash tables */
189  uint32 hashm_version; /* version ID */
190  double hashm_ntuples; /* number of tuples stored in the table */
191  uint16 hashm_ffactor; /* target fill factor (tuples/bucket) */
192  uint16 hashm_bsize; /* index page size (bytes) */
193  uint16 hashm_bmsize; /* bitmap array size (bytes) - must be a power
194  * of 2 */
195  uint16 hashm_bmshift; /* log2(bitmap array size in BITS) */
196  uint32 hashm_maxbucket; /* ID of maximum bucket in use */
197  uint32 hashm_highmask; /* mask to modulo into entire table */
198  uint32 hashm_lowmask; /* mask to modulo into lower half of table */
199  uint32 hashm_ovflpoint;/* splitpoint from which ovflpgs being
200  * allocated */
201  uint32 hashm_firstfree; /* lowest-number free ovflpage (bit#) */
202  uint32 hashm_nmaps; /* number of bitmap pages */
203  RegProcedure hashm_procid; /* hash procedure id from pg_proc */
204  uint32 hashm_spares[HASH_MAX_SPLITPOINTS]; /* spare pages before
205  * each splitpoint */
206  BlockNumber hashm_mapp[HASH_MAX_BITMAPS]; /* blknos of ovfl bitmaps */
208 
210 
211 /*
212  * Maximum size of a hash index item (it's okay to have only one per page)
213  */
214 #define HashMaxItemSize(page) \
215  MAXALIGN_DOWN(PageGetPageSize(page) - \
216  SizeOfPageHeaderData - \
217  sizeof(ItemIdData) - \
218  MAXALIGN(sizeof(HashPageOpaqueData)))
219 
220 #define INDEX_MOVED_BY_SPLIT_MASK 0x2000
221 
222 #define HASH_MIN_FILLFACTOR 10
223 #define HASH_DEFAULT_FILLFACTOR 75
224 
225 /*
226  * Constants
227  */
228 #define BYTE_TO_BIT 3 /* 2^3 bits/byte */
229 #define ALL_SET ((uint32) ~0)
230 
231 /*
232  * Bitmap pages do not contain tuples. They do contain the standard
233  * page headers and trailers; however, everything in between is a
234  * giant bit array. The number of bits that fit on a page obviously
235  * depends on the page size and the header/trailer overhead. We require
236  * the number of bits per page to be a power of 2.
237  */
238 #define BMPGSZ_BYTE(metap) ((metap)->hashm_bmsize)
239 #define BMPGSZ_BIT(metap) ((metap)->hashm_bmsize << BYTE_TO_BIT)
240 #define BMPG_SHIFT(metap) ((metap)->hashm_bmshift)
241 #define BMPG_MASK(metap) (BMPGSZ_BIT(metap) - 1)
242 
243 #define HashPageGetBitmap(page) \
244  ((uint32 *) PageGetContents(page))
245 
246 #define HashGetMaxBitmapSize(page) \
247  (PageGetPageSize((Page) page) - \
248  (MAXALIGN(SizeOfPageHeaderData) + MAXALIGN(sizeof(HashPageOpaqueData))))
249 
250 #define HashPageGetMeta(page) \
251  ((HashMetaPage) PageGetContents(page))
252 
253 /*
254  * The number of bits in an ovflpage bitmap word.
255  */
256 #define BITS_PER_MAP 32 /* Number of bits in uint32 */
257 
258 /* Given the address of the beginning of a bit map, clear/set the nth bit */
259 #define CLRBIT(A, N) ((A)[(N)/BITS_PER_MAP] &= ~(1<<((N)%BITS_PER_MAP)))
260 #define SETBIT(A, N) ((A)[(N)/BITS_PER_MAP] |= (1<<((N)%BITS_PER_MAP)))
261 #define ISSET(A, N) ((A)[(N)/BITS_PER_MAP] & (1<<((N)%BITS_PER_MAP)))
262 
263 /*
264  * page-level and high-level locking modes (see README)
265  */
266 #define HASH_READ BUFFER_LOCK_SHARE
267 #define HASH_WRITE BUFFER_LOCK_EXCLUSIVE
268 #define HASH_NOLOCK (-1)
269 
270 /*
271  * Strategy number. There's only one valid strategy for hashing: equality.
272  */
273 #define HTEqualStrategyNumber 1
274 #define HTMaxStrategyNumber 1
275 
276 /*
277  * When a new operator class is declared, we require that the user supply
278  * us with an amproc procudure for hashing a key of the new type.
279  * Since we only have one such proc in amproc, it's number 1.
280  */
281 #define HASHPROC 1
282 #define HASHNProcs 1
283 
284 
285 /* public routines */
286 
288  struct IndexInfo *indexInfo);
289 extern void hashbuildempty(Relation index);
290 extern bool hashinsert(Relation rel, Datum *values, bool *isnull,
291  ItemPointer ht_ctid, Relation heapRel,
292  IndexUniqueCheck checkUnique,
293  struct IndexInfo *indexInfo);
294 extern bool hashgettuple(IndexScanDesc scan, ScanDirection dir);
295 extern int64 hashgetbitmap(IndexScanDesc scan, TIDBitmap *tbm);
296 extern IndexScanDesc hashbeginscan(Relation rel, int nkeys, int norderbys);
297 extern void hashrescan(IndexScanDesc scan, ScanKey scankey, int nscankeys,
298  ScanKey orderbys, int norderbys);
299 extern void hashendscan(IndexScanDesc scan);
301  IndexBulkDeleteResult *stats,
303  void *callback_state);
305  IndexBulkDeleteResult *stats);
306 extern bytea *hashoptions(Datum reloptions, bool validate);
307 extern bool hashvalidate(Oid opclassoid);
308 
309 extern Datum hash_any(register const unsigned char *k, register int keylen);
310 extern Datum hash_uint32(uint32 k);
311 
312 /* private routines */
313 
314 /* hashinsert.c */
315 extern void _hash_doinsert(Relation rel, IndexTuple itup, Relation heapRel);
317  Size itemsize, IndexTuple itup);
318 extern void _hash_pgaddmultitup(Relation rel, Buffer buf, IndexTuple *itups,
319  OffsetNumber *itup_offsets, uint16 nitups);
320 
321 /* hashovfl.c */
322 extern Buffer _hash_addovflpage(Relation rel, Buffer metabuf, Buffer buf, bool retain_pin);
323 extern BlockNumber _hash_freeovflpage(Relation rel, Buffer bucketbuf, Buffer ovflbuf,
324  Buffer wbuf, IndexTuple *itups, OffsetNumber *itup_offsets,
325  Size *tups_size, uint16 nitups, BufferAccessStrategy bstrategy);
326 extern void _hash_initbitmapbuffer(Buffer buf, uint16 bmsize, bool initpage);
327 extern void _hash_squeezebucket(Relation rel,
328  Bucket bucket, BlockNumber bucket_blkno,
329  Buffer bucket_buf,
330  BufferAccessStrategy bstrategy);
332 
333 /* hashpage.c */
334 extern Buffer _hash_getbuf(Relation rel, BlockNumber blkno,
335  int access, int flags);
337  BlockNumber blkno, int flags);
338 extern HashMetaPage _hash_getcachedmetap(Relation rel, Buffer *metabuf,
339  bool force_refresh);
341  int access,
342  HashMetaPage *cachedmetap);
343 extern Buffer _hash_getinitbuf(Relation rel, BlockNumber blkno);
344 extern void _hash_initbuf(Buffer buf, uint32 max_bucket, uint32 num_bucket,
345  uint32 flag, bool initpage);
346 extern Buffer _hash_getnewbuf(Relation rel, BlockNumber blkno,
347  ForkNumber forkNum);
349  int access, int flags,
350  BufferAccessStrategy bstrategy);
351 extern void _hash_relbuf(Relation rel, Buffer buf);
352 extern void _hash_dropbuf(Relation rel, Buffer buf);
353 extern void _hash_dropscanbuf(Relation rel, HashScanOpaque so);
354 extern uint32 _hash_init(Relation rel, double num_tuples,
355  ForkNumber forkNum);
356 extern void _hash_init_metabuffer(Buffer buf, double num_tuples,
357  RegProcedure procid, uint16 ffactor, bool initpage);
358 extern void _hash_pageinit(Page page, Size size);
359 extern void _hash_expandtable(Relation rel, Buffer metabuf);
360 extern void _hash_finish_split(Relation rel, Buffer metabuf, Buffer obuf,
361  Bucket obucket, uint32 maxbucket, uint32 highmask,
362  uint32 lowmask);
363 
364 /* hashsearch.c */
365 extern bool _hash_next(IndexScanDesc scan, ScanDirection dir);
366 extern bool _hash_first(IndexScanDesc scan, ScanDirection dir);
367 extern bool _hash_step(IndexScanDesc scan, Buffer *bufP, ScanDirection dir);
368 
369 /* hashsort.c */
370 typedef struct HSpool HSpool; /* opaque struct in hashsort.c */
371 
372 extern HSpool *_h_spoolinit(Relation heap, Relation index, uint32 num_buckets);
373 extern void _h_spooldestroy(HSpool *hspool);
374 extern void _h_spool(HSpool *hspool, ItemPointer self,
375  Datum *values, bool *isnull);
376 extern void _h_indexbuild(HSpool *hspool, Relation heapRel);
377 
378 /* hashutil.c */
379 extern bool _hash_checkqual(IndexScanDesc scan, IndexTuple itup);
380 extern uint32 _hash_datum2hashkey(Relation rel, Datum key);
381 extern uint32 _hash_datum2hashkey_type(Relation rel, Datum key, Oid keytype);
382 extern Bucket _hash_hashkey2bucket(uint32 hashkey, uint32 maxbucket,
383  uint32 highmask, uint32 lowmask);
384 extern uint32 _hash_log2(uint32 num);
385 extern void _hash_checkpage(Relation rel, Buffer buf, int flags);
388  Datum *user_values, bool *user_isnull,
389  Datum *index_values, bool *index_isnull);
390 extern OffsetNumber _hash_binsearch(Page page, uint32 hash_value);
391 extern OffsetNumber _hash_binsearch_last(Page page, uint32 hash_value);
395  uint32 lowmask, uint32 maxbucket);
396 extern void _hash_kill_items(IndexScanDesc scan);
397 
398 /* hash.c */
399 extern void hashbucketcleanup(Relation rel, Bucket cur_bucket,
400  Buffer bucket_buf, BlockNumber bucket_blkno,
401  BufferAccessStrategy bstrategy,
402  uint32 maxbucket, uint32 highmask, uint32 lowmask,
403  double *tuples_removed, double *num_index_tuples,
404  bool bucket_has_garbage,
405  IndexBulkDeleteCallback callback, void *callback_state);
406 
407 #endif /* HASH_H */
bool _hash_convert_tuple(Relation index, Datum *user_values, bool *user_isnull, Datum *index_values, bool *index_isnull)
Definition: hashutil.c:260
void hashendscan(IndexScanDesc scan)
Definition: hash.c:505
HashScanOpaqueData * HashScanOpaque
Definition: hash.h:152
uint16 hashm_bmshift
Definition: hash.h:195
uint16 hasho_page_id
Definition: hash.h:82
IndexScanDesc hashbeginscan(Relation rel, int nkeys, int norderbys)
Definition: hash.c:440
Buffer _hash_getbuf(Relation rel, BlockNumber blkno, int access, int flags)
Definition: hashpage.c:78
BlockNumber _hash_freeovflpage(Relation rel, Buffer bucketbuf, Buffer ovflbuf, Buffer wbuf, IndexTuple *itups, OffsetNumber *itup_offsets, Size *tups_size, uint16 nitups, BufferAccessStrategy bstrategy)
Definition: hashovfl.c:487
RegProcedure hashm_procid
Definition: hash.h:203
void _hash_pageinit(Page page, Size size)
Definition: hashpage.c:592
void hashbucketcleanup(Relation rel, Bucket cur_bucket, Buffer bucket_buf, BlockNumber bucket_blkno, BufferAccessStrategy bstrategy, uint32 maxbucket, uint32 highmask, uint32 lowmask, double *tuples_removed, double *num_index_tuples, bool bucket_has_garbage, IndexBulkDeleteCallback callback, void *callback_state)
Definition: hash.c:763
bool hashvalidate(Oid opclassoid)
Definition: hashvalidate.c:44
uint32 _hash_log2(uint32 num)
Definition: hashutil.c:141
bytea * hashoptions(Datum reloptions, bool validate)
Definition: hashutil.c:224
int64 hashgetbitmap(IndexScanDesc scan, TIDBitmap *tbm)
Definition: hash.c:394
Buffer _hash_getbucketbuf_from_hashkey(Relation rel, uint32 hashkey, int access, HashMetaPage *cachedmetap)
Definition: hashpage.c:1516
bool _hash_checkqual(IndexScanDesc scan, IndexTuple itup)
Definition: hashutil.c:31
regproc RegProcedure
Definition: c.h:395
uint32 hashm_magic
Definition: hash.h:188
HashMetaPage _hash_getcachedmetap(Relation rel, Buffer *metabuf, bool force_refresh)
Definition: hashpage.c:1458
void hashrescan(IndexScanDesc scan, ScanKey scankey, int nscankeys, ScanKey orderbys, int norderbys)
Definition: hash.c:473
uint16 hashm_ffactor
Definition: hash.h:191
uint32 hashm_highmask
Definition: hash.h:197
HashMetaPageData * HashMetaPage
Definition: hash.h:209
void _hash_init_metabuffer(Buffer buf, double num_tuples, RegProcedure procid, uint16 ffactor, bool initpage)
Definition: hashpage.c:497
IndexBuildResult * hashbuild(Relation heap, Relation index, struct IndexInfo *indexInfo)
Definition: hash.c:103
uint32 BlockNumber
Definition: block.h:31
unsigned int Oid
Definition: postgres_ext.h:31
bool hashgettuple(IndexScanDesc scan, ScanDirection dir)
Definition: hash.c:268
void _hash_squeezebucket(Relation rel, Bucket bucket, BlockNumber bucket_blkno, Buffer bucket_buf, BufferAccessStrategy bstrategy)
Definition: hashovfl.c:792
uint32 hashm_lowmask
Definition: hash.h:198
void _h_spool(HSpool *hspool, ItemPointer self, Datum *values, bool *isnull)
Definition: hashsort.c:93
void _hash_initbuf(Buffer buf, uint32 max_bucket, uint32 num_bucket, uint32 flag, bool initpage)
Definition: hashpage.c:165
void _hash_dropscanbuf(Relation rel, HashScanOpaque so)
Definition: hashpage.c:297
Buffer _hash_getinitbuf(Relation rel, BlockNumber blkno)
Definition: hashpage.c:143
bool hashinsert(Relation rel, Datum *values, bool *isnull, ItemPointer ht_ctid, Relation heapRel, IndexUniqueCheck checkUnique, struct IndexInfo *indexInfo)
Definition: hash.c:237
#define HASH_MAX_SPLITPOINTS
Definition: hash.h:183
bool _hash_step(IndexScanDesc scan, Buffer *bufP, ScanDirection dir)
Definition: hashsearch.c:391
uint32 _hash_datum2hashkey_type(Relation rel, Datum key, Oid keytype)
Definition: hashutil.c:102
uint16 OffsetNumber
Definition: off.h:24
Definition: type.h:90
uint32 Bucket
Definition: hash.h:34
IndexUniqueCheck
Definition: genam.h:111
bool _hash_next(IndexScanDesc scan, ScanDirection dir)
Definition: hashsearch.c:34
unsigned short uint16
Definition: c.h:267
void _hash_finish_split(Relation rel, Buffer metabuf, Buffer obuf, Bucket obucket, uint32 maxbucket, uint32 highmask, uint32 lowmask)
Definition: hashpage.c:1311
BlockNumber hasho_prevblkno
Definition: hash.h:78
Buffer _hash_getnewbuf(Relation rel, BlockNumber blkno, ForkNumber forkNum)
Definition: hashpage.c:206
void _hash_checkpage(Relation rel, Buffer buf, int flags)
Definition: hashutil.c:159
static void callback(struct sockaddr *addr, struct sockaddr *mask, void *unused)
Definition: test_ifaddrs.c:48
uint32 hashm_version
Definition: hash.h:189
uint32 hashm_nmaps
Definition: hash.h:202
struct HashMetaPageData HashMetaPageData
Buffer _hash_addovflpage(Relation rel, Buffer metabuf, Buffer buf, bool retain_pin)
Definition: hashovfl.c:110
IndexBulkDeleteResult * hashvacuumcleanup(IndexVacuumInfo *info, IndexBulkDeleteResult *stats)
Definition: hash.c:723
static char * buf
Definition: pg_test_fsync.c:65
char * flag(int b)
Definition: test-ctype.c:33
void _hash_doinsert(Relation rel, IndexTuple itup, Relation heapRel)
Definition: hashinsert.c:36
ScanDirection
Definition: sdir.h:22
OffsetNumber _hash_pgaddtup(Relation rel, Buffer buf, Size itemsize, IndexTuple itup)
Definition: hashinsert.c:267
void _hash_initbitmapbuffer(Buffer buf, uint16 bmsize, bool initpage)
Definition: hashovfl.c:727
HashScanPosItem * killedItems
Definition: hash.h:148
unsigned int uint32
Definition: c.h:268
Buffer hashso_bucket_buf
Definition: hash.h:124
ForkNumber
Definition: relpath.h:24
void _hash_relbuf(Relation rel, Buffer buf)
Definition: hashpage.c:274
#define HASH_MAX_BITMAPS
Definition: hash.h:184
void _hash_expandtable(Relation rel, Buffer metabuf)
Definition: hashpage.c:610
bool _hash_first(IndexScanDesc scan, ScanDirection dir)
Definition: hashsearch.c:222
uint32 hashm_ovflpoint
Definition: hash.h:199
uint16 hashm_bsize
Definition: hash.h:192
uint32 _hash_init(Relation rel, double num_tuples, ForkNumber forkNum)
Definition: hashpage.c:335
BlockNumber _hash_get_newblock_from_oldbucket(Relation rel, Bucket old_bucket)
Definition: hashutil.c:403
uintptr_t Datum
Definition: postgres.h:372
BlockNumber _hash_get_oldblock_from_newbucket(Relation rel, Bucket new_bucket)
Definition: hashutil.c:364
double hashm_ntuples
Definition: hash.h:190
bool hashso_buc_populated
Definition: hash.h:140
uint32 hashm_firstfree
Definition: hash.h:201
uint32 hashm_spares[HASH_MAX_SPLITPOINTS]
Definition: hash.h:204
uint32 hashso_sk_hash
Definition: hash.h:113
uint32 _hash_get_indextuple_hashkey(IndexTuple itup)
Definition: hashutil.c:233
Bucket _hash_get_newbucket_from_oldbucket(Relation rel, Bucket old_bucket, uint32 lowmask, uint32 maxbucket)
Definition: hashutil.c:436
void hashbuildempty(Relation index)
Definition: hash.c:186
void _h_spooldestroy(HSpool *hspool)
Definition: hashsort.c:83
Bucket hasho_bucket
Definition: hash.h:80
struct HashScanPosItem HashScanPosItem
size_t Size
Definition: c.h:356
void _hash_dropbuf(Relation rel, Buffer buf)
Definition: hashpage.c:285
HashPageOpaqueData * HashPageOpaque
Definition: hash.h:85
OffsetNumber _hash_binsearch_last(Page page, uint32 hash_value)
Definition: hashutil.c:330
ItemPointerData hashso_curpos
Definition: hash.h:134
HSpool * _h_spoolinit(Relation heap, Relation index, uint32 num_buckets)
Definition: hashsort.c:48
Buffer _hash_getbuf_with_condlock_cleanup(Relation rel, BlockNumber blkno, int flags)
Definition: hashpage.c:104
struct HashScanOpaqueData HashScanOpaqueData
uint32 hashm_maxbucket
Definition: hash.h:196
struct HashPageOpaqueData HashPageOpaqueData
uint16 hasho_flag
Definition: hash.h:81
bool hashso_buc_split
Definition: hash.h:146
static Datum values[MAXATTR]
Definition: bootstrap.c:162
Datum hash_any(register const unsigned char *k, register int keylen)
Definition: hashfunc.c:307
Bucket _hash_hashkey2bucket(uint32 hashkey, uint32 maxbucket, uint32 highmask, uint32 lowmask)
Definition: hashutil.c:125
OffsetNumber indexOffset
Definition: hash.h:103
void _h_indexbuild(HSpool *hspool, Relation heapRel)
Definition: hashsort.c:104
void _hash_kill_items(IndexScanDesc scan)
Definition: hashutil.c:463
Buffer hashso_split_bucket_buf
Definition: hash.h:131
Buffer _hash_getbuf_with_strategy(Relation rel, BlockNumber blkno, int access, int flags, BufferAccessStrategy bstrategy)
Definition: hashpage.c:247
BlockNumber hasho_nextblkno
Definition: hash.h:79
uint16 hashm_bmsize
Definition: hash.h:193
uint32 _hash_datum2hashkey(Relation rel, Datum key)
Definition: hashutil.c:82
Datum hash_uint32(uint32 k)
Definition: hashfunc.c:512
Definition: c.h:439
ItemPointerData heapTid
Definition: hash.h:102
OffsetNumber _hash_binsearch(Page page, uint32 hash_value)
Definition: hashutil.c:292
uint32 _hash_ovflblkno_to_bitno(HashMetaPage metap, BlockNumber ovflblkno)
Definition: hashovfl.c:61
IndexBulkDeleteResult * hashbulkdelete(IndexVacuumInfo *info, IndexBulkDeleteResult *stats, IndexBulkDeleteCallback callback, void *callback_state)
Definition: hash.c:533
void _hash_pgaddmultitup(Relation rel, Buffer buf, IndexTuple *itups, OffsetNumber *itup_offsets, uint16 nitups)
Definition: hashinsert.c:298
BlockNumber hashm_mapp[HASH_MAX_BITMAPS]
Definition: hash.h:206
int Buffer
Definition: buf.h:23
ItemPointerData hashso_heappos
Definition: hash.h:137
bool(* IndexBulkDeleteCallback)(ItemPointer itemptr, void *state)
Definition: genam.h:83
Buffer hashso_curbuf
Definition: hash.h:121
Pointer Page
Definition: bufpage.h:74