PostgreSQL Source Code git master
|
#include "access/amapi.h"
#include "access/generic_xlog.h"
#include "access/itup.h"
#include "access/xlog.h"
#include "fmgr.h"
#include "nodes/pathnodes.h"
Go to the source code of this file.
Data Structures | |
struct | BloomPageOpaqueData |
struct | BloomOptions |
struct | BloomMetaPageData |
struct | BloomState |
struct | BloomTuple |
struct | BloomScanOpaqueData |
Typedefs | |
typedef struct BloomPageOpaqueData | BloomPageOpaqueData |
typedef BloomPageOpaqueData * | BloomPageOpaque |
typedef uint16 | BloomSignatureWord |
typedef struct BloomOptions | BloomOptions |
typedef BlockNumber | FreeBlockNumberArray[MAXALIGN_DOWN(BLCKSZ - SizeOfPageHeaderData - MAXALIGN(sizeof(BloomPageOpaqueData)) - MAXALIGN(sizeof(uint16) *2+sizeof(uint32)+sizeof(BloomOptions)))/sizeof(BlockNumber)] |
typedef struct BloomMetaPageData | BloomMetaPageData |
typedef struct BloomState | BloomState |
typedef struct BloomTuple | BloomTuple |
typedef struct BloomScanOpaqueData | BloomScanOpaqueData |
typedef BloomScanOpaqueData * | BloomScanOpaque |
#define BloomMetaBlockN (sizeof(FreeBlockNumberArray) / sizeof(BlockNumber)) |
#define BloomPageGetData | ( | page | ) | ((BloomTuple *)PageGetContents(page)) |
#define BloomPageGetFreeSpace | ( | state, | |
page | |||
) |
#define BloomPageGetMaxOffset | ( | page | ) | (BloomPageGetOpaque(page)->maxoff) |
#define BloomPageGetMeta | ( | page | ) | ((BloomMetaPageData *) PageGetContents(page)) |
#define BloomPageGetNextTuple | ( | state, | |
tuple | |||
) | ((BloomTuple *)((Pointer)(tuple) + (state)->sizeOfBloomTuple)) |
#define BloomPageGetOpaque | ( | page | ) | ((BloomPageOpaque) PageGetSpecialPointer(page)) |
#define BloomPageGetTuple | ( | state, | |
page, | |||
offset | |||
) |
#define BloomPageIsDeleted | ( | page | ) | ((BloomPageGetOpaque(page)->flags & BLOOM_DELETED) != 0) |
#define BloomPageIsMeta | ( | page | ) | ((BloomPageGetOpaque(page)->flags & BLOOM_META) != 0) |
#define BloomPageSetDeleted | ( | page | ) | (BloomPageGetOpaque(page)->flags |= BLOOM_DELETED) |
#define BloomPageSetNonDeleted | ( | page | ) | (BloomPageGetOpaque(page)->flags &= ~BLOOM_DELETED) |
#define BLOOMTUPLEHDRSZ offsetof(BloomTuple, sign) |
#define DEFAULT_BLOOM_LENGTH (5 * SIGNWORDBITS) |
#define MAX_BLOOM_BITS (MAX_BLOOM_LENGTH - 1) |
#define MAX_BLOOM_LENGTH (256 * SIGNWORDBITS) |
#define SIGNWORDBITS ((int) (BITS_PER_BYTE * sizeof(BloomSignatureWord))) |
typedef struct BloomMetaPageData BloomMetaPageData |
typedef struct BloomOptions BloomOptions |
typedef BloomPageOpaqueData* BloomPageOpaque |
typedef struct BloomPageOpaqueData BloomPageOpaqueData |
typedef BloomScanOpaqueData* BloomScanOpaque |
typedef struct BloomScanOpaqueData BloomScanOpaqueData |
typedef uint16 BloomSignatureWord |
typedef struct BloomState BloomState |
typedef struct BloomTuple BloomTuple |
typedef BlockNumber FreeBlockNumberArray[MAXALIGN_DOWN(BLCKSZ - SizeOfPageHeaderData - MAXALIGN(sizeof(BloomPageOpaqueData)) - MAXALIGN(sizeof(uint16) *2+sizeof(uint32)+sizeof(BloomOptions)))/sizeof(BlockNumber)] |
IndexScanDesc blbeginscan | ( | Relation | r, |
int | nkeys, | ||
int | norderbys | ||
) |
Definition at line 25 of file blscan.c.
References IndexScanDescData::indexRelation, initBloomState(), IndexScanDescData::opaque, palloc(), RelationGetIndexScan(), BloomScanOpaqueData::sign, and BloomScanOpaqueData::state.
Referenced by blhandler().
IndexBuildResult * blbuild | ( | Relation | heap, |
Relation | index, | ||
struct IndexInfo * | indexInfo | ||
) |
Definition at line 119 of file blinsert.c.
References ALLOCSET_DEFAULT_SIZES, AllocSetContextCreate, bloomBuildCallback(), BloomInitMetapage(), BloomBuildState::blstate, BloomBuildState::count, CurrentMemoryContext, elog, ERROR, flushCachedPage(), IndexBuildResult::heap_tuples, IndexBuildResult::index_tuples, BloomBuildState::indtuples, initBloomState(), initCachedPage(), MAIN_FORKNUM, MemoryContextDelete(), palloc(), RelationGetNumberOfBlocks, RelationGetRelationName, table_index_build_scan(), and BloomBuildState::tmpCtx.
Referenced by blhandler().
void blbuildempty | ( | Relation | index | ) |
Definition at line 162 of file blinsert.c.
References BloomInitMetapage(), and INIT_FORKNUM.
Referenced by blhandler().
IndexBulkDeleteResult * blbulkdelete | ( | IndexVacuumInfo * | info, |
IndexBulkDeleteResult * | stats, | ||
IndexBulkDeleteCallback | callback, | ||
void * | callback_state | ||
) |
Definition at line 30 of file blvacuum.c.
References Assert, BLOOM_HEAD_BLKNO, BLOOM_METAPAGE_BLKNO, BloomMetaBlockN, BloomPageGetFreeSpace, BloomPageGetMaxOffset, BloomPageGetMeta, BloomPageGetNextTuple, BloomPageGetOpaque, BloomPageGetTuple, BloomPageIsDeleted, BloomPageSetDeleted, BUFFER_LOCK_EXCLUSIVE, callback(), FirstOffsetNumber, GenericXLogAbort(), GenericXLogFinish(), GenericXLogRegisterBuffer(), GenericXLogStart(), BloomTuple::heapPtr, IndexVacuumInfo::index, initBloomState(), LockBuffer(), MAIN_FORKNUM, BloomMetaPageData::nEnd, BloomMetaPageData::notFullPage, BloomMetaPageData::nStart, OffsetNumberNext, PageIsNew(), palloc0(), RBM_NORMAL, ReadBuffer(), ReadBufferExtended(), RelationGetNumberOfBlocks, IndexVacuumInfo::strategy, IndexBulkDeleteResult::tuples_removed, UnlockReleaseBuffer(), and vacuum_delay_point().
Referenced by blhandler().
void blcostestimate | ( | PlannerInfo * | root, |
IndexPath * | path, | ||
double | loop_count, | ||
Cost * | indexStartupCost, | ||
Cost * | indexTotalCost, | ||
Selectivity * | indexSelectivity, | ||
double * | indexCorrelation, | ||
double * | indexPages | ||
) |
Definition at line 22 of file blcost.c.
References genericcostestimate(), GenericCosts::indexCorrelation, IndexPath::indexinfo, GenericCosts::indexSelectivity, GenericCosts::indexStartupCost, GenericCosts::indexTotalCost, GenericCosts::numIndexPages, GenericCosts::numIndexTuples, and root.
Referenced by blhandler().
void blendscan | ( | IndexScanDesc | scan | ) |
Definition at line 62 of file blscan.c.
References if(), IndexScanDescData::opaque, pfree(), and BloomScanOpaqueData::sign.
Referenced by blhandler().
int64 blgetbitmap | ( | IndexScanDesc | scan, |
TIDBitmap * | tbm | ||
) |
Definition at line 75 of file blscan.c.
References BAS_BULKREAD, BLOOM_HEAD_BLKNO, BloomOptions::bloomLength, BloomPageGetMaxOffset, BloomPageGetTuple, BloomPageIsDeleted, BUFFER_LOCK_SHARE, BufferGetPage(), CHECK_FOR_INTERRUPTS, FreeAccessStrategy(), GetAccessStrategy(), BloomTuple::heapPtr, i, if(), IndexScanDescData::indexRelation, IndexScanDescData::keyData, LockBuffer(), MAIN_FORKNUM, IndexScanDescData::numberOfKeys, IndexScanDescData::opaque, BloomState::opts, PageIsNew(), palloc0(), pfree(), pgstat_count_index_scan, RBM_NORMAL, ReadBufferExtended(), RelationGetNumberOfBlocks, res, BloomTuple::sign, BloomScanOpaqueData::sign, signValue(), ScanKeyData::sk_argument, ScanKeyData::sk_attno, ScanKeyData::sk_flags, SK_ISNULL, BloomScanOpaqueData::state, tbm_add_tuples(), and UnlockReleaseBuffer().
Referenced by blhandler().
bool blinsert | ( | Relation | index, |
Datum * | values, | ||
bool * | isnull, | ||
ItemPointer | ht_ctid, | ||
Relation | heapRel, | ||
IndexUniqueCheck | checkUnique, | ||
bool | indexUnchanged, | ||
struct IndexInfo * | indexInfo | ||
) |
Definition at line 172 of file blinsert.c.
References ALLOCSET_DEFAULT_SIZES, AllocSetContextCreate, Assert, BLOOM_METAPAGE_BLKNO, BloomFormTuple(), BloomInitPage(), BloomNewBuffer(), BloomPageAddItem(), BloomPageGetMeta, BloomPageIsDeleted, BUFFER_LOCK_EXCLUSIVE, BUFFER_LOCK_SHARE, BUFFER_LOCK_UNLOCK, BufferGetBlockNumber(), BufferGetPage(), CurrentMemoryContext, elog, ERROR, GENERIC_XLOG_FULL_IMAGE, GenericXLogAbort(), GenericXLogFinish(), GenericXLogRegisterBuffer(), GenericXLogStart(), initBloomState(), InvalidBlockNumber, LockBuffer(), MemoryContextDelete(), MemoryContextSwitchTo(), BloomMetaPageData::nEnd, BloomMetaPageData::notFullPage, BloomMetaPageData::nStart, PageIsNew(), ReadBuffer(), ReleaseBuffer(), UnlockReleaseBuffer(), and values.
Referenced by blhandler().
Definition at line 416 of file blutils.c.
References Assert, BLOOM_MAGICK_NUMBER, BLOOM_META, BloomInitPage(), BloomPageGetMeta, if(), BloomMetaPageData::magickNumber, makeDefaultBloomOptions(), BloomMetaPageData::opts, and opts.
Referenced by BloomInitMetapage().
BloomTuple * BloomFormTuple | ( | BloomState * | state, |
ItemPointer | iptr, | ||
Datum * | values, | ||
bool * | isnull | ||
) |
Definition at line 295 of file blutils.c.
References i, palloc0(), res, signValue(), and values.
Referenced by blinsert(), and bloomBuildCallback().
void BloomInitMetapage | ( | Relation | index, |
ForkNumber | forknum | ||
) |
Definition at line 448 of file blutils.c.
References Assert, BLOOM_METAPAGE_BLKNO, BloomFillMetapage(), BUFFER_LOCK_EXCLUSIVE, BufferGetBlockNumber(), GENERIC_XLOG_FULL_IMAGE, GenericXLogFinish(), GenericXLogRegisterBuffer(), GenericXLogStart(), LockBuffer(), P_NEW, RBM_NORMAL, ReadBufferExtended(), and UnlockReleaseBuffer().
Referenced by blbuild(), and blbuildempty().
Definition at line 401 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 355 of file blutils.c.
References BloomPageIsDeleted, BMR_REL, BUFFER_LOCK_UNLOCK, BufferGetPage(), ConditionalLockBuffer(), EB_LOCK_FIRST, ExtendBufferedRel(), GetFreeIndexPage(), InvalidBlockNumber, LockBuffer(), MAIN_FORKNUM, PageIsNew(), ReadBuffer(), and ReleaseBuffer().
Referenced by blinsert(), and flushCachedPage().
bool BloomPageAddItem | ( | BloomState * | state, |
Page | page, | ||
BloomTuple * | tuple | ||
) |
Definition at line 320 of file blutils.c.
References Assert, BloomPageGetFreeSpace, BloomPageGetOpaque, BloomPageGetTuple, BloomPageIsDeleted, BloomPageOpaqueData::maxoff, and PageIsNew().
Referenced by blinsert(), and bloomBuildCallback().
Definition at line 477 of file blutils.c.
References bl_relopt_kind, bl_relopt_tab, BloomOptions::bloomLength, build_reloptions(), lengthof, and SIGNWORDBITS.
Referenced by blhandler().
void blrescan | ( | IndexScanDesc | scan, |
ScanKey | scankey, | ||
int | nscankeys, | ||
ScanKey | orderbys, | ||
int | norderbys | ||
) |
Definition at line 45 of file blscan.c.
References if(), IndexScanDescData::keyData, IndexScanDescData::numberOfKeys, IndexScanDescData::opaque, pfree(), and BloomScanOpaqueData::sign.
Referenced by blhandler().
IndexBulkDeleteResult * blvacuumcleanup | ( | IndexVacuumInfo * | info, |
IndexBulkDeleteResult * | stats | ||
) |
Definition at line 165 of file blvacuum.c.
References IndexVacuumInfo::analyze_only, BLOOM_HEAD_BLKNO, BloomPageGetMaxOffset, BloomPageIsDeleted, BUFFER_LOCK_SHARE, BufferGetPage(), IndexVacuumInfo::index, IndexFreeSpaceMapVacuum(), LockBuffer(), MAIN_FORKNUM, IndexBulkDeleteResult::num_index_tuples, IndexBulkDeleteResult::num_pages, PageIsNew(), IndexBulkDeleteResult::pages_free, palloc0(), RBM_NORMAL, ReadBufferExtended(), RecordFreeIndexPage(), RelationGetNumberOfBlocks, IndexVacuumInfo::strategy, UnlockReleaseBuffer(), and vacuum_delay_point().
Referenced by blhandler().
bool blvalidate | ( | Oid | opclassoid | ) |
Definition at line 30 of file blvalidate.c.
References BLOOM_HASH_PROC, BLOOM_NPROC, BLOOM_NSTRATEGIES, BLOOM_OPTIONS_PROC, check_amop_signature(), check_amoptsproc_signature(), check_amproc_signature(), elog, ereport, errcode(), errmsg(), ERROR, format_operator(), format_procedure(), OpFamilyOpFuncGroup::functionset, get_opfamily_name(), GETSTRUCT(), HeapTupleIsValid, i, identify_opfamily_groups(), INFO, OpFamilyOpFuncGroup::lefttype, lfirst, catclist::members, catclist::n_members, NameStr, ObjectIdGetDatum(), OidIsValid, ReleaseCatCacheList(), ReleaseSysCache(), OpFamilyOpFuncGroup::righttype, SearchSysCache1(), SearchSysCacheList1, and catctup::tuple.
Referenced by blhandler().
void initBloomState | ( | BloomState * | state, |
Relation | index | ||
) |
Definition at line 163 of file blutils.c.
References BLOOM_HASH_PROC, BLOOM_MAGICK_NUMBER, BLOOM_METAPAGE_BLKNO, BloomPageGetMeta, BloomPageIsMeta, BLOOMTUPLEHDRSZ, BUFFER_LOCK_SHARE, BufferGetPage(), CurrentMemoryContext, elog, ERROR, fmgr_info_copy(), i, index_getprocinfo(), LockBuffer(), BloomMetaPageData::magickNumber, MemoryContextAlloc(), BloomMetaPageData::opts, opts, ReadBuffer(), and UnlockReleaseBuffer().
Referenced by blbeginscan(), blbuild(), blbulkdelete(), and blinsert().
void signValue | ( | BloomState * | state, |
BloomSignatureWord * | sign, | ||
Datum | value, | ||
int | attno | ||
) |
Definition at line 262 of file blutils.c.
References DatumGetInt32(), FunctionCall1Coll(), j, myRand(), mySrand(), SETBIT, sign, SIGNWORDBITS, and value.
Referenced by blgetbitmap(), and BloomFormTuple().