75 elog(
ERROR,
"hash AM does not use P_NEW");
101 elog(
ERROR,
"hash AM does not use P_NEW");
140 elog(
ERROR,
"hash AM does not use P_NEW");
204 elog(
ERROR,
"hash AM does not use P_NEW");
206 elog(
ERROR,
"access to noncontiguous page in hash index \"%s\"",
210 if (blkno == nblocks)
215 elog(
ERROR,
"unexpected hash relation size: %u, should be %u",
246 elog(
ERROR,
"hash AM does not use P_NEW");
344 elog(
ERROR,
"cannot initialize non-empty hash index \"%s\"",
360 data_width =
sizeof(
uint32);
418 for (
i = 0;
i < num_buckets;
i++)
453 (
errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
454 errmsg(
"out of overflow pages in hash index \"%s\"",
499 uint16 ffactor,
bool initpage)
517 dnumbuckets = num_tuples / ffactor;
518 if (dnumbuckets <= 2.0)
520 else if (dnumbuckets >= (
double) 0x40000000)
521 num_buckets = 0x40000000;
631 bool metap_update_masks =
false;
632 bool metap_update_splitpoint =
false;
761 maxbucket, highmask, lowmask, NULL, NULL,
true,
842 metap_update_masks =
true;
854 metap_update_splitpoint =
true;
916 if (metap_update_masks)
923 if (metap_update_splitpoint)
949 old_bucket, new_bucket,
950 buf_oblkno, buf_nblkno, NULL,
951 maxbucket, highmask, lowmask);
999 lastblock = firstblock + nblocks - 1;
1092 Size all_tups_size = 0;
1124 ooffnum <= omaxoffnum;
1153 maxbucket, highmask, lowmask);
1155 if (bucket == nbucket)
1197 for (
i = 0;
i < nitups;
i++)
1208 itups[nitups++] = new_itup;
1209 all_tups_size += itemsz;
1216 Assert(bucket == obucket);
1223 if (obuf == bucket_obuf)
1244 if (nbuf == bucket_nbuf)
1250 for (
i = 0;
i < nitups;
i++)
1333 maxbucket, highmask, lowmask, NULL, NULL,
true,
1395 if (nblkno == bucket_nblkno)
1404 noffnum <= nmaxoffnum;
1424 if (nbuf == bucket_nbuf)
1457 nbucket, obuf, bucket_nbuf, tidhtab,
1458 maxbucket, highmask, lowmask);
1506 if (force_refresh || rel->
rd_amcache == NULL)
1614 *cachedmetap = metap;
#define InvalidBlockNumber
static bool BlockNumberIsValid(BlockNumber blockNumber)
BlockNumber BufferGetBlockNumber(Buffer buffer)
bool IsBufferCleanupOK(Buffer buffer)
Buffer ExtendBufferedRel(BufferManagerRelation bmr, ForkNumber forkNum, BufferAccessStrategy strategy, uint32 flags)
BlockNumber RelationGetNumberOfBlocksInFork(Relation relation, ForkNumber forkNum)
void ReleaseBuffer(Buffer buffer)
void UnlockReleaseBuffer(Buffer buffer)
void MarkBufferDirty(Buffer buffer)
void LockBuffer(Buffer buffer, int mode)
Buffer ReadBufferExtended(Relation reln, ForkNumber forkNum, BlockNumber blockNum, ReadBufferMode mode, BufferAccessStrategy strategy)
Buffer ReadBuffer(Relation reln, BlockNumber blockNum)
bool ConditionalLockBufferForCleanup(Buffer buffer)
#define BUFFER_LOCK_UNLOCK
#define BUFFER_LOCK_SHARE
static Page BufferGetPage(Buffer buffer)
static Size BufferGetPageSize(Buffer buffer)
#define BUFFER_LOCK_EXCLUSIVE
static bool BufferIsValid(Buffer bufnum)
Size PageGetFreeSpaceForMultipleTuples(Page page, int ntups)
void PageSetChecksumInplace(Page page, BlockNumber blkno)
void PageInit(Page page, Size pageSize, Size specialSize)
PageHeaderData * PageHeader
static Item PageGetItem(Page page, ItemId itemId)
static ItemId PageGetItemId(Page page, OffsetNumber offsetNumber)
static void PageSetLSN(Page page, XLogRecPtr lsn)
static OffsetNumber PageGetMaxOffsetNumber(Page page)
#define Assert(condition)
#define MemSet(start, val, len)
void hash_destroy(HTAB *hashp)
void * hash_search(HTAB *hashp, const void *keyPtr, HASHACTION action, bool *foundPtr)
HTAB * hash_create(const char *tabname, long nelem, const HASHCTL *info, int flags)
int errcode(int sqlerrcode)
int errmsg(const char *fmt,...)
#define ereport(elevel,...)
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 split_cleanup, IndexBulkDeleteCallback callback, void *callback_state)
#define HashPageGetOpaque(page)
#define HASHSTANDARD_PROC
#define HASH_MAX_SPLITPOINTS
#define H_BUCKET_BEING_SPLIT(opaque)
#define HashPageGetMeta(page)
#define LH_BUCKET_BEING_POPULATED
#define BUCKET_TO_BLKNO(metap, B)
#define HashGetMaxBitmapSize(page)
#define INDEX_MOVED_BY_SPLIT_MASK
#define H_NEEDS_SPLIT_CLEANUP(opaque)
#define LH_BUCKET_NEEDS_SPLIT_CLEANUP
#define LH_BUCKET_BEING_SPLIT
#define HashGetTargetPageUsage(relation)
#define BMPG_SHIFT(metap)
#define SizeOfHashInitBitmapPage
#define XLOG_HASH_INIT_BITMAP_PAGE
#define SizeOfHashSplitComplete
#define XLOG_HASH_SPLIT_ALLOCATE_PAGE
#define XLOG_HASH_SPLIT_PAGE
#define XLOG_HASH_INIT_META_PAGE
#define XLOG_HASH_SPLIT_COMPLETE
#define SizeOfHashSplitAllocPage
#define SizeOfHashInitMetaPage
#define XLH_SPLIT_META_UPDATE_SPLITPOINT
#define XLH_SPLIT_META_UPDATE_MASKS
void _hash_pgaddmultitup(Relation rel, Buffer buf, IndexTuple *itups, OffsetNumber *itup_offsets, uint16 nitups)
void _hash_initbitmapbuffer(Buffer buf, uint16 bmsize, bool initpage)
Buffer _hash_addovflpage(Relation rel, Buffer metabuf, Buffer buf, bool retain_pin)
Buffer _hash_getinitbuf(Relation rel, BlockNumber blkno)
HashMetaPage _hash_getcachedmetap(Relation rel, Buffer *metabuf, bool force_refresh)
void _hash_initbuf(Buffer buf, uint32 max_bucket, uint32 num_bucket, uint32 flag, bool initpage)
void _hash_relbuf(Relation rel, Buffer buf)
Buffer _hash_getbuf_with_condlock_cleanup(Relation rel, BlockNumber blkno, int flags)
void _hash_pageinit(Page page, Size size)
static void _hash_splitbucket(Relation rel, Buffer metabuf, Bucket obucket, Bucket nbucket, Buffer obuf, Buffer nbuf, HTAB *htab, uint32 maxbucket, uint32 highmask, uint32 lowmask)
uint32 _hash_init(Relation rel, double num_tuples, ForkNumber forkNum)
void _hash_dropbuf(Relation rel, Buffer buf)
void _hash_dropscanbuf(Relation rel, HashScanOpaque so)
Buffer _hash_getbuf(Relation rel, BlockNumber blkno, int access, int flags)
void _hash_finish_split(Relation rel, Buffer metabuf, Buffer obuf, Bucket obucket, uint32 maxbucket, uint32 highmask, uint32 lowmask)
Buffer _hash_getbucketbuf_from_hashkey(Relation rel, uint32 hashkey, int access, HashMetaPage *cachedmetap)
void _hash_init_metabuffer(Buffer buf, double num_tuples, RegProcedure procid, uint16 ffactor, bool initpage)
static void log_split_page(Relation rel, Buffer buf)
static bool _hash_alloc_buckets(Relation rel, BlockNumber firstblock, uint32 nblocks)
Buffer _hash_getbuf_with_strategy(Relation rel, BlockNumber blkno, int access, int flags, BufferAccessStrategy bstrategy)
Buffer _hash_getnewbuf(Relation rel, BlockNumber blkno, ForkNumber forkNum)
void _hash_expandtable(Relation rel, Buffer metabuf)
uint32 _hash_spareindex(uint32 num_bucket)
BlockNumber _hash_get_newblock_from_oldbucket(Relation rel, Bucket old_bucket)
uint32 _hash_get_totalbuckets(uint32 splitpoint_phase)
uint32 _hash_get_indextuple_hashkey(IndexTuple itup)
Bucket _hash_hashkey2bucket(uint32 hashkey, uint32 maxbucket, uint32 highmask, uint32 lowmask)
void _hash_checkpage(Relation rel, Buffer buf, int flags)
RegProcedure index_getprocid(Relation irel, AttrNumber attnum, uint16 procnum)
IndexTuple CopyIndexTuple(IndexTuple source)
struct ItemIdData ItemIdData
#define ItemIdIsDead(itemId)
struct ItemPointerData ItemPointerData
IndexTupleData * IndexTuple
#define IndexTupleSize(itup)
#define MaxIndexTuplesPerPage
void pfree(void *pointer)
MemoryContext CurrentMemoryContext
void * MemoryContextAlloc(MemoryContext context, Size size)
#define START_CRIT_SECTION()
#define CHECK_FOR_INTERRUPTS()
#define END_CRIT_SECTION()
#define OffsetNumberNext(offsetNumber)
#define FirstOffsetNumber
static uint32 pg_nextpower2_32(uint32 num)
static int pg_leftmost_one_pos32(uint32 word)
void PredicateLockPageSplit(Relation relation, BlockNumber oldblkno, BlockNumber newblkno)
static SMgrRelation RelationGetSmgr(Relation rel)
#define RelationGetRelationName(relation)
#define RelationNeedsWAL(relation)
static pg_noinline void Size size
void smgrextend(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum, const void *buffer, bool skipFsync)
BlockNumber hashm_mapp[HASH_MAX_BITMAPS]
RegProcedure hashm_procid
uint32 hashm_spares[HASH_MAX_SPLITPOINTS]
BlockNumber hasho_nextblkno
BlockNumber hasho_prevblkno
bool hashso_buc_populated
Buffer hashso_split_bucket_buf
MemoryContext rd_indexcxt
RelFileLocator rd_locator
void XLogRegisterBufData(uint8 block_id, const char *data, uint32 len)
XLogRecPtr XLogInsert(RmgrId rmid, uint8 info)
XLogRecPtr log_newpage(RelFileLocator *rlocator, ForkNumber forknum, BlockNumber blkno, Page page, bool page_std)
void XLogRegisterData(const char *data, uint32 len)
void XLogRegisterBuffer(uint8 block_id, Buffer buffer, uint8 flags)
void XLogBeginInsert(void)
#define REGBUF_FORCE_IMAGE