PostgreSQL Source Code
git master
|
#include "postgres.h"
#include "access/amapi.h"
#include "access/generic_xlog.h"
#include "access/reloptions.h"
#include "bloom.h"
#include "catalog/index.h"
#include "commands/vacuum.h"
#include "miscadmin.h"
#include "storage/bufmgr.h"
#include "storage/freespace.h"
#include "storage/indexfsm.h"
#include "storage/lmgr.h"
#include "utils/memutils.h"
Go to the source code of this file.
Macros | |
#define | GETWORD(x, i) ( *( (BloomSignatureWord *)(x) + ( (i) / SIGNWORDBITS ) ) ) |
#define | CLRBIT(x, i) GETWORD(x,i) &= ~( 0x01 << ( (i) % SIGNWORDBITS ) ) |
#define | SETBIT(x, i) GETWORD(x,i) |= ( 0x01 << ( (i) % SIGNWORDBITS ) ) |
#define | GETBIT(x, i) ( (GETWORD(x,i) >> ( (i) % SIGNWORDBITS )) & 0x01 ) |
Functions | |
PG_FUNCTION_INFO_V1 (blhandler) | |
static int32 | myRand (void) |
static void | mySrand (uint32 seed) |
void | _PG_init (void) |
static BloomOptions * | makeDefaultBloomOptions (void) |
Datum | blhandler (PG_FUNCTION_ARGS) |
void | initBloomState (BloomState *state, Relation index) |
void | signValue (BloomState *state, BloomSignatureWord *sign, Datum value, int attno) |
BloomTuple * | BloomFormTuple (BloomState *state, ItemPointer iptr, Datum *values, bool *isnull) |
bool | BloomPageAddItem (BloomState *state, Page page, BloomTuple *tuple) |
Buffer | BloomNewBuffer (Relation index) |
void | BloomInitPage (Page page, uint16 flags) |
void | BloomFillMetapage (Relation index, Page metaPage) |
void | BloomInitMetapage (Relation index) |
bytea * | bloptions (Datum reloptions, bool validate) |
Variables | |
static relopt_kind | bl_relopt_kind |
static relopt_parse_elt | bl_relopt_tab [INDEX_MAX_KEYS+1] |
static int32 | next |
Definition at line 31 of file blutils.c.
Referenced by _hash_freeovflpage(), and hash_xlog_squeeze_page().
#define GETBIT | ( | x, | |
i | |||
) | ( (GETWORD(x,i) >> ( (i) % SIGNWORDBITS )) & 0x01 ) |
Definition at line 33 of file blutils.c.
Referenced by _intbig_contains(), _intbig_overlap(), checkcondition_bit(), cnt_sml_sign_common(), gist_qe(), gist_te(), and gtrgm_consistent().
#define GETWORD | ( | x, | |
i | |||
) | ( *( (BloomSignatureWord *)(x) + ( (i) / SIGNWORDBITS ) ) ) |
Definition at line 32 of file blutils.c.
Referenced by _hash_addovflpage(), hash_xlog_add_ovfl_page(), makesign(), and signValue().
void _PG_init | ( | void | ) |
Definition at line 52 of file blutils.c.
References AccessExclusiveLock, add_int_reloption(), add_reloption_kind(), bl_relopt_kind, buf, DEFAULT_BLOOM_BITS, DEFAULT_BLOOM_LENGTH, i, INDEX_MAX_KEYS, MAX_BLOOM_BITS, MAX_BLOOM_LENGTH, MemoryContextStrdup(), relopt_parse_elt::offset, offsetof, relopt_parse_elt::optname, relopt_parse_elt::opttype, RELOPT_TYPE_INT, snprintf, and TopMemoryContext.
Datum blhandler | ( | PG_FUNCTION_ARGS | ) |
Definition at line 106 of file blutils.c.
References IndexAmRoutine::amadjustmembers, IndexAmRoutine::ambeginscan, IndexAmRoutine::ambuild, IndexAmRoutine::ambuildempty, IndexAmRoutine::ambuildphasename, IndexAmRoutine::ambulkdelete, IndexAmRoutine::amcanbackward, IndexAmRoutine::amcaninclude, IndexAmRoutine::amcanmulticol, IndexAmRoutine::amcanorder, IndexAmRoutine::amcanorderbyop, IndexAmRoutine::amcanparallel, IndexAmRoutine::amcanreturn, IndexAmRoutine::amcanunique, IndexAmRoutine::amclusterable, IndexAmRoutine::amcostestimate, IndexAmRoutine::amendscan, IndexAmRoutine::amestimateparallelscan, IndexAmRoutine::amgetbitmap, IndexAmRoutine::amgettuple, IndexAmRoutine::aminitparallelscan, IndexAmRoutine::aminsert, IndexAmRoutine::amkeytype, IndexAmRoutine::ammarkpos, IndexAmRoutine::amoptionalkey, IndexAmRoutine::amoptions, IndexAmRoutine::amoptsprocnum, IndexAmRoutine::amparallelrescan, IndexAmRoutine::amparallelvacuumoptions, IndexAmRoutine::ampredlocks, IndexAmRoutine::amproperty, IndexAmRoutine::amrescan, IndexAmRoutine::amrestrpos, IndexAmRoutine::amsearcharray, IndexAmRoutine::amsearchnulls, IndexAmRoutine::amstorage, IndexAmRoutine::amstrategies, IndexAmRoutine::amsupport, IndexAmRoutine::amusemaintenanceworkmem, IndexAmRoutine::amvacuumcleanup, IndexAmRoutine::amvalidate, blbeginscan(), blbuild(), blbuildempty(), blbulkdelete(), blcostestimate(), blendscan(), blgetbitmap(), blinsert(), BLOOM_NPROC, BLOOM_NSTRATEGIES, BLOOM_OPTIONS_PROC, bloptions(), blrescan(), blvacuumcleanup(), blvalidate(), InvalidOid, makeNode, PG_RETURN_POINTER, VACUUM_OPTION_PARALLEL_BULKDEL, and VACUUM_OPTION_PARALLEL_CLEANUP.
Definition at line 423 of file blutils.c.
References Assert, BLOOM_MAGICK_NUMBER, BLOOM_META, BloomInitPage(), BloomPageGetMeta, BloomMetaPageData::magickNumber, makeDefaultBloomOptions(), BloomMetaPageData::opts, and RelationData::rd_options.
Referenced by blbuildempty(), and BloomInitMetapage().
BloomTuple* BloomFormTuple | ( | BloomState * | state, |
ItemPointer | iptr, | ||
Datum * | values, | ||
bool * | isnull | ||
) |
Definition at line 293 of file blutils.c.
References BloomTuple::heapPtr, i, BloomState::nColumns, palloc0(), BloomTuple::sign, signValue(), and BloomState::sizeOfBloomTuple.
Referenced by blinsert(), and bloomBuildCallback().
void BloomInitMetapage | ( | Relation | index | ) |
Definition at line 455 of file blutils.c.
References Assert, BLOOM_METAPAGE_BLKNO, BloomFillMetapage(), BloomNewBuffer(), BufferGetBlockNumber(), GENERIC_XLOG_FULL_IMAGE, GenericXLogFinish(), GenericXLogRegisterBuffer(), GenericXLogStart(), and UnlockReleaseBuffer().
Referenced by blbuild().
Definition at line 407 of file blutils.c.
References BloomPageOpaqueData::bloom_page_id, BLOOM_PAGE_ID, BloomPageGetOpaque, BloomPageOpaqueData::flags, and PageInit().
Referenced by blinsert(), BloomFillMetapage(), and initCachedPage().
Definition at line 353 of file blutils.c.
References BloomPageIsDeleted, BUFFER_LOCK_EXCLUSIVE, BUFFER_LOCK_UNLOCK, BufferGetPage, ConditionalLockBuffer(), ExclusiveLock, GetFreeIndexPage(), InvalidBlockNumber, LockBuffer(), LockRelationForExtension(), P_NEW, PageIsNew, ReadBuffer(), RELATION_IS_LOCAL, ReleaseBuffer(), and UnlockRelationForExtension().
Referenced by blinsert(), BloomInitMetapage(), and flushCachedPage().
bool BloomPageAddItem | ( | BloomState * | state, |
Page | page, | ||
BloomTuple * | tuple | ||
) |
Definition at line 318 of file blutils.c.
References Assert, BloomPageGetFreeSpace, BloomPageGetOpaque, BloomPageGetTuple, BloomPageIsDeleted, BloomPageOpaqueData::maxoff, PageIsNew, and BloomState::sizeOfBloomTuple.
Referenced by blinsert(), and bloomBuildCallback().
Definition at line 482 of file blutils.c.
References bl_relopt_kind, bl_relopt_tab, BloomOptions::bloomLength, build_reloptions(), lengthof, and SIGNWORDBITS.
Referenced by blhandler().
void initBloomState | ( | BloomState * | state, |
Relation | index | ||
) |
Definition at line 161 of file blutils.c.
References BLOOM_HASH_PROC, BLOOM_MAGICK_NUMBER, BLOOM_METAPAGE_BLKNO, BloomOptions::bloomLength, BloomPageGetMeta, BloomPageIsMeta, BLOOMTUPLEHDRSZ, BUFFER_LOCK_SHARE, BufferGetPage, BloomState::collations, CurrentMemoryContext, elog, ERROR, fmgr_info_copy(), BloomState::hashFn, i, index_getprocinfo(), LockBuffer(), BloomMetaPageData::magickNumber, MemoryContextAlloc(), TupleDescData::natts, BloomState::nColumns, BloomMetaPageData::opts, BloomState::opts, RelationData::rd_amcache, RelationData::rd_att, RelationData::rd_indcollation, RelationData::rd_indexcxt, ReadBuffer(), BloomState::sizeOfBloomTuple, and UnlockReleaseBuffer().
Referenced by blbeginscan(), blbuild(), blbulkdelete(), and blinsert().
|
static |
Definition at line 87 of file blutils.c.
References BloomOptions::bitSize, BloomOptions::bloomLength, DEFAULT_BLOOM_BITS, DEFAULT_BLOOM_LENGTH, i, INDEX_MAX_KEYS, palloc0(), SET_VARSIZE, and SIGNWORDBITS.
Referenced by BloomFillMetapage().
|
static |
|
static |
PG_FUNCTION_INFO_V1 | ( | blhandler | ) |
void signValue | ( | BloomState * | state, |
BloomSignatureWord * | sign, | ||
Datum | value, | ||
int | attno | ||
) |
Definition at line 260 of file blutils.c.
References BloomOptions::bitSize, BloomOptions::bloomLength, BloomState::collations, DatumGetInt32, FunctionCall1Coll(), BloomState::hashFn, myRand(), mySrand(), BloomState::opts, SETBIT, and SIGNWORDBITS.
Referenced by blgetbitmap(), and BloomFormTuple().
|
static |
Definition at line 38 of file blutils.c.
Referenced by _PG_init(), and bloptions().
|
static |
Definition at line 41 of file blutils.c.
Referenced by bloptions().
|
static |
Definition at line 219 of file blutils.c.
Referenced by addItemsToLeaf(), AllocSetDelete(), AllocSetReset(), appendBoolResult(), AtEOSubXact_SPI(), AtSubAbort_Snapshot(), deallocate_one(), do_setval(), dsa_trim(), ecpg_register_prepared_stmt(), ECPGconnect(), ECPGdeallocate_desc(), ExecHashTableDetachBatch(), ExecParallelHashNextTuple(), executeKeyValueMethod(), executeNumericItemMethod(), extract_jsp_path_expr_nodes(), find_struct(), find_struct_member(), find_variable(), flattenJsonPathParseItem(), get_best_segment(), get_source_line(), get_typedef(), getNextFlagFromString(), GinDataLeafPageGetItems(), heap_lock_updated_tuple_rec(), infer_arbiter_indexes(), IssuePendingWritebacks(), LagTrackerRead(), main(), make_new_segment(), merge_children(), myRand(), mySrand(), nextval_internal(), pg_event_trigger_dropped_objects(), PLySequence_ToArray(), prepare_common(), pushf_create(), ReorderBufferIterTXNNext(), replace_auto_config_value(), setCompoundAffixFlagValue(), setval3_oid(), setval_oid(), simple_oid_list_destroy(), simple_string_list_destroy(), SPI_freetuptable(), unicode_normalize(), unlink_segment(), and unlink_span().