PostgreSQL Source Code
git master
|
#include "access/amapi.h"
#include "access/itup.h"
#include "access/sdir.h"
#include "access/tableam.h"
#include "access/xlogreader.h"
#include "catalog/pg_am_d.h"
#include "catalog/pg_index.h"
#include "lib/stringinfo.h"
#include "storage/bufmgr.h"
#include "storage/shm_toc.h"
Go to the source code of this file.
Data Structures | |
struct | BTPageOpaqueData |
struct | BTMetaPageData |
struct | BTDeletedPageData |
struct | BTPendingFSM |
struct | BTVacState |
struct | BTStackData |
struct | BTScanInsertData |
struct | BTInsertStateData |
struct | BTDedupInterval |
struct | BTDedupStateData |
struct | BTVacuumPostingData |
struct | BTScanPosItem |
struct | BTScanPosData |
struct | BTArrayKeyInfo |
struct | BTScanOpaqueData |
struct | BTReadPageState |
struct | BTOptions |
Macros | |
#define | BTPageGetOpaque(page) ((BTPageOpaque) PageGetSpecialPointer(page)) |
#define | BTP_LEAF (1 << 0) /* leaf page, i.e. not internal page */ |
#define | BTP_ROOT (1 << 1) /* root page (has no parent) */ |
#define | BTP_DELETED (1 << 2) /* page has been deleted from tree */ |
#define | BTP_META (1 << 3) /* meta-page */ |
#define | BTP_HALF_DEAD (1 << 4) /* empty, but still in tree */ |
#define | BTP_SPLIT_END (1 << 5) /* rightmost page of split group */ |
#define | BTP_HAS_GARBAGE (1 << 6) /* page has LP_DEAD tuples (deprecated) */ |
#define | BTP_INCOMPLETE_SPLIT (1 << 7) /* right sibling's downlink is missing */ |
#define | BTP_HAS_FULLXID (1 << 8) /* contains BTDeletedPageData */ |
#define | MAX_BT_CYCLE_ID 0xFF7F |
#define | BTPageGetMeta(p) ((BTMetaPageData *) PageGetContents(p)) |
#define | BTREE_METAPAGE 0 /* first page is meta */ |
#define | BTREE_MAGIC 0x053162 /* magic number in metapage */ |
#define | BTREE_VERSION 4 /* current version number */ |
#define | BTREE_MIN_VERSION 2 /* minimum supported version */ |
#define | BTREE_NOVAC_VERSION 3 /* version with all meta fields set */ |
#define | BTMaxItemSize(page) |
#define | BTMaxItemSizeNoHeapTid(page) |
#define | MaxTIDsPerBTreePage |
#define | BTREE_MIN_FILLFACTOR 10 |
#define | BTREE_DEFAULT_FILLFACTOR 90 |
#define | BTREE_NONLEAF_FILLFACTOR 70 |
#define | BTREE_SINGLEVAL_FILLFACTOR 96 |
#define | P_NONE 0 |
#define | P_LEFTMOST(opaque) ((opaque)->btpo_prev == P_NONE) |
#define | P_RIGHTMOST(opaque) ((opaque)->btpo_next == P_NONE) |
#define | P_ISLEAF(opaque) (((opaque)->btpo_flags & BTP_LEAF) != 0) |
#define | P_ISROOT(opaque) (((opaque)->btpo_flags & BTP_ROOT) != 0) |
#define | P_ISDELETED(opaque) (((opaque)->btpo_flags & BTP_DELETED) != 0) |
#define | P_ISMETA(opaque) (((opaque)->btpo_flags & BTP_META) != 0) |
#define | P_ISHALFDEAD(opaque) (((opaque)->btpo_flags & BTP_HALF_DEAD) != 0) |
#define | P_IGNORE(opaque) (((opaque)->btpo_flags & (BTP_DELETED|BTP_HALF_DEAD)) != 0) |
#define | P_HAS_GARBAGE(opaque) (((opaque)->btpo_flags & BTP_HAS_GARBAGE) != 0) |
#define | P_INCOMPLETE_SPLIT(opaque) (((opaque)->btpo_flags & BTP_INCOMPLETE_SPLIT) != 0) |
#define | P_HAS_FULLXID(opaque) (((opaque)->btpo_flags & BTP_HAS_FULLXID) != 0) |
#define | P_HIKEY ((OffsetNumber) 1) |
#define | P_FIRSTKEY ((OffsetNumber) 2) |
#define | P_FIRSTDATAKEY(opaque) (P_RIGHTMOST(opaque) ? P_HIKEY : P_FIRSTKEY) |
#define | INDEX_ALT_TID_MASK INDEX_AM_RESERVED_BIT |
#define | BT_OFFSET_MASK 0x0FFF |
#define | BT_STATUS_OFFSET_MASK 0xF000 |
#define | BT_PIVOT_HEAP_TID_ATTR 0x1000 |
#define | BT_IS_POSTING 0x2000 |
#define | BTreeTupleGetNAtts(itup, rel) |
#define | BTCommuteStrategyNumber(strat) (BTMaxStrategyNumber + 1 - (strat)) |
#define | BTORDER_PROC 1 |
#define | BTSORTSUPPORT_PROC 2 |
#define | BTINRANGE_PROC 3 |
#define | BTEQUALIMAGE_PROC 4 |
#define | BTOPTIONS_PROC 5 |
#define | BTNProcs 5 |
#define | BT_READ BUFFER_LOCK_SHARE |
#define | BT_WRITE BUFFER_LOCK_EXCLUSIVE |
#define | BTScanPosIsPinned(scanpos) |
#define | BTScanPosUnpin(scanpos) |
#define | BTScanPosUnpinIfPinned(scanpos) |
#define | BTScanPosIsValid(scanpos) |
#define | BTScanPosInvalidate(scanpos) |
#define | SK_BT_REQFWD 0x00010000 /* required to continue forward scan */ |
#define | SK_BT_REQBKWD 0x00020000 /* required to continue backward scan */ |
#define | SK_BT_INDOPTION_SHIFT 24 /* must clear the above bits */ |
#define | SK_BT_DESC (INDOPTION_DESC << SK_BT_INDOPTION_SHIFT) |
#define | SK_BT_NULLS_FIRST (INDOPTION_NULLS_FIRST << SK_BT_INDOPTION_SHIFT) |
#define | BTGetFillFactor(relation) |
#define | BTGetTargetPageFreeSpace(relation) (BLCKSZ * (100 - BTGetFillFactor(relation)) / 100) |
#define | BTGetDeduplicateItems(relation) |
#define | PROGRESS_BTREE_PHASE_INDEXBUILD_TABLESCAN 2 |
#define | PROGRESS_BTREE_PHASE_PERFORMSORT_1 3 |
#define | PROGRESS_BTREE_PHASE_PERFORMSORT_2 4 |
#define | PROGRESS_BTREE_PHASE_LEAF_LOAD 5 |
#define BT_READ BUFFER_LOCK_SHARE |
#define BT_WRITE BUFFER_LOCK_EXCLUSIVE |
#define BTCommuteStrategyNumber | ( | strat | ) | (BTMaxStrategyNumber + 1 - (strat)) |
#define BTGetDeduplicateItems | ( | relation | ) |
#define BTGetFillFactor | ( | relation | ) |
#define BTGetTargetPageFreeSpace | ( | relation | ) | (BLCKSZ * (100 - BTGetFillFactor(relation)) / 100) |
#define BTMaxItemSize | ( | page | ) |
#define BTMaxItemSizeNoHeapTid | ( | page | ) |
#define BTP_DELETED (1 << 2) /* page has been deleted from tree */ |
#define BTP_HALF_DEAD (1 << 4) /* empty, but still in tree */ |
#define BTP_HAS_FULLXID (1 << 8) /* contains BTDeletedPageData */ |
#define BTP_HAS_GARBAGE (1 << 6) /* page has LP_DEAD tuples (deprecated) */ |
#define BTP_INCOMPLETE_SPLIT (1 << 7) /* right sibling's downlink is missing */ |
#define BTP_LEAF (1 << 0) /* leaf page, i.e. not internal page */ |
#define BTP_SPLIT_END (1 << 5) /* rightmost page of split group */ |
#define BTPageGetMeta | ( | p | ) | ((BTMetaPageData *) PageGetContents(p)) |
#define BTPageGetOpaque | ( | page | ) | ((BTPageOpaque) PageGetSpecialPointer(page)) |
#define BTREE_MAGIC 0x053162 /* magic number in metapage */ |
#define BTREE_MIN_VERSION 2 /* minimum supported version */ |
#define BTREE_NOVAC_VERSION 3 /* version with all meta fields set */ |
#define BTreeTupleGetNAtts | ( | itup, | |
rel | |||
) |
#define BTScanPosInvalidate | ( | scanpos | ) |
#define BTScanPosIsPinned | ( | scanpos | ) |
#define BTScanPosIsValid | ( | scanpos | ) |
#define BTScanPosUnpin | ( | scanpos | ) |
#define BTScanPosUnpinIfPinned | ( | scanpos | ) |
#define INDEX_ALT_TID_MASK INDEX_AM_RESERVED_BIT |
#define MaxTIDsPerBTreePage |
#define P_FIRSTDATAKEY | ( | opaque | ) | (P_RIGHTMOST(opaque) ? P_HIKEY : P_FIRSTKEY) |
#define P_FIRSTKEY ((OffsetNumber) 2) |
#define P_HAS_FULLXID | ( | opaque | ) | (((opaque)->btpo_flags & BTP_HAS_FULLXID) != 0) |
#define P_HAS_GARBAGE | ( | opaque | ) | (((opaque)->btpo_flags & BTP_HAS_GARBAGE) != 0) |
#define P_HIKEY ((OffsetNumber) 1) |
#define P_IGNORE | ( | opaque | ) | (((opaque)->btpo_flags & (BTP_DELETED|BTP_HALF_DEAD)) != 0) |
#define P_INCOMPLETE_SPLIT | ( | opaque | ) | (((opaque)->btpo_flags & BTP_INCOMPLETE_SPLIT) != 0) |
#define P_ISDELETED | ( | opaque | ) | (((opaque)->btpo_flags & BTP_DELETED) != 0) |
#define P_ISHALFDEAD | ( | opaque | ) | (((opaque)->btpo_flags & BTP_HALF_DEAD) != 0) |
#define P_ISLEAF | ( | opaque | ) | (((opaque)->btpo_flags & BTP_LEAF) != 0) |
#define P_ISMETA | ( | opaque | ) | (((opaque)->btpo_flags & BTP_META) != 0) |
#define P_ISROOT | ( | opaque | ) | (((opaque)->btpo_flags & BTP_ROOT) != 0) |
#define P_LEFTMOST | ( | opaque | ) | ((opaque)->btpo_prev == P_NONE) |
#define P_RIGHTMOST | ( | opaque | ) | ((opaque)->btpo_next == P_NONE) |
#define SK_BT_DESC (INDOPTION_DESC << SK_BT_INDOPTION_SHIFT) |
#define SK_BT_INDOPTION_SHIFT 24 /* must clear the above bits */ |
#define SK_BT_NULLS_FIRST (INDOPTION_NULLS_FIRST << SK_BT_INDOPTION_SHIFT) |
#define SK_BT_REQBKWD 0x00020000 /* required to continue backward scan */ |
#define SK_BT_REQFWD 0x00010000 /* required to continue forward scan */ |
typedef struct BTArrayKeyInfo BTArrayKeyInfo |
typedef struct BTDedupInterval BTDedupInterval |
typedef BTDedupStateData* BTDedupState |
typedef struct BTDedupStateData BTDedupStateData |
typedef struct BTDeletedPageData BTDeletedPageData |
typedef BTInsertStateData* BTInsertState |
typedef struct BTInsertStateData BTInsertStateData |
typedef struct BTMetaPageData BTMetaPageData |
typedef BTPageOpaqueData* BTPageOpaque |
typedef struct BTPageOpaqueData BTPageOpaqueData |
typedef struct BTPendingFSM BTPendingFSM |
typedef struct BTReadPageState BTReadPageState |
typedef BTScanInsertData* BTScanInsert |
typedef struct BTScanInsertData BTScanInsertData |
typedef BTScanOpaqueData* BTScanOpaque |
typedef struct BTScanOpaqueData BTScanOpaqueData |
typedef BTScanPosData* BTScanPos |
typedef struct BTScanPosData BTScanPosData |
typedef struct BTScanPosItem BTScanPosItem |
typedef BTStackData* BTStack |
typedef struct BTStackData BTStackData |
typedef struct BTVacState BTVacState |
typedef BTVacuumPostingData* BTVacuumPosting |
typedef struct BTVacuumPostingData BTVacuumPostingData |
Definition at line 5142 of file nbtutils.c.
References BTEQUALIMAGE_PROC, DatumGetBool(), DEBUG1, elog, get_opfamily_proc(), i, IndexRelationGetNumberOfAttributes, IndexRelationGetNumberOfKeyAttributes, ObjectIdGetDatum(), OidFunctionCall1Coll(), OidIsValid, RelationData::rd_indcollation, RelationData::rd_opcintype, RelationData::rd_opfamily, and RelationGetRelationName.
Referenced by _bt_leafbuild(), bt_index_check_internal(), and btbuildempty().
Definition at line 869 of file nbtpage.c.
References _bt_conditionallockbuf(), _bt_pageinit(), _bt_relbuf(), Assert, xl_btree_reuse_page::block, BMR_REL, BTPageGetDeleteXid(), BTPageIsRecyclable(), buf, BufferGetPage(), BufferGetPageSize(), DEBUG2, EB_LOCK_FIRST, elog, ExtendBufferedRel(), GetFreeIndexPage(), InvalidBlockNumber, xl_btree_reuse_page::isCatalogRel, xl_btree_reuse_page::locator, MAIN_FORKNUM, PageIsNew(), RelationData::rd_locator, ReadBuffer(), RelationIsAccessibleInLogicalDecoding, RelationNeedsWAL, RelationUsesLocalBuffers, ReleaseBuffer(), SizeOfBtreeReusePage, xl_btree_reuse_page::snapshotConflictHorizon, VALGRIND_MAKE_MEM_DEFINED, XLOG_BTREE_REUSE_PAGE, XLogBeginInsert(), XLogInsert(), XLogRegisterData(), and XLogStandbyInfoActive.
Referenced by _bt_getroot(), _bt_newlevel(), and _bt_split().
OffsetNumber _bt_binsrch_insert | ( | Relation | rel, |
BTInsertState | insertstate | ||
) |
Definition at line 474 of file nbtsearch.c.
References _bt_binsrch_posting(), _bt_compare(), Assert, BTInsertStateData::bounds_valid, BTPageGetOpaque, BTInsertStateData::buf, BufferGetBlockNumber(), BufferGetPage(), ereport, errcode(), errmsg_internal(), ERROR, InvalidOffsetNumber, ItemPointerGetBlockNumber(), ItemPointerGetOffsetNumber(), BTInsertStateData::itup_key, sort-test::key, BTInsertStateData::low, P_FIRSTDATAKEY, P_ISLEAF, PageGetMaxOffsetNumber(), BTInsertStateData::postingoff, RelationGetRelationName, BTInsertStateData::stricthigh, and unlikely.
Referenced by _bt_check_unique(), _bt_findinsertloc(), and bt_rootdescend().
Definition at line 307 of file nbtdedup.c.
References _bt_bottomupdel_finish_pending(), _bt_dedup_save_htid(), _bt_dedup_start_pending(), _bt_delitems_delete_check(), _bt_keep_natts_fast(), Assert, TM_IndexDeleteOp::bottomup, TM_IndexDeleteOp::bottomupfreespace, BTPageGetOpaque, buf, BufferGetBlockNumber(), BufferGetPage(), TM_IndexDeleteOp::deltids, TM_IndexDeleteOp::iblknum, IndexRelationGetNumberOfKeyAttributes, InvalidOffsetNumber, TM_IndexDeleteOp::irel, ItemIdIsDead, Max, MaxTIDsPerBTreePage, TM_IndexDeleteOp::ndeltids, OffsetNumberNext, P_FIRSTDATAKEY, PageGetExactFreeSpace(), PageGetItem(), PageGetItemId(), PageGetMaxOffsetNumber(), palloc(), pfree(), and TM_IndexDeleteOp::status.
Referenced by _bt_delete_or_dedup_one_page().
bool _bt_check_natts | ( | Relation | rel, |
bool | heapkeyspace, | ||
Page | page, | ||
OffsetNumber | offnum | ||
) |
Definition at line 4924 of file nbtutils.c.
References Assert, BT_PIVOT_HEAP_TID_ATTR, BTPageGetOpaque, BTreeTupleGetHeapTID(), BTreeTupleGetNAtts, BTreeTupleIsPivot(), BTreeTupleIsPosting(), FirstOffsetNumber, IndexRelationGetNumberOfAttributes, IndexRelationGetNumberOfKeyAttributes, ItemPointerGetOffsetNumber(), ItemPointerGetOffsetNumberNoCheck(), P_FIRSTDATAKEY, P_HIKEY, P_IGNORE, P_ISLEAF, P_RIGHTMOST, PageGetItem(), PageGetItemId(), PageGetMaxOffsetNumber(), and IndexTupleData::t_tid.
Referenced by _bt_compare(), and bt_target_page_check().
void _bt_check_third_page | ( | Relation | rel, |
Relation | heap, | ||
bool | needheaptidspace, | ||
Page | page, | ||
IndexTuple | newtup | ||
) |
Definition at line 5084 of file nbtutils.c.
References BTMaxItemSize, BTMaxItemSizeNoHeapTid, BTPageGetOpaque, BTREE_NOVAC_VERSION, BTREE_VERSION, BTreeTupleGetHeapTID(), elog, ereport, errcode(), errdetail(), errhint(), errmsg(), ERROR, errtableconstraint(), IndexTupleSize, ItemPointerGetBlockNumber(), ItemPointerGetOffsetNumber(), MAXALIGN, P_ISLEAF, and RelationGetRelationName.
Referenced by _bt_buildadd(), and _bt_findinsertloc().
bool _bt_checkkeys | ( | IndexScanDesc | scan, |
BTReadPageState * | pstate, | ||
bool | arrayKeys, | ||
IndexTuple | tuple, | ||
int | tupnatts | ||
) |
Definition at line 3472 of file nbtutils.c.
References _bt_advance_array_keys(), _bt_check_compare(), _bt_checkkeys_look_ahead(), _bt_tuple_before_array_skeys(), Assert, BTEqualStrategyNumber, BTreeTupleGetNAtts, BTReadPageState::continuescan, BTScanOpaqueData::currPos, BTScanPosData::dir, BTReadPageState::finaltup, BTReadPageState::firstmatch, IndexScanDescData::indexRelation, BTScanOpaqueData::keyData, LOOK_AHEAD_REQUIRED_RECHECKS, BTScanOpaqueData::needPrimScan, BTScanOpaqueData::numArrayKeys, IndexScanDescData::opaque, BTScanOpaqueData::oppositeDirCheck, BTReadPageState::prechecked, BTReadPageState::rechecks, RelationGetDescr, res, BTScanOpaqueData::scanBehind, ScanKeyData::sk_strategy, and unlikely.
Referenced by _bt_readpage().
Definition at line 797 of file nbtpage.c.
References buf, BufferGetBlockNumber(), BufferGetPage(), ereport, errcode(), errhint(), errmsg(), ERROR, MAXALIGN, PageGetSpecialSize(), PageIsNew(), and RelationGetRelationName.
Referenced by _bt_getbuf(), _bt_relandgetbuf(), _bt_search_insert(), bt_recheck_sibling_links(), btvacuumpage(), and palloc_btree_page().
int32 _bt_compare | ( | Relation | rel, |
BTScanInsert | key, | ||
Page | page, | ||
OffsetNumber | offnum | ||
) |
Definition at line 688 of file nbtsearch.c.
References _bt_check_natts(), Assert, BTPageGetOpaque, BTreeTupleGetHeapTID(), BTreeTupleGetMaxHeapTID(), BTreeTupleGetNAtts, BTreeTupleIsPosting(), DatumGetInt32(), FunctionCall2Coll(), i, index_getattr(), IndexRelationGetNumberOfKeyAttributes, INVERT_COMPARE_RESULT, ItemPointerCompare(), sort-test::key, Min, P_FIRSTDATAKEY, P_ISLEAF, PageGetItem(), PageGetItemId(), RelationGetDescr, ScanKeyData::sk_argument, ScanKeyData::sk_attno, SK_BT_DESC, SK_BT_NULLS_FIRST, ScanKeyData::sk_collation, ScanKeyData::sk_flags, ScanKeyData::sk_func, and SK_ISNULL.
Referenced by _bt_binsrch(), _bt_binsrch_insert(), _bt_check_unique(), _bt_findinsertloc(), _bt_moveright(), _bt_search_insert(), bt_rootdescend(), bt_target_page_check(), invariant_g_offset(), invariant_l_nontarget_offset(), invariant_l_offset(), and invariant_leq_offset().
Definition at line 1093 of file nbtpage.c.
References buf, BufferGetPage(), ConditionalLockBuffer(), RelationUsesLocalBuffers, and VALGRIND_MAKE_MEM_DEFINED.
Referenced by _bt_allocbuf(), and _bt_search_insert().
Size _bt_dedup_finish_pending | ( | Page | newpage, |
BTDedupState | state | ||
) |
Definition at line 555 of file nbtdedup.c.
References _bt_form_posting(), Assert, BTMaxItemSize, elog, ERROR, IndexTupleSize, InvalidOffsetNumber, MAXALIGN, OffsetNumberNext, PageAddItem, PageGetMaxOffsetNumber(), and pfree().
Referenced by _bt_dedup_pass(), and btree_xlog_dedup().
void _bt_dedup_pass | ( | Relation | rel, |
Buffer | buf, | ||
IndexTuple | newitem, | ||
Size | newitemsz, | ||
bool | bottomupdedup | ||
) |
Definition at line 58 of file nbtdedup.c.
References _bt_dedup_finish_pending(), _bt_dedup_save_htid(), _bt_dedup_start_pending(), _bt_do_singleval(), _bt_keep_natts_fast(), _bt_singleval_fillfactor(), Assert, BTMaxItemSize, BTP_HAS_GARBAGE, BTPageGetOpaque, BTPageOpaqueData::btpo_flags, buf, BufferGetPage(), elog, END_CRIT_SECTION, ERROR, INDEX_SIZE_MASK, IndexRelationGetNumberOfKeyAttributes, InvalidOffsetNumber, ItemIdGetLength, ItemIdIsDead, MarkBufferDirty(), Min, xl_btree_dedup::nintervals, OffsetNumberNext, P_FIRSTDATAKEY, P_HAS_GARBAGE, P_HIKEY, P_RIGHTMOST, PageAddItem, PageGetExactFreeSpace(), PageGetItem(), PageGetItemId(), PageGetLSN(), PageGetMaxOffsetNumber(), PageGetTempPageCopySpecial(), PageRestoreTempPage(), PageSetLSN(), palloc(), pfree(), PG_USED_FOR_ASSERTS_ONLY, REGBUF_STANDARD, RelationNeedsWAL, SizeOfBtreeDedup, START_CRIT_SECTION, XLOG_BTREE_DEDUP, XLogBeginInsert(), XLogInsert(), XLogRegisterBufData(), XLogRegisterBuffer(), and XLogRegisterData().
Referenced by _bt_delete_or_dedup_one_page().
bool _bt_dedup_save_htid | ( | BTDedupState | state, |
IndexTuple | itup | ||
) |
Definition at line 484 of file nbtdedup.c.
References Assert, BTreeTupleGetNPosting(), BTreeTupleGetPosting(), BTreeTupleIsPivot(), BTreeTupleIsPosting(), IndexTupleSize, MAXALIGN, and IndexTupleData::t_tid.
Referenced by _bt_bottomupdel_pass(), _bt_dedup_pass(), _bt_load(), and btree_xlog_dedup().
void _bt_dedup_start_pending | ( | BTDedupState | state, |
IndexTuple | base, | ||
OffsetNumber | baseoff | ||
) |
Definition at line 433 of file nbtdedup.c.
References Assert, BTreeTupleGetNPosting(), BTreeTupleGetPosting(), BTreeTupleGetPostingOffset(), BTreeTupleIsPivot(), BTreeTupleIsPosting(), IndexTupleSize, MAXALIGN, and IndexTupleData::t_tid.
Referenced by _bt_bottomupdel_pass(), _bt_dedup_pass(), _bt_load(), and btree_xlog_dedup().
void _bt_delitems_delete_check | ( | Relation | rel, |
Buffer | buf, | ||
Relation | heapRel, | ||
TM_IndexDeleteOp * | delstate | ||
) |
Definition at line 1513 of file nbtpage.c.
References _bt_delitems_cmp(), _bt_delitems_delete(), Assert, TM_IndexDeleteOp::bottomup, BTreeTupleGetHeapTID(), BTreeTupleGetMaxHeapTID(), BTreeTupleGetNPosting(), BTreeTupleGetPostingN(), BTreeTupleIsPosting(), buf, BufferGetPage(), BTVacuumPostingData::deletetids, TM_IndexDeleteOp::deltids, i, TM_IndexDelete::id, TM_IndexStatus::idxoffnum, InvalidOffsetNumber, InvalidTransactionId, ItemPointerCompare(), ItemPointerEquals(), BTVacuumPostingData::itup, TM_IndexStatus::knowndeletable, MaxIndexTuplesPerPage, BTVacuumPostingData::ndeletedtids, TM_IndexDeleteOp::ndeltids, OffsetNumberIsValid, PageGetItem(), PageGetItemId(), palloc(), pfree(), qsort, RelationIsAccessibleInLogicalDecoding, TM_IndexDeleteOp::status, IndexTupleData::t_tid, table_index_delete_tuples(), TM_IndexDelete::tid, BTVacuumPostingData::updatedoffset, and XLogStandbyInfoActive.
Referenced by _bt_bottomupdel_pass(), and _bt_simpledel_pass().
void _bt_delitems_vacuum | ( | Relation | rel, |
Buffer | buf, | ||
OffsetNumber * | deletable, | ||
int | ndeletable, | ||
BTVacuumPosting * | updatable, | ||
int | nupdatable | ||
) |
Definition at line 1154 of file nbtpage.c.
References _bt_delitems_update(), Assert, BTP_HAS_GARBAGE, BTPageGetOpaque, BTPageOpaqueData::btpo_cycleid, BTPageOpaqueData::btpo_flags, buf, BufferGetBlockNumber(), BufferGetPage(), elog, END_CRIT_SECTION, i, IndexTupleSize, BTVacuumPostingData::itup, MarkBufferDirty(), MAXALIGN, MaxIndexTuplesPerPage, xl_btree_vacuum::ndeleted, xl_btree_vacuum::nupdated, PageIndexMultiDelete(), PageIndexTupleOverwrite(), PageSetLSN(), PANIC, pfree(), REGBUF_STANDARD, RelationGetRelationName, RelationNeedsWAL, SizeOfBtreeVacuum, START_CRIT_SECTION, XLOG_BTREE_VACUUM, XLogBeginInsert(), XLogInsert(), XLogRegisterBufData(), XLogRegisterBuffer(), and XLogRegisterData().
Referenced by btvacuumpage().
bool _bt_doinsert | ( | Relation | rel, |
IndexTuple | itup, | ||
IndexUniqueCheck | checkUnique, | ||
bool | indexUnchanged, | ||
Relation | heapRel | ||
) |
Definition at line 102 of file nbtinsert.c.
References _bt_check_unique(), _bt_findinsertloc(), _bt_freestack(), _bt_insertonpg(), _bt_mkscankey(), _bt_relbuf(), _bt_search_insert(), BTScanInsertData::anynullkeys, Assert, BTInsertStateData::bounds_valid, BTInsertStateData::buf, BufferGetBlockNumber(), CheckForSerializableConflictIn(), BTScanInsertData::heapkeyspace, IndexTupleSize, InvalidBuffer, BTInsertStateData::itemsz, BTInsertStateData::itup, BTInsertStateData::itup_key, MAXALIGN, pfree(), BTInsertStateData::postingoff, BTScanInsertData::scantid, SpeculativeInsertionWait(), IndexTupleData::t_tid, TransactionIdIsValid, UNIQUE_CHECK_EXISTING, UNIQUE_CHECK_NO, unlikely, XactLockTableWait(), and XLTW_InsertIndex.
Referenced by btinsert().
void _bt_end_vacuum | ( | Relation | rel | ) |
Definition at line 4486 of file nbtutils.c.
References btvacinfo, LockRelId::dbId, i, LockInfoData::lockRelId, LW_EXCLUSIVE, LWLockAcquire(), LWLockRelease(), BTVacInfo::num_vacuums, RelationData::rd_lockInfo, BTOneVacInfo::relid, LockRelId::relId, and BTVacInfo::vacuums.
Referenced by _bt_end_vacuum_callback(), and btbulkdelete().
void _bt_end_vacuum_callback | ( | int | code, |
Datum | arg | ||
) |
Definition at line 4514 of file nbtutils.c.
References _bt_end_vacuum(), arg, and DatumGetPointer().
Referenced by btbulkdelete().
OffsetNumber _bt_findsplitloc | ( | Relation | rel, |
Page | origpage, | ||
OffsetNumber | newitemoff, | ||
Size | newitemsz, | ||
IndexTuple | newitem, | ||
bool * | newitemonleft | ||
) |
Definition at line 129 of file nbtsplitloc.c.
References _bt_afternewitemoff(), _bt_bestsplitloc(), _bt_defaultinterval(), _bt_deltasortsplits(), _bt_recsplitloc(), _bt_strategy(), Assert, BTGetFillFactor, BTPageGetOpaque, BTREE_NONLEAF_FILLFACTOR, BTREE_SINGLEVAL_FILLFACTOR, BTreeTupleIsPosting(), elog, ERROR, SplitPoint::firstrightoff, i, IndexRelationGetNumberOfKeyAttributes, ItemIdGetLength, MAXALIGN, SplitPoint::newitemonleft, OffsetNumberNext, P_FIRSTDATAKEY, P_HIKEY, P_ISLEAF, P_RIGHTMOST, PageGetExactFreeSpace(), PageGetItemId(), PageGetMaxOffsetNumber(), PageGetPageSize(), palloc(), pfree(), RelationGetRelationName, SizeOfPageHeaderData, SPLIT_DEFAULT, SPLIT_MANY_DUPLICATES, and SPLIT_SINGLE_VALUE.
Referenced by _bt_split().
Definition at line 2241 of file nbtinsert.c.
References _bt_getbuf(), _bt_insert_parent(), _bt_relbuf(), Assert, BT_WRITE, BTMetaPageData::btm_root, BTPageGetMeta, BTPageGetOpaque, BTPageOpaqueData::btpo_next, BTREE_METAPAGE, BufferGetBlockNumber(), BufferGetPage(), DEBUG1, elog, P_INCOMPLETE_SPLIT, P_LEFTMOST, and P_RIGHTMOST.
Referenced by _bt_getstackbuf(), _bt_moveright(), and _bt_stepright().
bool _bt_first | ( | IndexScanDesc | scan, |
ScanDirection | dir | ||
) |
Definition at line 882 of file nbtsearch.c.
References _bt_binsrch(), _bt_endpoint(), _bt_freestack(), _bt_metaversion(), _bt_parallel_done(), _bt_parallel_seize(), _bt_preprocess_keys(), _bt_readfirstpage(), _bt_readnextpage(), _bt_returnitem(), _bt_search(), _bt_start_array_keys(), Assert, BT_READ, BTEqualStrategyNumber, BTGreaterEqualStrategyNumber, BTGreaterStrategyNumber, BTLessEqualStrategyNumber, BTLessStrategyNumber, BTORDER_PROC, BTScanPosIsValid, BTScanPosData::buf, BufferIsValid(), cur, BTScanOpaqueData::currPos, DatumGetPointer(), elog, ERROR, get_opfamily_proc(), i, index_getprocinfo(), INDEX_MAX_KEYS, IndexScanDescData::indexRelation, InvalidBlockNumber, InvalidOid, InvalidStrategy, IsolationIsSerializable, BTScanOpaqueData::keyData, BTScanOpaqueData::needPrimScan, BTScanOpaqueData::numArrayKeys, BTScanOpaqueData::numberOfKeys, IndexScanDescData::opaque, P_NONE, IndexScanDescData::parallel_scan, pgstat_count_index_scan, PredicateLockRelation(), BTScanOpaqueData::qual_ok, RelationData::rd_opcintype, RelationData::rd_opfamily, RegProcedureIsValid, RelationGetRelationName, ScanDirectionIsBackward, ScanDirectionIsForward, ScanKeyEntryInitialize(), ScanKeyEntryInitializeWithInfo(), ScanKeyData::sk_attno, SK_BT_DESC, SK_BT_NULLS_FIRST, ScanKeyData::sk_flags, SK_ISNULL, SK_ROW_END, SK_ROW_HEADER, SK_ROW_MEMBER, SK_SEARCHNOTNULL, ScanKeyData::sk_strategy, and IndexScanDescData::xs_snapshot.
Referenced by btgetbitmap(), and btgettuple().
IndexTuple _bt_form_posting | ( | IndexTuple | base, |
ItemPointer | htids, | ||
int | nhtids | ||
) |
Definition at line 864 of file nbtdedup.c.
References Assert, BTreeTupleGetPosting(), BTreeTupleGetPostingOffset(), BTreeTupleIsPivot(), BTreeTupleIsPosting(), BTreeTupleSetPosting(), INDEX_ALT_TID_MASK, INDEX_SIZE_MASK, IndexTupleSize, ItemPointerCopy(), ItemPointerIsValid(), MAXALIGN, palloc0(), PG_UINT16_MAX, IndexTupleData::t_info, and IndexTupleData::t_tid.
Referenced by _bt_dedup_finish_pending(), _bt_sort_dedup_finish_pending(), and bt_posting_plain_tuple().
void _bt_freestack | ( | BTStack | stack | ) |
Definition at line 221 of file nbtutils.c.
References BTStackData::bts_parent, and pfree().
Referenced by _bt_doinsert(), _bt_first(), and bt_rootdescend().
Definition at line 2464 of file nbtsearch.c.
References _bt_getroot(), _bt_gettrueroot(), _bt_relandgetbuf(), BT_READ, BTPageGetOpaque, BTPageOpaqueData::btpo_level, BTPageOpaqueData::btpo_next, BTreeTupleGetDownLink(), buf, BufferGetPage(), BufferIsValid(), elog, ereport, errcode(), errmsg_internal(), ERROR, InvalidBuffer, P_FIRSTDATAKEY, P_IGNORE, P_NONE, P_RIGHTMOST, PageGetItem(), PageGetItemId(), PageGetMaxOffsetNumber(), and RelationGetRelationName.
Referenced by _bt_endpoint(), and _bt_insert_parent().
Buffer _bt_getbuf | ( | Relation | rel, |
BlockNumber | blkno, | ||
int | access | ||
) |
Definition at line 845 of file nbtpage.c.
References _bt_checkpage(), _bt_lockbuf(), Assert, BlockNumberIsValid(), buf, and ReadBuffer().
Referenced by _bt_finish_split(), _bt_getroot(), _bt_getrootheight(), _bt_getstackbuf(), _bt_gettrueroot(), _bt_insertonpg(), _bt_killitems(), _bt_leftsib_splitflag(), _bt_lock_and_validate_left(), _bt_metaversion(), _bt_moveright(), _bt_newlevel(), _bt_pagedel(), _bt_readnextpage(), _bt_rightsib_halfdeadflag(), _bt_set_cleanup_info(), _bt_split(), _bt_unlink_halfdead_page(), and _bt_vacuum_needs_cleanup().
Definition at line 344 of file nbtpage.c.
References _bt_allocbuf(), _bt_getbuf(), _bt_getmeta(), _bt_lockbuf(), _bt_relandgetbuf(), _bt_relbuf(), _bt_unlockbuf(), _bt_upgrademetapage(), xl_btree_metadata::allequalimage, Assert, BT_READ, BT_WRITE, BTMetaPageData::btm_allequalimage, BTMetaPageData::btm_fastlevel, BTMetaPageData::btm_fastroot, BTMetaPageData::btm_last_cleanup_num_delpages, BTMetaPageData::btm_last_cleanup_num_heap_tuples, BTMetaPageData::btm_level, BTMetaPageData::btm_magic, BTMetaPageData::btm_root, BTMetaPageData::btm_version, BTP_LEAF, BTP_ROOT, BTPageGetOpaque, BTPageOpaqueData::btpo_cycleid, BTPageOpaqueData::btpo_flags, BTPageOpaqueData::btpo_level, BTPageOpaqueData::btpo_next, BTPageOpaqueData::btpo_prev, BTREE_MAGIC, BTREE_METAPAGE, BTREE_MIN_VERSION, BTREE_NOVAC_VERSION, BTREE_VERSION, BufferGetBlockNumber(), BufferGetPage(), elog, END_CRIT_SECTION, ERROR, xl_btree_metadata::fastlevel, xl_btree_metadata::fastroot, InvalidBuffer, xl_btree_metadata::last_cleanup_num_delpages, xl_btree_metadata::level, xl_btree_newroot::level, MarkBufferDirty(), MemoryContextAlloc(), P_IGNORE, P_LEFTMOST, P_NONE, P_RIGHTMOST, PageSetLSN(), pfree(), RelationData::rd_amcache, RelationData::rd_indexcxt, REGBUF_STANDARD, REGBUF_WILL_INIT, RelationGetRelationName, RelationNeedsWAL, xl_btree_metadata::root, xl_btree_newroot::rootblk, SizeOfBtreeNewroot, START_CRIT_SECTION, xl_btree_metadata::version, XLOG_BTREE_NEWROOT, XLogBeginInsert(), XLogInsert(), XLogRegisterBufData(), XLogRegisterBuffer(), and XLogRegisterData().
Referenced by _bt_get_endpoint(), and _bt_search().
int _bt_getrootheight | ( | Relation | rel | ) |
Definition at line 675 of file nbtpage.c.
References _bt_getbuf(), _bt_getmeta(), _bt_relbuf(), Assert, BT_READ, BTMetaPageData::btm_allequalimage, BTMetaPageData::btm_fastlevel, BTMetaPageData::btm_fastroot, BTMetaPageData::btm_magic, BTMetaPageData::btm_root, BTMetaPageData::btm_version, BTREE_MAGIC, BTREE_METAPAGE, BTREE_MIN_VERSION, BTREE_NOVAC_VERSION, BTREE_VERSION, MemoryContextAlloc(), P_NONE, RelationData::rd_amcache, and RelationData::rd_indexcxt.
Referenced by _bt_insertonpg(), and btgettreeheight().
Buffer _bt_getstackbuf | ( | Relation | rel, |
Relation | heaprel, | ||
BTStack | stack, | ||
BlockNumber | child | ||
) |
Definition at line 2319 of file nbtinsert.c.
References _bt_finish_split(), _bt_getbuf(), _bt_relbuf(), Assert, BT_WRITE, BTPageGetOpaque, BTPageOpaqueData::btpo_next, BTreeTupleGetDownLink(), BTStackData::bts_blkno, BTStackData::bts_offset, BTStackData::bts_parent, buf, BufferGetPage(), InvalidBuffer, InvalidOffsetNumber, OffsetNumberNext, OffsetNumberPrev, P_FIRSTDATAKEY, P_IGNORE, P_INCOMPLETE_SPLIT, P_RIGHTMOST, PageGetItem(), PageGetItemId(), PageGetMaxOffsetNumber(), and start.
Referenced by _bt_insert_parent(), and _bt_lock_subtree_parent().
Definition at line 580 of file nbtpage.c.
References _bt_getbuf(), _bt_relandgetbuf(), _bt_relbuf(), BT_READ, BTMetaPageData::btm_level, BTMetaPageData::btm_magic, BTMetaPageData::btm_root, BTMetaPageData::btm_version, BTPageGetMeta, BTPageGetOpaque, BTPageOpaqueData::btpo_level, BTPageOpaqueData::btpo_next, BTREE_MAGIC, BTREE_METAPAGE, BTREE_MIN_VERSION, BTREE_VERSION, BufferGetPage(), elog, ereport, errcode(), errmsg(), ERROR, InvalidBuffer, P_IGNORE, P_ISMETA, P_NONE, P_RIGHTMOST, pfree(), RelationData::rd_amcache, and RelationGetRelationName.
Referenced by _bt_get_endpoint().
void _bt_initmetapage | ( | Page | page, |
BlockNumber | rootbknum, | ||
uint32 | level, | ||
bool | allequalimage | ||
) |
Definition at line 67 of file nbtpage.c.
References _bt_pageinit(), BTMetaPageData::btm_allequalimage, BTMetaPageData::btm_fastlevel, BTMetaPageData::btm_fastroot, BTMetaPageData::btm_last_cleanup_num_delpages, BTMetaPageData::btm_last_cleanup_num_heap_tuples, BTMetaPageData::btm_level, BTMetaPageData::btm_magic, BTMetaPageData::btm_root, BTMetaPageData::btm_version, BTP_META, BTPageGetMeta, BTPageGetOpaque, BTPageOpaqueData::btpo_flags, BTREE_MAGIC, and BTREE_VERSION.
Referenced by _bt_uppershutdown(), and btbuildempty().
int _bt_keep_natts_fast | ( | Relation | rel, |
IndexTuple | lastleft, | ||
IndexTuple | firstright | ||
) |
Definition at line 4877 of file nbtutils.c.
References attnum, datum_image_eq(), index_getattr(), IndexRelationGetNumberOfKeyAttributes, RelationGetDescr, and TupleDescAttr.
Referenced by _bt_afternewitemoff(), _bt_bottomupdel_pass(), _bt_dedup_pass(), _bt_do_singleval(), _bt_keep_natts(), _bt_load(), _bt_split_penalty(), and _bt_strategy().
void _bt_killitems | ( | IndexScanDesc | scan | ) |
Definition at line 4178 of file nbtutils.c.
References _bt_getbuf(), _bt_lockbuf(), _bt_relbuf(), _bt_unlockbuf(), Assert, BT_READ, BTP_HAS_GARBAGE, BTPageGetOpaque, BTreeTupleGetNPosting(), BTreeTupleGetPostingN(), BTreeTupleIsPosting(), BTScanPosIsPinned, BTScanPosIsValid, buf, BTScanPosData::buf, BufferGetLSNAtomic(), BufferGetPage(), BTScanPosData::currPage, BTScanOpaqueData::currPos, BTScanPosData::firstItem, BTScanPosItem::heapTid, i, BTScanPosItem::indexOffset, IndexScanDescData::indexRelation, ItemIdIsDead, ItemIdMarkDead, ItemPointerEquals(), BTScanPosData::items, j, BTScanOpaqueData::killedItems, BTScanPosData::lsn, MarkBufferDirtyHint(), BTScanOpaqueData::numKilled, OffsetNumberNext, IndexScanDescData::opaque, P_FIRSTDATAKEY, PageGetItem(), PageGetItemId(), PageGetMaxOffsetNumber(), PG_USED_FOR_ASSERTS_ONLY, and IndexTupleData::t_tid.
Referenced by _bt_steppage(), btendscan(), btrescan(), and btrestrpos().
Definition at line 1039 of file nbtpage.c.
References buf, BufferGetPage(), LockBuffer(), RelationUsesLocalBuffers, and VALGRIND_MAKE_MEM_DEFINED.
Referenced by _bt_getbuf(), _bt_getroot(), _bt_killitems(), _bt_moveright(), _bt_pagedel(), _bt_relandgetbuf(), _bt_search(), _bt_set_cleanup_info(), _bt_unlink_halfdead_page(), and btvacuumpage().
Definition at line 739 of file nbtpage.c.
References _bt_getbuf(), _bt_getmeta(), _bt_relbuf(), Assert, BT_READ, BTMetaPageData::btm_allequalimage, BTMetaPageData::btm_fastroot, BTMetaPageData::btm_magic, BTMetaPageData::btm_root, BTMetaPageData::btm_version, BTREE_MAGIC, BTREE_METAPAGE, BTREE_MIN_VERSION, BTREE_NOVAC_VERSION, BTREE_VERSION, MemoryContextAlloc(), P_NONE, RelationData::rd_amcache, and RelationData::rd_indexcxt.
Referenced by _bt_first(), _bt_mkscankey(), and bt_index_check_internal().
BTScanInsert _bt_mkscankey | ( | Relation | rel, |
IndexTuple | itup | ||
) |
Definition at line 129 of file nbtutils.c.
References _bt_metaversion(), arg, Assert, BTORDER_PROC, BTreeTupleGetHeapTID(), BTreeTupleGetNAtts, i, index_getattr(), index_getprocinfo(), IndexRelationGetNumberOfAttributes, IndexRelationGetNumberOfKeyAttributes, InvalidOid, InvalidStrategy, sort-test::key, Min, palloc(), RelationData::rd_indcollation, RelationData::rd_index, RelationData::rd_indoption, RelationGetDescr, ScanKeyEntryInitializeWithInfo(), SK_BT_INDOPTION_SHIFT, and SK_ISNULL.
Referenced by _bt_doinsert(), _bt_leafbuild(), _bt_pagedel(), bt_mkscankey_pivotsearch(), bt_rootdescend(), tuplesort_begin_cluster(), and tuplesort_begin_index_btree().
bool _bt_next | ( | IndexScanDesc | scan, |
ScanDirection | dir | ||
) |
Definition at line 1461 of file nbtsearch.c.
References _bt_returnitem(), _bt_steppage(), Assert, BTScanPosIsValid, BTScanOpaqueData::currPos, BTScanPosData::firstItem, BTScanPosData::itemIndex, BTScanPosData::lastItem, IndexScanDescData::opaque, and ScanDirectionIsForward.
Referenced by btgetbitmap(), and btgettuple().
bool _bt_oppodir_checkkeys | ( | IndexScanDesc | scan, |
ScanDirection | dir, | ||
IndexTuple | finaltup | ||
) |
Definition at line 3627 of file nbtutils.c.
References _bt_check_compare(), Assert, BTEqualStrategyNumber, BTreeTupleGetNAtts, IndexScanDescData::indexRelation, BTScanOpaqueData::keyData, BTScanOpaqueData::numArrayKeys, IndexScanDescData::opaque, RelationGetDescr, and ScanKeyData::sk_strategy.
Referenced by _bt_advance_array_keys(), and _bt_readpage().
void _bt_pagedel | ( | Relation | rel, |
Buffer | leafbuf, | ||
BTVacState * | vstate | ||
) |
Definition at line 1802 of file nbtpage.c.
References _bt_getbuf(), _bt_leftsib_splitflag(), _bt_lockbuf(), _bt_mark_page_halfdead(), _bt_mkscankey(), _bt_relbuf(), _bt_search(), _bt_unlink_halfdead_page(), _bt_unlockbuf(), Assert, BTScanInsertData::backward, BT_READ, BT_WRITE, BTPageGetOpaque, BTPageOpaqueData::btpo_next, BTPageOpaqueData::btpo_prev, BufferGetBlockNumber(), BufferGetPage(), CHECK_FOR_INTERRUPTS, CopyIndexTuple(), ereport, errcode(), errhint(), errmsg(), errmsg_internal(), IndexVacuumInfo::heaprel, BTVacState::info, LOG, BTScanInsertData::nextkey, P_FIRSTDATAKEY, P_HIKEY, P_IGNORE, P_INCOMPLETE_SPLIT, P_ISDELETED, P_ISHALFDEAD, P_ISLEAF, P_ISROOT, P_RIGHTMOST, PageGetItem(), PageGetItemId(), PageGetMaxOffsetNumber(), RelationGetRelationName, and ReleaseBuffer().
Referenced by btvacuumpage().
Definition at line 1129 of file nbtpage.c.
References PageInit(), and size.
Referenced by _bt_allocbuf(), _bt_blnewpage(), _bt_initmetapage(), _bt_restore_meta(), _bt_split(), btree_xlog_mark_page_halfdead(), btree_xlog_newroot(), btree_xlog_split(), and btree_xlog_unlink_page().
void _bt_parallel_build_main | ( | dsm_segment * | seg, |
shm_toc * | toc | ||
) |
Definition at line 1743 of file nbtsort.c.
References _bt_parallel_scan_and_sort(), AccessExclusiveLock, Assert, debug_query_string, BTSpool::heap, BTShared::heaprelid, BTSpool::index, index_close(), index_open(), BTShared::indexrelid, InstrEndParallelQuery(), InstrStartParallelQuery(), BTShared::isconcurrent, BTSpool::isunique, BTShared::isunique, log_btree_build_stats, maintenance_work_mem, MyProc, BTSpool::nulls_not_distinct, BTShared::nulls_not_distinct, palloc0(), PARALLEL_KEY_BTREE_SHARED, PARALLEL_KEY_BUFFER_USAGE, PARALLEL_KEY_QUERY_TEXT, PARALLEL_KEY_TUPLESORT, PARALLEL_KEY_TUPLESORT_SPOOL2, PARALLEL_KEY_WAL_USAGE, ParallelWorkerNumber, pgstat_report_activity(), pgstat_report_query_id(), PROC_IN_SAFE_IC, BTShared::queryid, ResetUsage(), RowExclusiveLock, BTShared::scantuplesortstates, ShareLock, ShareUpdateExclusiveLock, shm_toc_lookup(), ShowUsage(), STATE_RUNNING, PGPROC::statusFlags, table_close(), table_open(), and tuplesort_attach_shared().
void _bt_parallel_done | ( | IndexScanDesc | scan | ) |
Definition at line 774 of file nbtree.c.
References Assert, BTPARALLEL_DONE, BTPARALLEL_NEED_PRIMSCAN, BTScanPosIsValid, ConditionVariableBroadcast(), BTScanOpaqueData::currPos, BTScanOpaqueData::needPrimScan, OffsetToPointer, IndexScanDescData::opaque, IndexScanDescData::parallel_scan, SpinLockAcquire, and SpinLockRelease.
Referenced by _bt_endpoint(), _bt_first(), _bt_parallel_seize(), _bt_readnextpage(), and _bt_start_prim_scan().
void _bt_parallel_primscan_schedule | ( | IndexScanDesc | scan, |
BlockNumber | curr_page | ||
) |
Definition at line 824 of file nbtree.c.
References BTScanOpaqueData::arrayKeys, Assert, BTPARALLEL_IDLE, BTPARALLEL_NEED_PRIMSCAN, BTArrayKeyInfo::cur_elem, i, InvalidBlockNumber, BTScanOpaqueData::numArrayKeys, OffsetToPointer, IndexScanDescData::opaque, IndexScanDescData::parallel_scan, SpinLockAcquire, and SpinLockRelease.
Referenced by _bt_advance_array_keys().
void _bt_parallel_release | ( | IndexScanDesc | scan, |
BlockNumber | next_scan_page, | ||
BlockNumber | curr_page | ||
) |
Definition at line 747 of file nbtree.c.
References Assert, BlockNumberIsValid(), BTPARALLEL_IDLE, BTParallelScanDescData::btps_cv, BTParallelScanDescData::btps_lastCurrPage, BTParallelScanDescData::btps_mutex, BTParallelScanDescData::btps_nextScanPage, BTParallelScanDescData::btps_pageStatus, ConditionVariableSignal(), OffsetToPointer, IndexScanDescData::parallel_scan, ParallelIndexScanDescData::ps_offset, SpinLockAcquire, and SpinLockRelease.
Referenced by _bt_readnextpage(), and _bt_readpage().
bool _bt_parallel_seize | ( | IndexScanDesc | scan, |
BlockNumber * | next_scan_page, | ||
BlockNumber * | last_curr_page, | ||
bool | first | ||
) |
Definition at line 605 of file nbtree.c.
References _bt_parallel_done(), BTScanOpaqueData::arrayKeys, Assert, BTPARALLEL_ADVANCING, BTPARALLEL_DONE, BTPARALLEL_IDLE, BTPARALLEL_NEED_PRIMSCAN, BTScanPosInvalidate, ConditionVariableCancelSleep(), ConditionVariableSleep(), BTArrayKeyInfo::cur_elem, BTScanOpaqueData::currPos, BTArrayKeyInfo::elem_values, i, InvalidBlockNumber, BTScanOpaqueData::keyData, BTScanPosData::moreLeft, BTScanPosData::moreRight, BTScanOpaqueData::needPrimScan, BTScanOpaqueData::numArrayKeys, OffsetToPointer, IndexScanDescData::opaque, BTScanOpaqueData::oppositeDirCheck, P_NONE, IndexScanDescData::parallel_scan, BTArrayKeyInfo::scan_key, BTScanOpaqueData::scanBehind, ScanKeyData::sk_argument, SpinLockAcquire, and SpinLockRelease.
Referenced by _bt_first(), and _bt_readnextpage().
void _bt_pendingfsm_finalize | ( | Relation | rel, |
BTVacState * | vstate | ||
) |
Definition at line 2995 of file nbtpage.c.
References Assert, GetOldestNonRemovableTransactionId(), GlobalVisCheckRemovableFullXid(), IndexVacuumInfo::heaprel, i, BTVacState::info, BTVacState::npendingpages, IndexBulkDeleteResult::pages_free, IndexBulkDeleteResult::pages_newly_deleted, BTVacState::pendingpages, pfree(), pg_usleep(), RecordFreeIndexPage(), BTPendingFSM::safexid, BTVacState::stats, and BTPendingFSM::target.
Referenced by btvacuumscan().
void _bt_pendingfsm_init | ( | Relation | rel, |
BTVacState * | vstate, | ||
bool | cleanuponly | ||
) |
Definition at line 2954 of file nbtpage.c.
References BTVacState::bufsize, Max, MaxAllocSize, BTVacState::maxbufsize, Min, BTVacState::npendingpages, palloc(), BTVacState::pendingpages, and work_mem.
Referenced by btvacuumscan().
void _bt_preprocess_keys | ( | IndexScanDesc | scan | ) |
Definition at line 2530 of file nbtutils.c.
References _bt_compare_scankey_args(), _bt_fix_scankey_strategy(), _bt_mark_scankey_required(), _bt_preprocess_array_keys(), _bt_preprocess_array_keys_final(), BTScanOpaqueData::arrayContext, BTScanOpaqueData::arrayKeys, Assert, BTEqualStrategyNumber, BTGreaterEqualStrategyNumber, BTGreaterStrategyNumber, BTLessEqualStrategyNumber, BTLessStrategyNumber, BTMaxStrategyNumber, elog, ERROR, FmgrInfo::fn_oid, i, if(), IndexScanDescData::indexRelation, j, BTScanOpaqueData::keyData, IndexScanDescData::keyData, MemoryContextAlloc(), BTArrayKeyInfo::num_elems, BTScanOpaqueData::numberOfKeys, IndexScanDescData::numberOfKeys, OidIsValid, IndexScanDescData::opaque, BTScanOpaqueData::orderProcs, BTScanOpaqueData::qual_ok, RelationData::rd_indoption, BTArrayKeyInfo::scan_key, ScanKeyData::sk_attno, ScanKeyData::sk_flags, SK_ROW_HEADER, SK_SEARCHARRAY, SK_SEARCHNULL, and ScanKeyData::sk_strategy.
Referenced by _bt_first().
Buffer _bt_relandgetbuf | ( | Relation | rel, |
Buffer | obuf, | ||
BlockNumber | blkno, | ||
int | access | ||
) |
Definition at line 1003 of file nbtpage.c.
References _bt_checkpage(), _bt_lockbuf(), _bt_unlockbuf(), Assert, BlockNumberIsValid(), buf, BufferIsValid(), and ReleaseAndReadBuffer().
Referenced by _bt_check_unique(), _bt_get_endpoint(), _bt_getroot(), _bt_gettrueroot(), _bt_lock_and_validate_left(), _bt_moveright(), _bt_search(), and _bt_stepright().
Definition at line 1023 of file nbtpage.c.
References _bt_unlockbuf(), buf, and ReleaseBuffer().
Referenced by _bt_allocbuf(), _bt_check_unique(), _bt_doinsert(), _bt_finish_split(), _bt_getroot(), _bt_getrootheight(), _bt_getstackbuf(), _bt_gettrueroot(), _bt_insert_parent(), _bt_insertonpg(), _bt_killitems(), _bt_leftsib_splitflag(), _bt_lock_and_validate_left(), _bt_lock_subtree_parent(), _bt_mark_page_halfdead(), _bt_metaversion(), _bt_moveright(), _bt_newlevel(), _bt_pagedel(), _bt_readnextpage(), _bt_rightsib_halfdeadflag(), _bt_search_insert(), _bt_set_cleanup_info(), _bt_split(), _bt_stepright(), _bt_unlink_halfdead_page(), _bt_vacuum_needs_cleanup(), bt_rootdescend(), btvacuumpage(), and pgstat_btree_page().
BTStack _bt_search | ( | Relation | rel, |
Relation | heaprel, | ||
BTScanInsert | key, | ||
Buffer * | bufP, | ||
int | access | ||
) |
Definition at line 102 of file nbtsearch.c.
References _bt_binsrch(), _bt_getroot(), _bt_lockbuf(), _bt_moveright(), _bt_relandgetbuf(), _bt_unlockbuf(), Assert, BT_READ, BT_WRITE, BTPageGetOpaque, BTPageOpaqueData::btpo_level, BTreeTupleGetDownLink(), BTreeTupleIsPivot(), BTStackData::bts_blkno, BTStackData::bts_offset, BTStackData::bts_parent, BufferGetBlockNumber(), BufferGetPage(), BufferIsValid(), sort-test::key, P_ISLEAF, PageGetItem(), PageGetItemId(), and palloc().
Referenced by _bt_first(), _bt_pagedel(), _bt_search_insert(), and bt_rootdescend().
void _bt_set_cleanup_info | ( | Relation | rel, |
BlockNumber | num_delpages | ||
) |
Definition at line 232 of file nbtpage.c.
References _bt_getbuf(), _bt_lockbuf(), _bt_relbuf(), _bt_unlockbuf(), _bt_upgrademetapage(), xl_btree_metadata::allequalimage, Assert, BT_READ, BT_WRITE, BTMetaPageData::btm_allequalimage, BTMetaPageData::btm_fastlevel, BTMetaPageData::btm_fastroot, BTMetaPageData::btm_last_cleanup_num_delpages, BTMetaPageData::btm_last_cleanup_num_heap_tuples, BTMetaPageData::btm_level, BTMetaPageData::btm_root, BTMetaPageData::btm_version, BTPageGetMeta, BTREE_METAPAGE, BTREE_NOVAC_VERSION, BufferGetPage(), END_CRIT_SECTION, xl_btree_metadata::fastlevel, xl_btree_metadata::fastroot, xl_btree_metadata::last_cleanup_num_delpages, xl_btree_metadata::level, MarkBufferDirty(), PageSetLSN(), REGBUF_STANDARD, REGBUF_WILL_INIT, RelationNeedsWAL, xl_btree_metadata::root, START_CRIT_SECTION, xl_btree_metadata::version, XLOG_BTREE_META_CLEANUP, XLogBeginInsert(), XLogInsert(), XLogRegisterBufData(), and XLogRegisterBuffer().
Referenced by btvacuumcleanup().
void _bt_start_array_keys | ( | IndexScanDesc | scan, |
ScanDirection | dir | ||
) |
Definition at line 1352 of file nbtutils.c.
References BTScanOpaqueData::arrayKeys, Assert, BTArrayKeyInfo::cur_elem, BTArrayKeyInfo::elem_values, i, BTScanOpaqueData::keyData, BTArrayKeyInfo::num_elems, BTScanOpaqueData::numArrayKeys, IndexScanDescData::opaque, BTScanOpaqueData::oppositeDirCheck, BTScanOpaqueData::qual_ok, BTArrayKeyInfo::scan_key, BTScanOpaqueData::scanBehind, ScanDirectionIsBackward, ScanKeyData::sk_argument, ScanKeyData::sk_flags, and SK_SEARCHARRAY.
Referenced by _bt_advance_array_keys_increment(), _bt_first(), and btrestrpos().
bool _bt_start_prim_scan | ( | IndexScanDesc | scan, |
ScanDirection | dir | ||
) |
Definition at line 1682 of file nbtutils.c.
References _bt_parallel_done(), Assert, BTScanOpaqueData::needPrimScan, BTScanOpaqueData::numArrayKeys, IndexScanDescData::opaque, BTScanOpaqueData::oppositeDirCheck, IndexScanDescData::parallel_scan, and BTScanOpaqueData::scanBehind.
Definition at line 4429 of file nbtutils.c.
References btvacinfo, BTVacInfo::cycle_ctr, BTOneVacInfo::cycleid, LockRelId::dbId, elog, ERROR, i, LockInfoData::lockRelId, LW_EXCLUSIVE, LWLockAcquire(), LWLockRelease(), MAX_BT_CYCLE_ID, BTVacInfo::max_vacuums, BTVacInfo::num_vacuums, RelationData::rd_lockInfo, RelationGetRelationName, BTOneVacInfo::relid, LockRelId::relId, and BTVacInfo::vacuums.
Referenced by btbulkdelete().
IndexTuple _bt_swap_posting | ( | IndexTuple | newitem, |
IndexTuple | oposting, | ||
int | postingoff | ||
) |
Definition at line 1022 of file nbtdedup.c.
References Assert, BTreeTupleGetHeapTID(), BTreeTupleGetMaxHeapTID(), BTreeTupleGetNPosting(), BTreeTupleGetPostingN(), BTreeTupleIsPivot(), BTreeTupleIsPosting(), CopyIndexTuple(), elog, ERROR, ItemPointerCompare(), ItemPointerCopy(), and IndexTupleData::t_tid.
Referenced by _bt_insertonpg(), btree_xlog_insert(), and btree_xlog_split().
IndexTuple _bt_truncate | ( | Relation | rel, |
IndexTuple | lastleft, | ||
IndexTuple | firstright, | ||
BTScanInsert | itup_key | ||
) |
Definition at line 4658 of file nbtutils.c.
References _bt_keep_natts(), Assert, BTreeTupleGetHeapTID(), BTreeTupleGetMaxHeapTID(), BTreeTupleGetPostingOffset(), BTreeTupleIsPivot(), BTreeTupleIsPosting(), BTreeTupleSetNAtts(), INDEX_SIZE_MASK, index_truncate_tuple(), IndexRelationGetNumberOfAttributes, IndexRelationGetNumberOfKeyAttributes, IndexTupleSize, ItemPointerCompare(), ItemPointerCopy(), ItemPointerGetOffsetNumber(), ItemPointerSetOffsetNumber(), MAXALIGN, Min, OffsetNumberPrev, palloc0(), pfree(), RelationGetDescr, and IndexTupleData::t_info.
Referenced by _bt_buildadd(), and _bt_split().
Definition at line 1070 of file nbtpage.c.
References buf, BUFFER_LOCK_UNLOCK, BufferGetPage(), LockBuffer(), RelationUsesLocalBuffers, VALGRIND_CHECK_MEM_IS_DEFINED, and VALGRIND_MAKE_MEM_NOACCESS.
Referenced by _bt_drop_lock_and_maybe_pin(), _bt_getroot(), _bt_killitems(), _bt_moveright(), _bt_pagedel(), _bt_readfirstpage(), _bt_relandgetbuf(), _bt_relbuf(), _bt_search(), _bt_set_cleanup_info(), and _bt_unlink_halfdead_page().
void _bt_update_posting | ( | BTVacuumPosting | vacposting | ) |
Definition at line 924 of file nbtdedup.c.
References Assert, BTreeTupleGetNPosting(), BTreeTupleGetPosting(), BTreeTupleGetPostingN(), BTreeTupleGetPostingOffset(), BTreeTupleSetPosting(), BTVacuumPostingData::deletetids, i, INDEX_ALT_TID_MASK, INDEX_SIZE_MASK, ItemPointerIsValid(), BTVacuumPostingData::itup, MAXALIGN, BTVacuumPostingData::ndeletedtids, palloc0(), IndexTupleData::t_info, and IndexTupleData::t_tid.
Referenced by _bt_delitems_update(), and btree_xlog_updates().
Definition at line 1109 of file nbtpage.c.
References buf, BUFFER_LOCK_UNLOCK, BufferGetPage(), LockBuffer(), LockBufferForCleanup(), and VALGRIND_CHECK_MEM_IS_DEFINED.
Referenced by btvacuumpage().
void _bt_upgrademetapage | ( | Page | page | ) |
Definition at line 107 of file nbtpage.c.
References Assert, BTMetaPageData::btm_allequalimage, BTMetaPageData::btm_last_cleanup_num_delpages, BTMetaPageData::btm_last_cleanup_num_heap_tuples, BTMetaPageData::btm_version, BTP_META, BTPageGetMeta, BTPageGetOpaque, BTREE_MIN_VERSION, BTREE_NOVAC_VERSION, and PG_USED_FOR_ASSERTS_ONLY.
Referenced by _bt_getroot(), _bt_insertonpg(), _bt_newlevel(), _bt_set_cleanup_info(), and _bt_unlink_halfdead_page().
Definition at line 4395 of file nbtutils.c.
References btvacinfo, BTOneVacInfo::cycleid, LockRelId::dbId, i, LockInfoData::lockRelId, LW_SHARED, LWLockAcquire(), LWLockRelease(), BTVacInfo::num_vacuums, RelationData::rd_lockInfo, BTOneVacInfo::relid, LockRelId::relId, and BTVacInfo::vacuums.
Referenced by _bt_split().
Definition at line 179 of file nbtpage.c.
References _bt_getbuf(), _bt_relbuf(), BT_READ, BTMetaPageData::btm_last_cleanup_num_delpages, BTMetaPageData::btm_version, BTPageGetMeta, BTREE_METAPAGE, BTREE_NOVAC_VERSION, BufferGetPage(), and RelationGetNumberOfBlocks.
Referenced by btvacuumcleanup().
Definition at line 293 of file nbtvalidate.c.
References BTORDER_PROC, CommandCounterIncrement(), functions, get_opclass_input_type(), InvalidOid, OpFamilyMember::is_func, OpFamilyMember::lefttype, lfirst, list_concat_copy(), OpFamilyMember::number, OidIsValid, opclass_for_family_datatype(), OpFamilyMember::ref_is_family, OpFamilyMember::ref_is_hard, OpFamilyMember::refobjid, and OpFamilyMember::righttype.
Referenced by bthandler().
IndexScanDesc btbeginscan | ( | Relation | rel, |
int | nkeys, | ||
int | norderbys | ||
) |
Definition at line 312 of file nbtree.c.
References BTScanOpaqueData::arrayContext, BTScanOpaqueData::arrayKeys, Assert, BTScanPosInvalidate, BTScanOpaqueData::currPos, BTScanOpaqueData::currTuples, BTScanOpaqueData::keyData, BTScanOpaqueData::killedItems, BTScanOpaqueData::markPos, BTScanOpaqueData::markTuples, BTScanOpaqueData::needPrimScan, IndexScanDescData::numberOfKeys, BTScanOpaqueData::numKilled, IndexScanDescData::opaque, BTScanOpaqueData::oppositeDirCheck, BTScanOpaqueData::orderProcs, palloc(), RelationGetDescr, RelationGetIndexScan(), BTScanOpaqueData::scanBehind, and IndexScanDescData::xs_itupdesc.
Referenced by bthandler().
IndexBuildResult* btbuild | ( | Relation | heap, |
Relation | index, | ||
struct IndexInfo * | indexInfo | ||
) |
Definition at line 295 of file nbtsort.c.
References _bt_end_parallel(), _bt_leafbuild(), _bt_spooldestroy(), _bt_spools_heapscan(), BTBuildState::btleader, elog, ERROR, BTBuildState::havedead, BTBuildState::heap, IndexBuildResult::heap_tuples, IndexInfo::ii_NullsNotDistinct, IndexInfo::ii_Unique, IndexBuildResult::index_tuples, BTBuildState::indtuples, BTBuildState::isunique, log_btree_build_stats, BTBuildState::nulls_not_distinct, palloc(), RelationGetNumberOfBlocks, RelationGetRelationName, ResetUsage(), ShowUsage(), BTBuildState::spool, and BTBuildState::spool2.
Referenced by bthandler().
void btbuildempty | ( | Relation | index | ) |
Definition at line 159 of file nbtree.c.
References _bt_allequalimage(), _bt_initmetapage(), BTREE_METAPAGE, INIT_FORKNUM, P_NONE, smgr_bulk_finish(), smgr_bulk_get_buf(), smgr_bulk_start_rel(), and smgr_bulk_write().
Referenced by bthandler().
char* btbuildphasename | ( | int64 | phasenum | ) |
Definition at line 4610 of file nbtutils.c.
References PROGRESS_BTREE_PHASE_INDEXBUILD_TABLESCAN, PROGRESS_BTREE_PHASE_LEAF_LOAD, PROGRESS_BTREE_PHASE_PERFORMSORT_1, PROGRESS_BTREE_PHASE_PERFORMSORT_2, and PROGRESS_CREATEIDX_SUBPHASE_INITIALIZE.
Referenced by bthandler().
IndexBulkDeleteResult* btbulkdelete | ( | IndexVacuumInfo * | info, |
IndexBulkDeleteResult * | stats, | ||
IndexBulkDeleteCallback | callback, | ||
void * | callback_state | ||
) |
Definition at line 862 of file nbtree.c.
References _bt_end_vacuum(), _bt_end_vacuum_callback(), _bt_start_vacuum(), btvacuumscan(), callback(), IndexVacuumInfo::index, palloc0(), PG_END_ENSURE_ERROR_CLEANUP, PG_ENSURE_ERROR_CLEANUP, and PointerGetDatum().
Referenced by bthandler().
Definition at line 1498 of file nbtree.c.
Referenced by bthandler().
void btendscan | ( | IndexScanDesc | scan | ) |
Definition at line 417 of file nbtree.c.
References _bt_killitems(), BTScanOpaqueData::arrayContext, BTScanPosIsValid, BTScanPosUnpinIfPinned, BTScanOpaqueData::currPos, BTScanOpaqueData::currTuples, if(), BTScanOpaqueData::keyData, BTScanOpaqueData::killedItems, BTScanOpaqueData::markItemIndex, BTScanOpaqueData::markPos, MemoryContextDelete(), BTScanOpaqueData::numKilled, IndexScanDescData::opaque, and pfree().
Referenced by bthandler().
Size btestimateparallelscan | ( | int | nkeys, |
int | norderbys | ||
) |
Definition at line 537 of file nbtree.c.
References BTParallelScanDescData::btps_arrElems.
Referenced by bthandler().
int64 btgetbitmap | ( | IndexScanDesc | scan, |
TIDBitmap * | tbm | ||
) |
Definition at line 266 of file nbtree.c.
References _bt_first(), _bt_next(), BTScanOpaqueData::currPos, ForwardScanDirection, BTScanPosItem::heapTid, if(), BTScanPosData::itemIndex, BTScanPosData::items, BTScanPosData::lastItem, IndexScanDescData::opaque, tbm_add_tuples(), and IndexScanDescData::xs_heaptid.
Referenced by bthandler().
int btgettreeheight | ( | Relation | rel | ) |
Definition at line 1507 of file nbtree.c.
References _bt_getrootheight().
Referenced by bthandler().
bool btgettuple | ( | IndexScanDesc | scan, |
ScanDirection | dir | ||
) |
Definition at line 206 of file nbtree.c.
References _bt_first(), _bt_next(), BTScanPosIsValid, BTScanOpaqueData::currPos, if(), BTScanPosData::itemIndex, IndexScanDescData::kill_prior_tuple, BTScanOpaqueData::killedItems, MaxTIDsPerBTreePage, BTScanOpaqueData::numKilled, IndexScanDescData::opaque, palloc(), res, and IndexScanDescData::xs_recheck.
Referenced by bthandler().
void btinitparallelscan | ( | void * | target | ) |
Definition at line 547 of file nbtree.c.
References BTPARALLEL_NOT_INITIALIZED, BTParallelScanDescData::btps_cv, BTParallelScanDescData::btps_lastCurrPage, BTParallelScanDescData::btps_mutex, BTParallelScanDescData::btps_nextScanPage, BTParallelScanDescData::btps_pageStatus, ConditionVariableInit(), InvalidBlockNumber, and SpinLockInit.
Referenced by bthandler().
bool btinsert | ( | Relation | rel, |
Datum * | values, | ||
bool * | isnull, | ||
ItemPointer | ht_ctid, | ||
Relation | heapRel, | ||
IndexUniqueCheck | checkUnique, | ||
bool | indexUnchanged, | ||
struct IndexInfo * | indexInfo | ||
) |
Definition at line 182 of file nbtree.c.
References _bt_doinsert(), index_form_tuple(), pfree(), RelationGetDescr, IndexTupleData::t_tid, and values.
Referenced by bthandler().
void btmarkpos | ( | IndexScanDesc | scan | ) |
Definition at line 453 of file nbtree.c.
References BTScanPosInvalidate, BTScanPosIsValid, BTScanPosUnpinIfPinned, BTScanOpaqueData::currPos, BTScanPosData::itemIndex, BTScanOpaqueData::markItemIndex, BTScanOpaqueData::markPos, and IndexScanDescData::opaque.
Referenced by bthandler().
Definition at line 4564 of file nbtutils.c.
References build_reloptions(), fillfactor, lengthof, RELOPT_KIND_BTREE, RELOPT_TYPE_BOOL, RELOPT_TYPE_INT, and RELOPT_TYPE_REAL.
Referenced by bthandler().
|
inlinestatic |
Definition at line 260 of file nbtree.h.
References Assert, BTPageGetOpaque, FirstNormalFullTransactionId, P_HAS_FULLXID, P_ISDELETED, PageGetContents(), PageIsNew(), and BTDeletedPageData::safexid.
Referenced by _bt_allocbuf(), BTPageIsRecyclable(), and GetBTPageStatistics().
Definition at line 291 of file nbtree.h.
References Assert, BTPageGetDeleteXid(), BTPageGetOpaque, GlobalVisCheckRemovableFullXid(), P_ISDELETED, and PageIsNew().
Referenced by _bt_allocbuf(), and btvacuumpage().
|
inlinestatic |
Definition at line 239 of file nbtree.h.
References BTP_DELETED, BTP_HALF_DEAD, BTP_HAS_FULLXID, BTPageGetOpaque, BTPageOpaqueData::btpo_flags, MAXALIGN, PageGetContents(), PageHeaderData::pd_lower, PageHeaderData::pd_special, PageHeaderData::pd_upper, BTDeletedPageData::safexid, and SizeOfPageHeaderData.
Referenced by _bt_unlink_halfdead_page(), and btree_xlog_unlink_page().
void btparallelrescan | ( | IndexScanDesc | scan | ) |
Definition at line 562 of file nbtree.c.
References Assert, BTPARALLEL_NOT_INITIALIZED, BTParallelScanDescData::btps_lastCurrPage, BTParallelScanDescData::btps_mutex, BTParallelScanDescData::btps_nextScanPage, BTParallelScanDescData::btps_pageStatus, InvalidBlockNumber, OffsetToPointer, IndexScanDescData::parallel_scan, ParallelIndexScanDescData::ps_offset, SpinLockAcquire, and SpinLockRelease.
Referenced by bthandler().
bool btproperty | ( | Oid | index_oid, |
int | attno, | ||
IndexAMProperty | prop, | ||
const char * | propname, | ||
bool * | res, | ||
bool * | isnull | ||
) |
Definition at line 4587 of file nbtutils.c.
References AMPROP_RETURNABLE, and res.
Referenced by bthandler().
void BTreeShmemInit | ( | void | ) |
Definition at line 4536 of file nbtutils.c.
References Assert, BTreeShmemSize(), btvacinfo, BTVacInfo::cycle_ctr, IsUnderPostmaster, BTVacInfo::max_vacuums, MaxBackends, BTVacInfo::num_vacuums, and ShmemInitStruct().
Referenced by CreateOrAttachShmemStructs().
Size BTreeShmemSize | ( | void | ) |
Definition at line 4523 of file nbtutils.c.
References add_size(), MaxBackends, mul_size(), and size.
Referenced by BTreeShmemInit(), and CalculateShmemSize().
|
inlinestatic |
Definition at line 556 of file nbtree.h.
References ItemPointerGetBlockNumberNoCheck(), and IndexTupleData::t_tid.
Referenced by _bt_get_endpoint(), _bt_getstackbuf(), _bt_mark_page_halfdead(), _bt_search(), _bt_unlink_halfdead_page(), bt_check_level_from_leftmost(), bt_child_check(), bt_child_highkey_check(), bt_downlink_missing_check(), and btree_xlog_mark_page_halfdead().
|
inlinestatic |
Definition at line 638 of file nbtree.h.
References BT_PIVOT_HEAP_TID_ATTR, BTreeTupleGetPosting(), BTreeTupleIsPivot(), BTreeTupleIsPosting(), IndexTupleSize, ItemPointerGetOffsetNumberNoCheck(), and IndexTupleData::t_tid.
Referenced by _bt_bottomupdel_finish_pending(), _bt_check_natts(), _bt_check_third_page(), _bt_compare(), _bt_delitems_delete_check(), _bt_mkscankey(), _bt_swap_posting(), _bt_truncate(), bt_entry_unique_check(), bt_page_print_tuples(), bt_target_page_check(), BTreeTupleGetHeapTIDCareful(), and BTreeTupleGetPointsToTID().
|
inlinestatic |
Definition at line 664 of file nbtree.h.
References Assert, BTreeTupleGetNPosting(), BTreeTupleGetPostingN(), BTreeTupleIsPivot(), BTreeTupleIsPosting(), and IndexTupleData::t_tid.
Referenced by _bt_bottomupdel_finish_pending(), _bt_compare(), _bt_delitems_delete_check(), _bt_swap_posting(), _bt_truncate(), and bt_target_page_check().
|
inlinestatic |
Definition at line 518 of file nbtree.h.
References Assert, BT_OFFSET_MASK, BTreeTupleIsPosting(), ItemPointerGetOffsetNumberNoCheck(), and IndexTupleData::t_tid.
Referenced by _bt_binsrch_posting(), _bt_bottomupdel_finish_pending(), _bt_check_unique(), _bt_deadblocks(), _bt_dedup_save_htid(), _bt_dedup_start_pending(), _bt_delitems_delete_check(), _bt_killitems(), _bt_readpage(), _bt_simpledel_pass(), _bt_swap_posting(), _bt_update_posting(), bt_entry_unique_check(), bt_page_print_tuples(), bt_target_page_check(), BTreeTupleGetMaxHeapTID(), btreevacuumposting(), and btvacuumpage().
|
inlinestatic |
Definition at line 537 of file nbtree.h.
References BTreeTupleGetPostingOffset().
Referenced by _bt_dedup_save_htid(), _bt_dedup_start_pending(), _bt_form_posting(), _bt_update_posting(), bt_page_print_tuples(), BTreeTupleGetHeapTID(), BTreeTupleGetPostingN(), and btreevacuumposting().
|
inlinestatic |
Definition at line 544 of file nbtree.h.
References BTreeTupleGetPosting().
Referenced by _bt_binsrch_posting(), _bt_bottomupdel_finish_pending(), _bt_check_unique(), _bt_deadblocks(), _bt_delitems_delete_check(), _bt_killitems(), _bt_readpage(), _bt_simpledel_pass(), _bt_swap_posting(), _bt_update_posting(), bt_entry_unique_check(), bt_posting_plain_tuple(), bt_target_page_check(), and BTreeTupleGetMaxHeapTID().
|
inlinestatic |
Definition at line 529 of file nbtree.h.
References Assert, BTreeTupleIsPosting(), ItemPointerGetBlockNumberNoCheck(), and IndexTupleData::t_tid.
Referenced by _bt_dedup_start_pending(), _bt_form_posting(), _bt_recsplitloc(), _bt_setuppostingitems(), _bt_sort_dedup_finish_pending(), _bt_truncate(), _bt_update_posting(), bt_page_print_tuples(), and BTreeTupleGetPosting().
|
inlinestatic |
Definition at line 620 of file nbtree.h.
References ItemPointerGetBlockNumberNoCheck(), and IndexTupleData::t_tid.
Referenced by _bt_unlink_halfdead_page(), and bt_downlink_missing_check().
|
inlinestatic |
Definition at line 480 of file nbtree.h.
References BT_IS_POSTING, INDEX_ALT_TID_MASK, ItemPointerGetOffsetNumberNoCheck(), IndexTupleData::t_info, and IndexTupleData::t_tid.
Referenced by _bt_check_compare(), _bt_check_natts(), _bt_check_rowcompare(), _bt_check_unique(), _bt_deadblocks(), _bt_dedup_save_htid(), _bt_dedup_start_pending(), _bt_form_posting(), _bt_readpage(), _bt_saveitem(), _bt_search(), _bt_swap_posting(), _bt_truncate(), bt_normalize_tuple(), bt_page_print_tuples(), BTreeTupleGetHeapTID(), BTreeTupleGetHeapTIDCareful(), BTreeTupleGetMaxHeapTID(), BTreeTupleGetPointsToTID(), BTreeTupleSetNAtts(), BTreeTupleSetPosting(), and btvacuumpage().
|
inlinestatic |
Definition at line 492 of file nbtree.h.
References BT_IS_POSTING, INDEX_ALT_TID_MASK, ItemPointerGetOffsetNumberNoCheck(), IndexTupleData::t_info, and IndexTupleData::t_tid.
Referenced by _bt_afternewitemoff(), _bt_binsrch_posting(), _bt_bottomupdel_finish_pending(), _bt_check_natts(), _bt_check_unique(), _bt_compare(), _bt_deadblocks(), _bt_dedup_save_htid(), _bt_dedup_start_pending(), _bt_delitems_delete_check(), _bt_findsplitloc(), _bt_form_posting(), _bt_insertonpg(), _bt_killitems(), _bt_readpage(), _bt_recsplitloc(), _bt_saveitem(), _bt_setuppostingitems(), _bt_simpledel_pass(), _bt_split(), _bt_swap_posting(), _bt_truncate(), bt_entry_unique_check(), bt_normalize_tuple(), bt_page_print_tuples(), bt_posting_plain_tuple(), bt_target_page_check(), BTreeTupleGetHeapTID(), BTreeTupleGetMaxHeapTID(), BTreeTupleGetNPosting(), BTreeTupleGetPostingOffset(), and btvacuumpage().
|
inlinestatic |
Definition at line 562 of file nbtree.h.
References ItemPointerSetBlockNumber(), and IndexTupleData::t_tid.
Referenced by _bt_buildadd(), _bt_insert_parent(), _bt_mark_page_halfdead(), _bt_newlevel(), _bt_uppershutdown(), and btree_xlog_mark_page_halfdead().
|
inlinestatic |
Definition at line 595 of file nbtree.h.
References Assert, BT_PIVOT_HEAP_TID_ATTR, BT_STATUS_OFFSET_MASK, BTreeTupleIsPivot(), INDEX_ALT_TID_MASK, INDEX_MAX_KEYS, ItemPointerSetOffsetNumber(), IndexTupleData::t_info, and IndexTupleData::t_tid.
Referenced by _bt_buildadd(), _bt_newlevel(), _bt_pgaddtup(), _bt_sortaddtup(), _bt_truncate(), and BTreeTupleSetTopParent().
|
inlinestatic |
Definition at line 504 of file nbtree.h.
References Assert, BT_IS_POSTING, BT_STATUS_OFFSET_MASK, BTreeTupleIsPivot(), INDEX_ALT_TID_MASK, INDEX_SIZE_MASK, ItemPointerSetBlockNumber(), ItemPointerSetOffsetNumber(), MAXALIGN, IndexTupleData::t_info, and IndexTupleData::t_tid.
Referenced by _bt_form_posting(), and _bt_update_posting().
|
inlinestatic |
Definition at line 626 of file nbtree.h.
References BTreeTupleSetNAtts(), ItemPointerSetBlockNumber(), and IndexTupleData::t_tid.
Referenced by _bt_mark_page_halfdead(), _bt_unlink_halfdead_page(), btree_xlog_mark_page_halfdead(), and btree_xlog_unlink_page().
void btrescan | ( | IndexScanDesc | scan, |
ScanKey | scankey, | ||
int | nscankeys, | ||
ScanKey | orderbys, | ||
int | norderbys | ||
) |
Definition at line 360 of file nbtree.c.
References _bt_killitems(), BTScanPosInvalidate, BTScanPosIsValid, BTScanPosUnpinIfPinned, BTScanOpaqueData::currPos, BTScanOpaqueData::currTuples, if(), IndexScanDescData::keyData, BTScanOpaqueData::markItemIndex, BTScanOpaqueData::markPos, BTScanOpaqueData::markTuples, BTScanOpaqueData::needPrimScan, BTScanOpaqueData::numArrayKeys, BTScanOpaqueData::numberOfKeys, IndexScanDescData::numberOfKeys, BTScanOpaqueData::numKilled, IndexScanDescData::opaque, BTScanOpaqueData::oppositeDirCheck, palloc(), BTScanOpaqueData::scanBehind, and IndexScanDescData::xs_want_itup.
Referenced by bthandler().
void btrestrpos | ( | IndexScanDesc | scan | ) |
Definition at line 479 of file nbtree.c.
References _bt_killitems(), _bt_start_array_keys(), BTScanPosInvalidate, BTScanPosIsPinned, BTScanPosIsValid, BTScanPosUnpinIfPinned, BTScanPosData::buf, BTScanOpaqueData::currPos, BTScanOpaqueData::currTuples, BTScanPosData::dir, if(), IncrBufferRefCount(), BTScanPosData::itemIndex, items, BTScanPosData::lastItem, BTScanOpaqueData::markItemIndex, BTScanOpaqueData::markPos, BTScanOpaqueData::markTuples, BTScanOpaqueData::needPrimScan, BTScanPosData::nextTupleOffset, BTScanOpaqueData::numArrayKeys, BTScanOpaqueData::numKilled, and IndexScanDescData::opaque.
Referenced by bthandler().
IndexBulkDeleteResult* btvacuumcleanup | ( | IndexVacuumInfo * | info, |
IndexBulkDeleteResult * | stats | ||
) |
Definition at line 892 of file nbtree.c.
References _bt_set_cleanup_info(), _bt_vacuum_needs_cleanup(), IndexVacuumInfo::analyze_only, Assert, btvacuumscan(), IndexVacuumInfo::estimated_count, IndexBulkDeleteResult::estimated_count, IndexVacuumInfo::index, IndexVacuumInfo::num_heap_tuples, IndexBulkDeleteResult::num_index_tuples, IndexBulkDeleteResult::pages_deleted, IndexBulkDeleteResult::pages_free, and palloc0().
Referenced by bthandler().
Definition at line 41 of file nbtvalidate.c.
References BTEQUALIMAGE_PROC, BTEqualStrategyNumber, BTGreaterEqualStrategyNumber, BTGreaterStrategyNumber, BTINRANGE_PROC, BTLessEqualStrategyNumber, BTLessStrategyNumber, BTMaxStrategyNumber, BTOPTIONS_PROC, BTORDER_PROC, BTSORTSUPPORT_PROC, check_amop_signature(), check_amoptsproc_signature(), check_amproc_signature(), elog, ereport, errcode(), errmsg(), ERROR, format_operator(), format_procedure(), format_type_be(), OpFamilyOpFuncGroup::functionset, GETSTRUCT, HeapTupleIsValid, i, identify_opfamily_groups(), INFO, OpFamilyOpFuncGroup::lefttype, lfirst, list_append_unique_oid(), list_length(), catclist::members, catclist::n_members, NameStr, NIL, ObjectIdGetDatum(), OidIsValid, OpFamilyOpFuncGroup::operatorset, ReleaseCatCacheList(), ReleaseSysCache(), OpFamilyOpFuncGroup::righttype, SearchSysCache1(), SearchSysCacheList1, and catctup::tuple.
Referenced by bthandler().
StaticAssertDecl | ( | BT_OFFSET_MASK >= | INDEX_MAX_KEYS, |
"BT_OFFSET_MASK can't fit INDEX_MAX_KEYS" | |||
) |