|
PostgreSQL Source Code git master
|
#include "postgres.h"#include "access/genam.h"#include "access/heaptoast.h"#include "access/relscan.h"#include "access/table.h"#include "access/xact.h"#include "catalog/catalog.h"#include "catalog/pg_collation.h"#include "catalog/pg_type.h"#include "common/hashfn.h"#include "common/pg_prng.h"#include "miscadmin.h"#include "port/pg_bitutils.h"#include "storage/lmgr.h"#include "utils/builtins.h"#include "utils/catcache.h"#include "utils/datum.h"#include "utils/fmgroids.h"#include "utils/injection_point.h"#include "utils/inval.h"#include "utils/memutils.h"#include "utils/rel.h"#include "utils/resowner.h"#include "utils/syscache.h"
Go to the source code of this file.
Data Structures | |
| struct | CatCInProgress |
Macros | |
| #define | HASH_INDEX(h, sz) ((Index) ((h) & ((sz) - 1))) |
| #define | CACHE_elog(...) |
| #define | InitCatCache_DEBUG2 |
| #define | CatalogCacheInitializeCache_DEBUG1 |
| #define | CatalogCacheInitializeCache_DEBUG2 |
Typedefs | |
| typedef struct CatCInProgress | CatCInProgress |
| #define CACHE_elog | ( | ... | ) |
Definition at line 80 of file catcache.c.
| #define CatalogCacheInitializeCache_DEBUG1 |
Definition at line 1142 of file catcache.c.
| #define CatalogCacheInitializeCache_DEBUG2 |
Definition at line 1143 of file catcache.c.
| #define InitCatCache_DEBUG2 |
Definition at line 892 of file catcache.c.
| typedef struct CatCInProgress CatCInProgress |
|
inlinestatic |
Definition at line 453 of file catcache.c.
References CatCInProgress::cache, catcache::cc_fastequal, fb(), and i.
Referenced by SearchCatCacheInternal(), and SearchCatCacheList().
|
static |
Definition at line 356 of file catcache.c.
References CatCInProgress::cache, CACHE_elog, catcache::cc_hashfunc, catcache::cc_relname, DEBUG2, elog, FATAL, fb(), pg_fallthrough, and pg_rotate_left32().
Referenced by CatalogCacheComputeTupleHashValue(), GetCatCacheHashValue(), SearchCatCacheInternal(), and SearchCatCacheList().
|
static |
Definition at line 398 of file catcache.c.
References Assert, CatCInProgress::cache, CatalogCacheComputeHashValue(), catcache::cc_keyno, catcache::cc_tupdesc, elog, fastgetattr(), FATAL, fb(), and pg_fallthrough.
Referenced by PrepareToInvalidateCacheTuple(), and SearchCatCacheList().
|
static |
Definition at line 2165 of file catcache.c.
References Assert, CatCInProgress::cache, CacheHdr, CacheMemoryContext, catcache_in_progress_stack, CatCacheCopyKeys(), catcache::cc_bucket, catcache::cc_keyno, catcache::cc_nbuckets, catcache::cc_nkeys, catcache::cc_ntup, catcache::cc_tupdesc, catcacheheader::ch_ntup, CT_MAGIC, dlist_push_head(), fb(), heap_freetuple(), heap_getattr(), HeapTupleHasExternal(), i, MAXALIGN, memcpy(), MemoryContextAlloc(), MemoryContextSwitchTo(), CatCInProgress::next, palloc_object, PG_END_TRY, PG_FINALLY, pg_global_prng_state, pg_prng_uint32(), PG_TRY, PG_UINT32_MAX, RehashCatCache(), and toast_flatten_tuple().
Referenced by SearchCatCacheList(), and SearchCatCacheMiss().
Definition at line 852 of file catcache.c.
References CatCInProgress::cache, CACHE_elog, CacheHdr, CallSyscacheCallbacks(), catcache::cc_reloid, catcacheheader::ch_caches, slist_iter::cur, DEBUG2, catcache::id, ResetCatalogCache(), slist_container, and slist_foreach.
Referenced by LocalExecuteInvalidationMessage().
Definition at line 1147 of file catcache.c.
References AccessShareLock, Assert, BTEqualStrategyNumber, CatCInProgress::cache, CACHE_elog, CacheMemoryContext, CatalogCacheInitializeCache_DEBUG1, CatalogCacheInitializeCache_DEBUG2, catcache::cc_fastequal, catcache::cc_hashfunc, catcache::cc_keyno, catcache::cc_nkeys, catcache::cc_relisshared, catcache::cc_relname, catcache::cc_reloid, catcache::cc_skey, catcache::cc_tupdesc, CreateTupleDescCopyConstr(), DEBUG2, elog, FATAL, fb(), fmgr_info_cxt(), GetCCHashEqFuncs(), i, InvalidOid, MemoryContextSwitchTo(), pstrdup(), RelationGetDescr, RelationGetForm, RelationGetRelationName, ScanKeyData::sk_attno, ScanKeyData::sk_collation, ScanKeyData::sk_func, ScanKeyData::sk_strategy, ScanKeyData::sk_subtype, table_close(), table_open(), and TupleDescAttr().
Referenced by ConditionalCatalogCacheInitializeCache().
|
static |
Definition at line 2333 of file catcache.c.
References attnum, datumCopy(), DatumGetCString(), fb(), i, NameGetDatum(), namestrcpy(), and TupleDescAttr().
Referenced by CatalogCacheCreateEntry(), and SearchCatCacheList().
|
static |
Definition at line 2311 of file catcache.c.
References Assert, attbyval, attnum, DatumGetPointer(), fb(), i, pfree(), and TupleDescCompactAttr().
Referenced by CatCacheRemoveCList(), and CatCacheRemoveCTup().
Definition at line 643 of file catcache.c.
References Assert, CatCInProgress::cache, CACHE_elog, catcache_in_progress_stack, CatCacheRemoveCList(), CatCacheRemoveCTup(), catcache::cc_bucket, catcache::cc_lbucket, catcache::cc_nbuckets, catcache::cc_nlbuckets, dlist_mutable_iter::cur, DEBUG2, dlist_container, dlist_foreach_modify, fb(), HASH_INDEX, i, and CatCInProgress::next.
Referenced by SysCacheInvalidate().
Definition at line 588 of file catcache.c.
References Assert, CatCInProgress::cache, CatCacheFreeKeys(), CatCacheRemoveCTup(), catcache::cc_keyno, catcache::cc_nlist, catcache::cc_tupdesc, dlist_delete(), fb(), i, and pfree().
Referenced by CatCacheInvalidate(), CatCacheRemoveCTup(), ReleaseCatCacheListWithOwner(), and ResetCatalogCache().
Definition at line 546 of file catcache.c.
References Assert, CatCInProgress::cache, CacheHdr, CatCacheFreeKeys(), CatCacheRemoveCList(), catcache::cc_keyno, catcache::cc_nkeys, catcache::cc_ntup, catcache::cc_tupdesc, catcacheheader::ch_ntup, dlist_delete(), fb(), and pfree().
Referenced by CatCacheInvalidate(), CatCacheRemoveCList(), ReleaseCatCacheWithOwner(), ResetCatalogCache(), and SearchCatCacheList().
Definition at line 191 of file catcache.c.
References a, b, and DatumGetChar().
Referenced by GetCCHashEqFuncs().
Definition at line 197 of file catcache.c.
References DatumGetChar(), and murmurhash32().
Referenced by GetCCHashEqFuncs().
|
static |
Definition at line 1096 of file catcache.c.
References Assert, AssertCouldGetRelation(), CatCInProgress::cache, CatalogCacheInitializeCache(), catcache::cc_tupdesc, fb(), catcache::id, IsTransactionState(), and unlikely.
Referenced by GetCatCacheHashValue(), InitCatCachePhase2(), PrepareToInvalidateCacheTuple(), SearchCatCacheInternal(), and SearchCatCacheList().
Definition at line 726 of file catcache.c.
References ALLOCSET_DEFAULT_SIZES, AllocSetContextCreate, CacheMemoryContext, and TopMemoryContext.
Referenced by assign_record_type_typmod(), BuildEventTriggerCache(), init_ts_config_cache(), InitCatCache(), InitializeAttoptCache(), InitializeRelfilenumberMap(), InitializeTableSpaceCache(), lookup_ts_dictionary_cache(), lookup_ts_parser_cache(), lookup_type_cache(), LookupOpclassInfo(), RelationBuildLocalRelation(), and RelationCacheInitialize().
Definition at line 1718 of file catcache.c.
References CatCInProgress::cache, CatalogCacheComputeHashValue(), catcache::cc_nkeys, ConditionalCatalogCacheInitializeCache(), and fb().
Referenced by GetSysCacheHashValue().
|
static |
Definition at line 285 of file catcache.c.
References chareqfast(), charhashfast(), elog, FATAL, fb(), int2eqfast(), int2hashfast(), int4eqfast(), int4hashfast(), InvalidOid, nameeqfast(), namehashfast(), oidvectoreqfast(), oidvectorhashfast(), texteqfast(), and texthashfast().
Referenced by CatalogCacheInitializeCache().
Definition at line 1307 of file catcache.c.
References CatCInProgress::cache, criticalRelcachesBuilt, criticalSharedRelcachesBuilt, fb(), and catcache::id.
Referenced by SearchCatCacheList(), and SearchCatCacheMiss().
| CatCache * InitCatCache | ( | int | id, |
| Oid | reloid, | ||
| Oid | indexoid, | ||
| int | nkeys, | ||
| const int * | key, | ||
| int | nbuckets | ||
| ) |
Definition at line 896 of file catcache.c.
References Assert, AttributeNumberIsValid, CacheHdr, CacheMemoryContext, catcacheheader::ch_caches, catcacheheader::ch_ntup, CreateCacheMemoryContext(), fb(), i, InitCatCache_DEBUG2, MCXT_ALLOC_ZERO, MemoryContextSwitchTo(), on_proc_exit(), palloc0(), palloc_aligned(), palloc_object, PG_CACHE_LINE_SIZE, slist_init(), and slist_push_head().
Referenced by InitCatalogCache().
Definition at line 1256 of file catcache.c.
References AccessShareLock, Assert, CatCInProgress::cache, catcache::cc_indexoid, catcache::cc_reloid, ConditionalCatalogCacheInitializeCache(), fb(), catcache::id, index_close(), index_open(), LockRelationOid(), and UnlockRelationOid().
Referenced by InitCatalogCachePhase2(), and SysCacheGetAttr().
Definition at line 228 of file catcache.c.
References a, b, and DatumGetInt16().
Referenced by GetCCHashEqFuncs().
Definition at line 234 of file catcache.c.
References DatumGetInt16(), and murmurhash32().
Referenced by GetCCHashEqFuncs().
Definition at line 240 of file catcache.c.
References a, b, and DatumGetInt32().
Referenced by GetCCHashEqFuncs().
Definition at line 246 of file catcache.c.
References DatumGetInt32(), and murmurhash32().
Referenced by GetCCHashEqFuncs().
Definition at line 203 of file catcache.c.
References a, b, DatumGetName(), fb(), NAMEDATALEN, and NameStr.
Referenced by GetCCHashEqFuncs().
Definition at line 216 of file catcache.c.
References DatumGetName(), fb(), hash_bytes(), and NameStr.
Referenced by GetCCHashEqFuncs().
Definition at line 272 of file catcache.c.
References a, b, DatumGetBool(), DirectFunctionCall2, and oidvectoreq().
Referenced by GetCCHashEqFuncs().
Definition at line 278 of file catcache.c.
References DatumGetInt32(), DirectFunctionCall1, and hashoidvector().
Referenced by GetCCHashEqFuncs().
| void PrepareToInvalidateCacheTuple | ( | Relation | relation, |
| HeapTuple | tuple, | ||
| HeapTuple | newtuple, | ||
| void(*)(int, uint32, Oid, void *) | function, | ||
| void * | context | ||
| ) |
Definition at line 2403 of file catcache.c.
References Assert, CACHE_elog, CacheHdr, CatalogCacheComputeTupleHashValue(), catcacheheader::ch_caches, ConditionalCatalogCacheInitializeCache(), slist_iter::cur, DEBUG2, fb(), function, HeapTupleIsValid, MyDatabaseId, RelationGetRelid, RelationIsValid, slist_container, and slist_foreach.
Referenced by CacheInvalidateHeapTupleCommon().
Definition at line 1003 of file catcache.c.
References CacheMemoryContext, dlist_mutable_iter::cur, DEBUG1, dlist_container, dlist_delete(), dlist_foreach_modify, dlist_push_tail(), elog, fb(), HASH_INDEX, i, MemoryContextAllocZero(), and pfree().
Referenced by CatalogCacheCreateEntry().
Definition at line 1048 of file catcache.c.
References CacheMemoryContext, dlist_mutable_iter::cur, DEBUG1, dlist_container, dlist_delete(), dlist_foreach_modify, dlist_push_tail(), elog, fb(), HASH_INDEX, i, MemoryContextAllocZero(), and pfree().
Referenced by SearchCatCacheList().
Definition at line 1679 of file catcache.c.
References CurrentResourceOwner, and ReleaseCatCacheWithOwner().
Referenced by ReleaseSysCache().
Definition at line 2125 of file catcache.c.
References CurrentResourceOwner, CatCInProgress::list, and ReleaseCatCacheListWithOwner().
Referenced by AddEnumLabel(), blvalidate(), brinvalidate(), btvalidate(), ginvalidate(), gistvalidate(), hashvalidate(), opclass_for_family_datatype(), RenameEnumLabel(), sepgsql_relation_drop(), spgvalidate(), and transformFrameOffset().
|
static |
Definition at line 2131 of file catcache.c.
References Assert, CatCacheRemoveCList(), CL_MAGIC, fb(), CatCInProgress::list, and ResourceOwnerForgetCatCacheListRef().
Referenced by ReleaseCatCacheList(), and ResOwnerReleaseCatCacheList().
|
static |
Definition at line 1685 of file catcache.c.
References Assert, CatCacheRemoveCTup(), CT_MAGIC, fb(), and ResourceOwnerForgetCatCacheRef().
Referenced by ReleaseCatCache(), and ResOwnerReleaseCatCache().
Definition at line 754 of file catcache.c.
References Assert, CatCInProgress::cache, catcache_in_progress_stack, CatCacheRemoveCList(), CatCacheRemoveCTup(), catcache::cc_bucket, catcache::cc_lbucket, catcache::cc_nbuckets, catcache::cc_nlbuckets, dlist_mutable_iter::cur, dlist_container, dlist_foreach_modify, fb(), i, and CatCInProgress::next.
Referenced by CatalogCacheFlushCatalog(), and ResetCatalogCachesExt().
Definition at line 822 of file catcache.c.
References CatCInProgress::cache, CACHE_elog, CacheHdr, catcacheheader::ch_caches, slist_iter::cur, DEBUG2, fb(), ResetCatalogCache(), slist_container, and slist_foreach.
Referenced by InvalidateSystemCachesExtended(), and ResetCatalogCaches().
|
inlinestatic |
Definition at line 174 of file catcache.c.
References catlistref_resowner_desc, CatCInProgress::list, PointerGetDatum, and ResourceOwnerForget().
Referenced by ReleaseCatCacheListWithOwner().
|
inlinestatic |
Definition at line 164 of file catcache.c.
References catcache_resowner_desc, PointerGetDatum, and ResourceOwnerForget().
Referenced by ReleaseCatCacheWithOwner().
|
inlinestatic |
Definition at line 169 of file catcache.c.
References catlistref_resowner_desc, CatCInProgress::list, PointerGetDatum, and ResourceOwnerRemember().
Referenced by SearchCatCacheList().
|
inlinestatic |
Definition at line 159 of file catcache.c.
References catcache_resowner_desc, PointerGetDatum, and ResourceOwnerRemember().
Referenced by SearchCatCacheInternal(), and SearchCatCacheMiss().
Definition at line 2470 of file catcache.c.
References Assert, CT_MAGIC, DatumGetPointer(), fb(), ItemPointerGetBlockNumber(), ItemPointerGetOffsetNumber(), psprintf(), and HeapTupleData::t_self.
Definition at line 2493 of file catcache.c.
References DatumGetPointer(), CatCInProgress::list, and psprintf().
Definition at line 2464 of file catcache.c.
References DatumGetPointer(), fb(), and ReleaseCatCacheWithOwner().
Definition at line 2487 of file catcache.c.
References DatumGetPointer(), fb(), and ReleaseCatCacheListWithOwner().
Definition at line 1372 of file catcache.c.
References CatCInProgress::cache, catcache::cc_nkeys, fb(), and SearchCatCacheInternal().
Referenced by SearchSysCache().
Definition at line 1389 of file catcache.c.
References CatCInProgress::cache, and SearchCatCacheInternal().
Referenced by SearchSysCache1().
Definition at line 1397 of file catcache.c.
References CatCInProgress::cache, fb(), and SearchCatCacheInternal().
Referenced by SearchSysCache2().
Definition at line 1405 of file catcache.c.
References CatCInProgress::cache, fb(), and SearchCatCacheInternal().
Referenced by SearchSysCache3().
Definition at line 1413 of file catcache.c.
References CatCInProgress::cache, fb(), and SearchCatCacheInternal().
Referenced by SearchSysCache4().
|
inlinestatic |
Definition at line 1423 of file catcache.c.
References Assert, CatCInProgress::cache, CACHE_elog, CatalogCacheCompareTuple(), CatalogCacheComputeHashValue(), CATCACHE_MAXKEYS, catcache::cc_bucket, catcache::cc_nbuckets, catcache::cc_nkeys, catcache::cc_relname, ConditionalCatalogCacheInitializeCache(), dlist_iter::cur, CurrentResourceOwner, DEBUG2, dlist_container, dlist_foreach, dlist_move_head(), fb(), HASH_INDEX, ResourceOwnerEnlarge(), ResourceOwnerRememberCatCacheRef(), and SearchCatCacheMiss().
Referenced by SearchCatCache(), SearchCatCache1(), SearchCatCache2(), SearchCatCache3(), and SearchCatCache4().
Definition at line 1751 of file catcache.c.
References AccessShareLock, Assert, CatCInProgress::cache, CACHE_elog, CacheMemoryContext, CatalogCacheCompareTuple(), CatalogCacheComputeHashValue(), CatalogCacheComputeTupleHashValue(), CatalogCacheCreateEntry(), catcache_in_progress_stack, CATCACHE_MAXKEYS, CatCacheCopyKeys(), CatCacheRemoveCTup(), catcache::cc_bucket, catcache::cc_indexoid, catcache::cc_keyno, catcache::cc_lbucket, catcache::cc_nbuckets, catcache::cc_nkeys, catcache::cc_nlbuckets, catcache::cc_nlist, catcache::cc_relname, catcache::cc_reloid, catcache::cc_skey, catcache::cc_tupdesc, CL_MAGIC, ConditionalCatalogCacheInitializeCache(), dlist_iter::cur, CurrentResourceOwner, DEBUG2, dlist_container, dlist_foreach, dlist_move_head(), dlist_push_head(), fb(), HASH_INDEX, HeapTupleIsValid, i, IndexScanOK(), INJECTION_POINT, SysScanDescData::irel, ItemPointerEquals(), lappend(), lfirst, list_length(), memcpy(), MemoryContextAllocZero(), MemoryContextSwitchTo(), CatCInProgress::next, NIL, palloc(), PG_CATCH, PG_END_TRY, PG_RE_THROW, PG_TRY, RehashCatCacheLists(), ResourceOwnerEnlarge(), ResourceOwnerRememberCatCacheListRef(), systable_beginscan(), systable_endscan(), systable_getnext(), table_close(), and table_open().
Referenced by SearchSysCacheList().
|
static |
Definition at line 1531 of file catcache.c.
References AccessShareLock, Assert, CatCInProgress::cache, CACHE_elog, CacheHdr, CatalogCacheCreateEntry(), CATCACHE_MAXKEYS, catcache::cc_indexoid, catcache::cc_ntup, catcache::cc_relname, catcache::cc_reloid, catcache::cc_skey, catcacheheader::ch_ntup, CurrentResourceOwner, DEBUG2, fb(), HeapTupleIsValid, IndexScanOK(), IsBootstrapProcessingMode, memcpy(), ResourceOwnerEnlarge(), ResourceOwnerRememberCatCacheRef(), systable_beginscan(), systable_endscan(), systable_getnext(), table_close(), and table_open().
Referenced by SearchCatCacheInternal().
Definition at line 252 of file catcache.c.
References a, b, DatumGetBool(), DirectFunctionCall2Coll(), fb(), and texteq().
Referenced by GetCCHashEqFuncs().
Definition at line 262 of file catcache.c.
References DatumGetInt32(), DirectFunctionCall1Coll(), fb(), and hashtext().
Referenced by GetCCHashEqFuncs().
|
static |
Definition at line 84 of file catcache.c.
Referenced by CatalogCacheCreateEntry(), CatalogCacheFlushCatalog(), CatCacheRemoveCTup(), InitCatCache(), PrepareToInvalidateCacheTuple(), ResetCatalogCachesExt(), and SearchCatCacheMiss().
|
static |
Definition at line 61 of file catcache.c.
Referenced by CatalogCacheCreateEntry(), CatCacheInvalidate(), ResetCatalogCache(), and SearchCatCacheList().
|
static |
Definition at line 137 of file catcache.c.
Referenced by ResourceOwnerForgetCatCacheRef(), and ResourceOwnerRememberCatCacheRef().
|
static |
Definition at line 147 of file catcache.c.
Referenced by ResourceOwnerForgetCatCacheListRef(), and ResourceOwnerRememberCatCacheListRef().