25 #define CALC_NEW_BUCKET(old_bucket, lowmask) \
26 old_bucket | (lowmask + 1)
45 while (scanKeySize > 0)
63 datum,
key->sk_argument);
114 elog(
ERROR,
"missing support function %d(%u,%u) for index \"%s\"",
131 bucket = hashkey & highmask;
132 if (bucket > maxbucket)
133 bucket = bucket & lowmask;
151 return splitpoint_group;
163 (((num_bucket - 1) >>
167 return splitpoint_phases;
179 uint32 phases_within_splitpoint_group;
182 return (1 << splitpoint_phase);
191 total_buckets = (1 << (splitpoint_group - 1));
194 phases_within_splitpoint_group =
199 phases_within_splitpoint_group);
201 return total_buckets;
223 (
errcode(ERRCODE_INDEX_CORRUPTED),
224 errmsg(
"index \"%s\" contains unexpected zero page at block %u",
227 errhint(
"Please REINDEX it.")));
234 (
errcode(ERRCODE_INDEX_CORRUPTED),
235 errmsg(
"index \"%s\" contains corrupted page at block %u",
238 errhint(
"Please REINDEX it.")));
246 (
errcode(ERRCODE_INDEX_CORRUPTED),
247 errmsg(
"index \"%s\" contains corrupted page at block %u",
250 errhint(
"Please REINDEX it.")));
262 (
errcode(ERRCODE_INDEX_CORRUPTED),
263 errmsg(
"index \"%s\" is not a hash index",
268 (
errcode(ERRCODE_INDEX_CORRUPTED),
269 errmsg(
"index \"%s\" has wrong hash version",
271 errhint(
"Please REINDEX it.")));
301 return *((
uint32 *) attp);
320 Datum *user_values,
bool *user_isnull,
321 Datum *index_values,
bool *index_isnull)
334 index_isnull[0] =
false;
371 if (hashkey < hash_value)
409 if (hashkey > hash_value)
440 old_bucket = new_bucket & mask;
501 if (new_bucket > maxbucket)
503 lowmask = lowmask >> 1;
549 bool killedsomething =
false;
550 bool havePin =
false;
580 for (
i = 0;
i < numKilled;
i++)
588 itemIndex <= so->currPos.lastItem);
590 while (offnum <= maxoff)
599 killedsomething =
true;
BlockNumber BufferGetBlockNumber(Buffer buffer)
void LockBuffer(Buffer buffer, int mode)
void MarkBufferDirtyHint(Buffer buffer, bool buffer_std)
#define BUFFER_LOCK_UNLOCK
#define BUFFER_LOCK_SHARE
static Page BufferGetPage(Buffer buffer)
static Item PageGetItem(Page page, ItemId itemId)
static ItemId PageGetItemId(Page page, OffsetNumber offsetNumber)
static bool PageIsNew(Page page)
static OffsetNumber PageGetMaxOffsetNumber(Page page)
static uint16 PageGetSpecialSize(Page page)
#define RegProcedureIsValid(p)
elog(ERROR, "%s: %s", p2, msg)
int errhint(const char *fmt,...)
int errcode(int sqlerrcode)
int errmsg(const char *fmt,...)
#define ereport(elevel,...)
Datum FunctionCall2Coll(FmgrInfo *flinfo, Oid collation, Datum arg1, Datum arg2)
Datum OidFunctionCall1Coll(Oid functionId, Oid collation, Datum arg1)
Datum FunctionCall1Coll(FmgrInfo *flinfo, Oid collation, Datum arg1)
#define HashPageGetOpaque(page)
#define HASHSTANDARD_PROC
#define HASH_SPLITPOINT_GROUPS_WITH_ONE_PHASE
#define HashScanPosIsPinned(scanpos)
#define HashPageGetMeta(page)
#define BUCKET_TO_BLKNO(metap, B)
#define HASH_SPLITPOINT_PHASE_MASK
HashScanOpaqueData * HashScanOpaque
#define HashScanPosIsValid(scanpos)
#define HASH_SPLITPOINT_PHASE_BITS
#define LH_PAGE_HAS_DEAD_TUPLES
void _hash_relbuf(Relation rel, Buffer buf)
Buffer _hash_getbuf(Relation rel, BlockNumber blkno, int access, int flags)
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)
bool _hash_checkqual(IndexScanDesc scan, IndexTuple itup)
OffsetNumber _hash_binsearch(Page page, uint32 hash_value)
uint32 _hash_datum2hashkey(Relation rel, Datum key)
Bucket _hash_hashkey2bucket(uint32 hashkey, uint32 maxbucket, uint32 highmask, uint32 lowmask)
OffsetNumber _hash_binsearch_last(Page page, uint32 hash_value)
void _hash_checkpage(Relation rel, Buffer buf, int flags)
Bucket _hash_get_newbucket_from_oldbucket(Relation rel, Bucket old_bucket, uint32 lowmask, uint32 maxbucket)
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)
bytea * hashoptions(Datum reloptions, bool validate)
#define CALC_NEW_BUCKET(old_bucket, lowmask)
bool _hash_convert_tuple(Relation index, Datum *user_values, bool *user_isnull, Datum *index_values, bool *index_isnull)
FmgrInfo * index_getprocinfo(Relation irel, AttrNumber attnum, uint16 procnum)
#define ItemIdMarkDead(itemId)
bool ItemPointerEquals(ItemPointer pointer1, ItemPointer pointer2)
IndexTupleData * IndexTuple
static Datum index_getattr(IndexTuple tup, int attnum, TupleDesc tupleDesc, bool *isnull)
static Size IndexInfoFindDataOffset(unsigned short t_info)
Assert(fmt[strlen(fmt) - 1] !='\n')
Oid get_opfamily_proc(Oid opfamily, Oid lefttype, Oid righttype, int16 procnum)
#define OffsetNumberIsValid(offsetNumber)
#define OffsetNumberNext(offsetNumber)
#define FirstOffsetNumber
Datum lower(PG_FUNCTION_ARGS)
Datum upper(PG_FUNCTION_ARGS)
static int pg_leftmost_one_pos32(uint32 word)
static uint32 pg_ceil_log2_32(uint32 num)
static uint32 DatumGetUInt32(Datum X)
static bool DatumGetBool(Datum X)
static Datum UInt32GetDatum(uint32 X)
#define RelationGetDescr(relation)
#define RelationGetRelationName(relation)
void * build_reloptions(Datum reloptions, bool validate, relopt_kind kind, Size relopt_struct_size, const relopt_parse_elt *relopt_elems, int num_relopt_elems)
HashScanPosItem items[MaxIndexTuplesPerPage]
struct ScanKeyData * keyData