|
PostgreSQL Source Code git master
|
#include "postgres.h"#include <time.h>#include "access/nbtree.h"#include "access/reloptions.h"#include "access/relscan.h"#include "commands/progress.h"#include "common/int.h"#include "lib/qunique.h"#include "miscadmin.h"#include "utils/datum.h"#include "utils/lsyscache.h"#include "utils/rel.h"
Go to the source code of this file.
Data Structures | |
| struct | BTOneVacInfo |
| struct | BTVacInfo |
Typedefs | |
| typedef struct BTOneVacInfo | BTOneVacInfo |
| typedef struct BTVacInfo | BTVacInfo |
Variables | |
| static BTVacInfo * | btvacinfo |
| typedef struct BTOneVacInfo BTOneVacInfo |
| bool _bt_allequalimage | ( | Relation | rel, |
| bool | debugmessage | ||
| ) |
Definition at line 1181 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_callback(), and btbuildempty().
| bool _bt_check_natts | ( | Relation | rel, |
| bool | heapkeyspace, | ||
| Page | page, | ||
| OffsetNumber | offnum | ||
| ) |
Definition at line 964 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 1124 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().
|
static |
Definition at line 167 of file nbtutils.c.
References a, b, and pg_cmp_s32().
Referenced by _bt_killitems().
| void _bt_end_vacuum | ( | Relation | rel | ) |
Definition at line 526 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 554 of file nbtutils.c.
References _bt_end_vacuum(), arg, and DatumGetPointer().
Referenced by btbulkdelete().
| void _bt_freestack | ( | BTStack | stack | ) |
Definition at line 151 of file nbtutils.c.
References BTStackData::bts_parent, and pfree().
Referenced by _bt_doinsert(), _bt_first(), and bt_rootdescend().
|
static |
Definition at line 843 of file nbtutils.c.
References _bt_keep_natts_fast(), BTScanInsertData::allequalimage, Assert(), attnum, DatumGetInt32(), FunctionCall2Coll(), BTScanInsertData::heapkeyspace, index_getattr(), IndexRelationGetNumberOfKeyAttributes, RelationGetDescr, BTScanInsertData::scankeys, ScanKeyData::sk_collation, and ScanKeyData::sk_func.
Referenced by _bt_truncate().
| int _bt_keep_natts_fast | ( | Relation | rel, |
| IndexTuple | lastleft, | ||
| IndexTuple | firstright | ||
| ) |
Definition at line 917 of file nbtutils.c.
References CompactAttribute::attbyval, CompactAttribute::attlen, attnum, datum_image_eq(), index_getattr(), IndexRelationGetNumberOfKeyAttributes, RelationGetDescr, and TupleDescCompactAttr().
Referenced by _bt_afternewitemoff(), _bt_bottomupdel_pass(), _bt_dedup_pass(), _bt_do_singleval(), _bt_keep_natts(), _bt_load(), _bt_set_startikey(), _bt_split_penalty(), and _bt_strategy().
| void _bt_killitems | ( | IndexScanDesc | scan | ) |
Definition at line 205 of file nbtutils.c.
References _bt_compare_int(), _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, BTScanOpaqueData::dropPin, BTScanPosData::firstItem, IndexScanDescData::heapRelation, 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(), qsort, qunique(), RelationNeedsWAL, and IndexTupleData::t_tid.
Referenced by _bt_steppage(), btendscan(), btrescan(), and btrestrpos().
| BTScanInsert _bt_mkscankey | ( | Relation | rel, |
| IndexTuple | itup | ||
| ) |
Definition at line 59 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().
Definition at line 469 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_truncate | ( | Relation | rel, |
| IndexTuple | lastleft, | ||
| IndexTuple | firstright, | ||
| BTScanInsert | itup_key | ||
| ) |
Definition at line 698 of file nbtutils.c.
References _bt_keep_natts(), Assert(), BTreeTupleGetHeapTID(), BTreeTupleGetMaxHeapTID(), BTreeTupleGetPostingOffset(), BTreeTupleIsPivot(), BTreeTupleIsPosting(), BTreeTupleSetNAtts(), 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 435 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().
| char * btbuildphasename | ( | int64 | phasenum | ) |
Definition at line 650 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().
Definition at line 604 of file nbtutils.c.
References build_reloptions(), fillfactor, lengthof, RELOPT_KIND_BTREE, RELOPT_TYPE_BOOL, RELOPT_TYPE_INT, RELOPT_TYPE_REAL, and validate().
Referenced by bthandler().
| bool btproperty | ( | Oid | index_oid, |
| int | attno, | ||
| IndexAMProperty | prop, | ||
| const char * | propname, | ||
| bool * | res, | ||
| bool * | isnull | ||
| ) |
Definition at line 627 of file nbtutils.c.
References AMPROP_RETURNABLE.
Referenced by bthandler().
| void BTreeShmemInit | ( | void | ) |
Definition at line 576 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 563 of file nbtutils.c.
References add_size(), MaxBackends, and mul_size().
Referenced by BTreeShmemInit(), and CalculateShmemSize().
|
static |
Definition at line 422 of file nbtutils.c.
Referenced by _bt_end_vacuum(), _bt_start_vacuum(), _bt_vacuum_cycleid(), and BTreeShmemInit().