66 if (++
so->currPos.itemIndex >
so->currPos.lastItem)
68 if (
so->numKilled > 0)
71 blkno =
so->currPos.nextPage;
84 if (--
so->currPos.itemIndex <
so->currPos.firstItem)
86 if (
so->numKilled > 0)
89 blkno =
so->currPos.prevPage;
100 if (
buf ==
so->hashso_bucket_buf ||
101 buf ==
so->hashso_split_bucket_buf)
140 blkno = (*opaquep)->hasho_nextblkno;
146 if (*
bufp ==
so->hashso_bucket_buf || *
bufp ==
so->hashso_split_bucket_buf)
159 else if (
so->hashso_buc_populated && !
so->hashso_buc_split)
165 *
bufp =
so->hashso_split_bucket_buf;
180 so->hashso_buc_split =
true;
206 blkno = (*opaquep)->hasho_prevblkno;
212 if (*
bufp ==
so->hashso_bucket_buf || *
bufp ==
so->hashso_split_bucket_buf)
239 if (*
bufp ==
so->hashso_bucket_buf || *
bufp ==
so->hashso_split_bucket_buf)
242 else if (
so->hashso_buc_populated &&
so->hashso_buc_split)
248 *
bufp =
so->hashso_bucket_buf;
268 so->hashso_buc_split =
false;
314 errmsg(
"hash indexes do not support whole-index scans")));
356 so->hashso_bucket_buf =
buf;
402 so->hashso_buc_populated =
true;
418 (
so->hashso_buc_populated && !
so->hashso_buc_split))
424 so->currPos.buf =
buf;
465 so->currPos.buf =
buf;
487 if (
so->numKilled > 0)
494 if (
so->currPos.buf ==
so->hashso_bucket_buf ||
495 so->currPos.buf ==
so->hashso_split_bucket_buf)
503 so->currPos.buf =
buf;
518 so->currPos.buf =
buf;
523 so->currPos.firstItem = 0;
524 so->currPos.lastItem = itemIndex - 1;
525 so->currPos.itemIndex = 0;
546 if (
so->numKilled > 0)
549 if (
so->currPos.buf ==
so->hashso_bucket_buf ||
550 so->currPos.buf ==
so->hashso_split_bucket_buf)
556 so->currPos.buf =
buf;
571 so->currPos.buf =
buf;
576 so->currPos.firstItem = itemIndex;
581 if (
so->currPos.buf ==
so->hashso_bucket_buf ||
582 so->currPos.buf ==
so->hashso_split_bucket_buf)
596 Assert(
so->currPos.firstItem <=
so->currPos.lastItem);
620 while (offnum <= maxoff)
630 if ((
so->hashso_buc_populated && !
so->hashso_buc_split &&
676 if ((
so->hashso_buc_populated && !
so->hashso_buc_split &&
#define InvalidBlockNumber
static bool BlockNumberIsValid(BlockNumber blockNumber)
#define BufferIsInvalid(buffer)
BlockNumber BufferGetBlockNumber(Buffer buffer)
static Page BufferGetPage(Buffer buffer)
static void LockBuffer(Buffer buffer, BufferLockMode mode)
static bool BufferIsValid(Buffer bufnum)
static ItemId PageGetItemId(Page page, OffsetNumber offsetNumber)
static void * PageGetItem(PageData *page, const ItemIdData *itemId)
static OffsetNumber PageGetMaxOffsetNumber(const PageData *page)
#define Assert(condition)
int errcode(int sqlerrcode)
int errmsg(const char *fmt,...)
#define ereport(elevel,...)
#define HashPageGetOpaque(page)
#define HashScanPosInvalidate(scanpos)
#define H_BUCKET_BEING_POPULATED(opaque)
#define INDEX_MOVED_BY_SPLIT_MASK
HashScanOpaqueData * HashScanOpaque
void _hash_relbuf(Relation rel, Buffer buf)
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)
Buffer _hash_getbucketbuf_from_hashkey(Relation rel, uint32 hashkey, int access, HashMetaPage *cachedmetap)
bool _hash_first(IndexScanDesc scan, ScanDirection dir)
static void _hash_saveitem(HashScanOpaque so, int itemIndex, OffsetNumber offnum, IndexTuple itup)
static void _hash_readnext(IndexScanDesc scan, Buffer *bufp, Page *pagep, HashPageOpaque *opaquep)
bool _hash_next(IndexScanDesc scan, ScanDirection dir)
static bool _hash_readpage(IndexScanDesc scan, Buffer *bufP, ScanDirection dir)
static void _hash_readprev(IndexScanDesc scan, Buffer *bufp, Page *pagep, HashPageOpaque *opaquep)
static int _hash_load_qualified_items(IndexScanDesc scan, Page page, OffsetNumber offnum, ScanDirection dir)
uint32 _hash_get_indextuple_hashkey(IndexTuple itup)
bool _hash_checkqual(IndexScanDesc scan, IndexTuple itup)
OffsetNumber _hash_binsearch(Page page, uint32 hash_value)
uint32 _hash_datum2hashkey(Relation rel, Datum key)
OffsetNumber _hash_binsearch_last(Page page, uint32 hash_value)
void _hash_checkpage(Relation rel, Buffer buf, int flags)
BlockNumber _hash_get_oldblock_from_newbucket(Relation rel, Bucket new_bucket)
uint32 _hash_datum2hashkey_type(Relation rel, Datum key, Oid keytype)
void _hash_kill_items(IndexScanDesc scan)
#define ItemIdIsDead(itemId)
IndexTupleData * IndexTuple
#define MaxIndexTuplesPerPage
#define CHECK_FOR_INTERRUPTS()
#define OffsetNumberNext(offsetNumber)
#define FirstOffsetNumber
#define OffsetNumberPrev(offsetNumber)
static char buf[DEFAULT_XLOG_SEG_SIZE]
#define pgstat_count_index_scan(rel)
void PredicateLockPage(Relation relation, BlockNumber blkno, Snapshot snapshot)
#define ScanDirectionIsForward(direction)
#define ScanDirectionIsBackward(direction)
#define HTEqualStrategyNumber
BlockNumber hasho_nextblkno
BlockNumber hasho_prevblkno
struct ScanKeyData * keyData
bool ignore_killed_tuples
struct IndexScanInstrumentation * instrument
ItemPointerData xs_heaptid
struct SnapshotData * xs_snapshot