69 for (
i = 1;
i <= splitnum;
i++)
82 bitnum <= metap->hashm_spares[
i])
87 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
88 errmsg(
"invalid overflow block number %u", ovflblkno)));
134 bool page_found =
false;
191 first_page = orig_firstfree >>
BMPG_SHIFT(metap);
208 last_bit = max_ovflpg &
BMPG_MASK(metap);
213 Assert(i < metap->hashm_nmaps);
217 last_inpage = last_bit;
239 bitmap_page_bit =
bit;
283 (
errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
284 errmsg(
"out of overflow pages in hash index \"%s\"",
328 SETBIT(freep, bitmap_page_bit);
461 elog(
ERROR,
"firstfreebit found no free bit");
513 bool update_metap =
false;
533 if (prevblkno == writeblkno)
559 bitmapbit = ovflbitno &
BMPG_MASK(metap);
562 elog(
ERROR,
"invalid overflow bit number %u", ovflbitno);
637 if (ovflbitno < metap->hashm_firstfree)
650 bool mod_wbuf =
false;
654 xlrec.
ntups = nitups;
681 for (
i = 0;
i < nitups;
i++)
799 memset(freep, 0xFF, bmsize);
806 ((
PageHeader) pg)->pd_lower = ((
char *) freep + bmsize) - (
char *) pg;
860 wblkno = bucket_blkno;
911 Size all_tups_size = 0;
913 bool retain_pin =
false;
919 roffnum <= maxroffnum;
942 bool tups_moved =
false;
946 if (wblkno == bucket_blkno)
953 if (wblkno != rblkno)
962 Assert(nitups == ndeletable);
992 xlrec.
ntups = nitups;
1013 for (
i = 0;
i < nitups;
i++)
1041 if (rblkno == wblkno)
1054 for (
i = 0;
i < nitups;
i++)
1069 deletable[ndeletable++] = roffnum;
1077 tups_size[nitups++] = itemsz;
1078 all_tups_size += itemsz;
1097 tups_size, nitups, bstrategy);
1100 for (
i = 0;
i < nitups;
i++)
1104 if (rblkno == wblkno)
1107 if (wblkno == bucket_blkno)
#define InvalidBlockNumber
static bool BlockNumberIsValid(BlockNumber blockNumber)
BlockNumber BufferGetBlockNumber(Buffer buffer)
void MarkBufferDirty(Buffer buffer)
void LockBuffer(Buffer buffer, int mode)
#define BUFFER_LOCK_UNLOCK
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 PageIndexMultiDelete(Page page, OffsetNumber *itemnos, int nitems)
PageHeaderData * PageHeader
static bool PageIsEmpty(Page page)
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 PG_USED_FOR_ASSERTS_ONLY
#define Assert(condition)
int errcode(int sqlerrcode)
int errmsg(const char *fmt,...)
#define ereport(elevel,...)
#define HashPageGetOpaque(page)
#define HashPageGetBitmap(page)
#define HashPageGetMeta(page)
#define BMPGSZ_BIT(metap)
#define BMPG_SHIFT(metap)
#define HASH_XLOG_FREE_OVFL_BUFS
#define XLOG_HASH_SQUEEZE_PAGE
#define SizeOfHashAddOvflPage
#define XLOG_HASH_ADD_OVFL_PAGE
#define SizeOfHashSqueezePage
#define SizeOfHashMovePageContents
#define XLOG_HASH_MOVE_PAGE_CONTENTS
void _hash_pgaddmultitup(Relation rel, Buffer buf, IndexTuple *itups, OffsetNumber *itup_offsets, uint16 nitups)
void _hash_squeezebucket(Relation rel, Bucket bucket, BlockNumber bucket_blkno, Buffer bucket_buf, BufferAccessStrategy bstrategy)
static uint32 _hash_firstfreebit(uint32 map)
uint32 _hash_ovflblkno_to_bitno(HashMetaPage metap, BlockNumber ovflblkno)
BlockNumber _hash_freeovflpage(Relation rel, Buffer bucketbuf, Buffer ovflbuf, Buffer wbuf, IndexTuple *itups, OffsetNumber *itup_offsets, Size *tups_size, uint16 nitups, BufferAccessStrategy bstrategy)
void _hash_initbitmapbuffer(Buffer buf, uint16 bmsize, bool initpage)
Buffer _hash_addovflpage(Relation rel, Buffer metabuf, Buffer buf, bool retain_pin)
static BlockNumber bitno_to_blkno(HashMetaPage metap, uint32 ovflbitnum)
Buffer _hash_getinitbuf(Relation rel, BlockNumber blkno)
void _hash_relbuf(Relation rel, Buffer buf)
void _hash_pageinit(Page page, Size size)
Buffer _hash_getbuf(Relation rel, BlockNumber blkno, int access, int flags)
Buffer _hash_getbuf_with_strategy(Relation rel, BlockNumber blkno, int access, int flags, BufferAccessStrategy bstrategy)
Buffer _hash_getnewbuf(Relation rel, BlockNumber blkno, ForkNumber forkNum)
uint32 _hash_get_totalbuckets(uint32 splitpoint_phase)
void _hash_checkpage(Relation rel, Buffer buf, int flags)
IndexTuple CopyIndexTuple(IndexTuple source)
#define ItemIdIsDead(itemId)
IndexTupleData * IndexTuple
#define IndexTupleSize(itup)
#define MaxIndexTuplesPerPage
void pfree(void *pointer)
#define START_CRIT_SECTION()
#define END_CRIT_SECTION()
#define OffsetNumberNext(offsetNumber)
#define FirstOffsetNumber
#define RelationGetRelationName(relation)
#define RelationNeedsWAL(relation)
BlockNumber hashm_mapp[HASH_MAX_BITMAPS]
uint32 hashm_spares[HASH_MAX_SPLITPOINTS]
BlockNumber hasho_nextblkno
BlockNumber hasho_prevblkno
bool is_prim_bucket_same_wrt
bool is_prim_bucket_same_wrt
bool is_prev_bucket_same_wrt
Datum bit(PG_FUNCTION_ARGS)
void XLogRegisterBufData(uint8 block_id, const char *data, uint32 len)
XLogRecPtr XLogInsert(RmgrId rmid, uint8 info)
void XLogRegisterData(const char *data, uint32 len)
void XLogRegisterBuffer(uint8 block_id, Buffer buffer, uint8 flags)
void XLogBeginInsert(void)
void XLogEnsureRecordSpace(int max_block_id, int ndatas)