PostgreSQL Source Code git master
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
inval.h File Reference
#include "access/htup.h"
#include "storage/relfilelocator.h"
#include "utils/relcache.h"
Include dependency graph for inval.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Typedefs

typedef void(* SyscacheCallbackFunction) (Datum arg, int cacheid, uint32 hashvalue)
 
typedef void(* RelcacheCallbackFunction) (Datum arg, Oid relid)
 
typedef void(* RelSyncCallbackFunction) (Datum arg, Oid relid)
 

Functions

void AcceptInvalidationMessages (void)
 
void AtEOXact_Inval (bool isCommit)
 
void PreInplace_Inval (void)
 
void AtInplace_Inval (void)
 
void ForgetInplace_Inval (void)
 
void AtEOSubXact_Inval (bool isCommit)
 
void PostPrepare_Inval (void)
 
void CommandEndInvalidationMessages (void)
 
void CacheInvalidateHeapTuple (Relation relation, HeapTuple tuple, HeapTuple newtuple)
 
void CacheInvalidateHeapTupleInplace (Relation relation, HeapTuple tuple, HeapTuple newtuple)
 
void CacheInvalidateCatalog (Oid catalogId)
 
void CacheInvalidateRelcache (Relation relation)
 
void CacheInvalidateRelcacheAll (void)
 
void CacheInvalidateRelcacheByTuple (HeapTuple classTuple)
 
void CacheInvalidateRelcacheByRelid (Oid relid)
 
void CacheInvalidateRelSync (Oid relid)
 
void CacheInvalidateRelSyncAll (void)
 
void CacheInvalidateSmgr (RelFileLocatorBackend rlocator)
 
void CacheInvalidateRelmap (Oid databaseId)
 
void CacheRegisterSyscacheCallback (int cacheid, SyscacheCallbackFunction func, Datum arg)
 
void CacheRegisterRelcacheCallback (RelcacheCallbackFunction func, Datum arg)
 
void CacheRegisterRelSyncCallback (RelSyncCallbackFunction func, Datum arg)
 
void CallSyscacheCallbacks (int cacheid, uint32 hashvalue)
 
void CallRelSyncCallbacks (Oid relid)
 
void InvalidateSystemCaches (void)
 
void InvalidateSystemCachesExtended (bool debug_discard)
 
void LogLogicalInvalidations (void)
 

Variables

PGDLLIMPORT int debug_discard_caches
 

Typedef Documentation

◆ RelcacheCallbackFunction

typedef void(* RelcacheCallbackFunction) (Datum arg, Oid relid)

Definition at line 24 of file inval.h.

◆ RelSyncCallbackFunction

typedef void(* RelSyncCallbackFunction) (Datum arg, Oid relid)

Definition at line 25 of file inval.h.

◆ SyscacheCallbackFunction

typedef void(* SyscacheCallbackFunction) (Datum arg, int cacheid, uint32 hashvalue)

Definition at line 23 of file inval.h.

Function Documentation

◆ AcceptInvalidationMessages()

void AcceptInvalidationMessages ( void  )

Definition at line 929 of file inval.c.

930{
933
934 /*----------
935 * Test code to force cache flushes anytime a flush could happen.
936 *
937 * This helps detect intermittent faults caused by code that reads a cache
938 * entry and then performs an action that could invalidate the entry, but
939 * rarely actually does so. This can spot issues that would otherwise
940 * only arise with badly timed concurrent DDL, for example.
941 *
942 * The default debug_discard_caches = 0 does no forced cache flushes.
943 *
944 * If used with CLOBBER_FREED_MEMORY,
945 * debug_discard_caches = 1 (formerly known as CLOBBER_CACHE_ALWAYS)
946 * provides a fairly thorough test that the system contains no cache-flush
947 * hazards. However, it also makes the system unbelievably slow --- the
948 * regression tests take about 100 times longer than normal.
949 *
950 * If you're a glutton for punishment, try
951 * debug_discard_caches = 3 (formerly known as CLOBBER_CACHE_RECURSIVELY).
952 * This slows things by at least a factor of 10000, so I wouldn't suggest
953 * trying to run the entire regression tests that way. It's useful to try
954 * a few simple tests, to make sure that cache reload isn't subject to
955 * internal cache-flush hazards, but after you've done a few thousand
956 * recursive reloads it's unlikely you'll learn more.
957 *----------
958 */
959#ifdef DISCARD_CACHES_ENABLED
960 {
961 static int recursion_depth = 0;
962
964 {
968 }
969 }
970#endif
971}
static int recursion_depth
Definition: elog.c:150
void InvalidateSystemCachesExtended(bool debug_discard)
Definition: inval.c:784
void LocalExecuteInvalidationMessage(SharedInvalidationMessage *msg)
Definition: inval.c:822
void InvalidateSystemCaches(void)
Definition: inval.c:915
int debug_discard_caches
Definition: inval.c:260
void ReceiveSharedInvalidMessages(void(*invalFunction)(SharedInvalidationMessage *msg), void(*resetFunction)(void))
Definition: sinval.c:69

References debug_discard_caches, InvalidateSystemCaches(), InvalidateSystemCachesExtended(), LocalExecuteInvalidationMessage(), ReceiveSharedInvalidMessages(), and recursion_depth.

Referenced by apply_handle_commit_internal(), AtStart_Cache(), ConditionalLockDatabaseObject(), ConditionalLockRelation(), ConditionalLockRelationOid(), ConditionalLockSharedObject(), delay_execution_planner(), heap_inplace_update_and_unlock(), InitializeSessionUserId(), LockDatabaseObject(), LockRelation(), LockRelationId(), LockRelationOid(), LockSharedObject(), LogicalRepApplyLoop(), pgstat_init_function_usage(), ProcessCatchupInterrupt(), RangeVarGetRelidExtended(), relation_openrv(), relation_openrv_extended(), RelationBuildPartitionDesc(), RemoveRelations(), SearchSysCacheLocked1(), and write_relcache_init_file().

◆ AtEOSubXact_Inval()

void AtEOSubXact_Inval ( bool  isCommit)

Definition at line 1303 of file inval.c.

1304{
1305 int my_level;
1306 TransInvalidationInfo *myInfo;
1307
1308 /*
1309 * Successful inplace update must clear this, but we clear it on abort.
1310 * Inplace updates allocate this in CurrentMemoryContext, which has
1311 * lifespan <= subtransaction lifespan. Hence, don't free it explicitly.
1312 */
1313 if (isCommit)
1314 Assert(inplaceInvalInfo == NULL);
1315 else
1316 inplaceInvalInfo = NULL;
1317
1318 /* Quick exit if no transactional messages. */
1319 myInfo = transInvalInfo;
1320 if (myInfo == NULL)
1321 return;
1322
1323 /* Also bail out quickly if messages are not for this level. */
1324 my_level = GetCurrentTransactionNestLevel();
1325 if (myInfo->my_level != my_level)
1326 {
1327 Assert(myInfo->my_level < my_level);
1328 return;
1329 }
1330
1331 if (isCommit)
1332 {
1333 /* If CurrentCmdInvalidMsgs still has anything, fix it */
1335
1336 /*
1337 * We create invalidation stack entries lazily, so the parent might
1338 * not have one. Instead of creating one, moving all the data over,
1339 * and then freeing our own, we can just adjust the level of our own
1340 * entry.
1341 */
1342 if (myInfo->parent == NULL || myInfo->parent->my_level < my_level - 1)
1343 {
1344 myInfo->my_level--;
1345 return;
1346 }
1347
1348 /*
1349 * Pass up my inval messages to parent. Notice that we stick them in
1350 * PriorCmdInvalidMsgs, not CurrentCmdInvalidMsgs, since they've
1351 * already been locally processed. (This would trigger the Assert in
1352 * AppendInvalidationMessageSubGroup if the parent's
1353 * CurrentCmdInvalidMsgs isn't empty; but we already checked that in
1354 * PrepareInvalidationState.)
1355 */
1357 &myInfo->PriorCmdInvalidMsgs);
1358
1359 /* Must readjust parent's CurrentCmdInvalidMsgs indexes now */
1361 &myInfo->parent->PriorCmdInvalidMsgs);
1362
1363 /* Pending relcache inval becomes parent's problem too */
1364 if (myInfo->ii.RelcacheInitFileInval)
1365 myInfo->parent->ii.RelcacheInitFileInval = true;
1366
1367 /* Pop the transaction state stack */
1368 transInvalInfo = myInfo->parent;
1369
1370 /* Need not free anything else explicitly */
1371 pfree(myInfo);
1372 }
1373 else
1374 {
1377
1378 /* Pop the transaction state stack */
1379 transInvalInfo = myInfo->parent;
1380
1381 /* Need not free anything else explicitly */
1382 pfree(myInfo);
1383 }
1384}
Assert(PointerIsAligned(start, uint64))
static void ProcessInvalidationMessages(InvalidationMsgsGroup *group, void(*func)(SharedInvalidationMessage *msg))
Definition: inval.c:574
static InvalidationInfo * inplaceInvalInfo
Definition: inval.c:257
static TransInvalidationInfo * transInvalInfo
Definition: inval.c:255
static void AppendInvalidationMessages(InvalidationMsgsGroup *dest, InvalidationMsgsGroup *src)
Definition: inval.c:560
#define SetGroupToFollow(targetgroup, priorgroup)
Definition: inval.c:198
void CommandEndInvalidationMessages(void)
Definition: inval.c:1402
void pfree(void *pointer)
Definition: mcxt.c:2147
bool RelcacheInitFileInval
Definition: inval.c:236
InvalidationMsgsGroup CurrentCmdInvalidMsgs
Definition: inval.c:233
struct TransInvalidationInfo * parent
Definition: inval.c:249
struct InvalidationInfo ii
Definition: inval.c:243
InvalidationMsgsGroup PriorCmdInvalidMsgs
Definition: inval.c:246
int GetCurrentTransactionNestLevel(void)
Definition: xact.c:929

References AppendInvalidationMessages(), Assert(), CommandEndInvalidationMessages(), InvalidationInfo::CurrentCmdInvalidMsgs, GetCurrentTransactionNestLevel(), TransInvalidationInfo::ii, inplaceInvalInfo, LocalExecuteInvalidationMessage(), TransInvalidationInfo::my_level, TransInvalidationInfo::parent, pfree(), TransInvalidationInfo::PriorCmdInvalidMsgs, ProcessInvalidationMessages(), InvalidationInfo::RelcacheInitFileInval, SetGroupToFollow, and transInvalInfo.

Referenced by AbortSubTransaction(), and CommitSubTransaction().

◆ AtEOXact_Inval()

void AtEOXact_Inval ( bool  isCommit)

Definition at line 1192 of file inval.c.

1193{
1194 inplaceInvalInfo = NULL;
1195
1196 /* Quick exit if no transactional messages */
1197 if (transInvalInfo == NULL)
1198 return;
1199
1200 /* Must be at top of stack */
1202
1203 INJECTION_POINT("AtEOXact_Inval-with-transInvalInfo");
1204
1205 if (isCommit)
1206 {
1207 /*
1208 * Relcache init file invalidation requires processing both before and
1209 * after we send the SI messages. However, we need not do anything
1210 * unless we committed.
1211 */
1214
1217
1220
1223 }
1224 else
1225 {
1228 }
1229
1230 /* Need not free anything explicitly */
1231 transInvalInfo = NULL;
1232}
#define INJECTION_POINT(name)
static void ProcessInvalidationMessagesMulti(InvalidationMsgsGroup *group, void(*func)(const SharedInvalidationMessage *msgs, int n))
Definition: inval.c:586
void RelationCacheInitFilePostInvalidate(void)
Definition: relcache.c:6868
void RelationCacheInitFilePreInvalidate(void)
Definition: relcache.c:6843
void SendSharedInvalidMessages(const SharedInvalidationMessage *msgs, int n)
Definition: sinval.c:47

References AppendInvalidationMessages(), Assert(), InvalidationInfo::CurrentCmdInvalidMsgs, TransInvalidationInfo::ii, INJECTION_POINT, inplaceInvalInfo, LocalExecuteInvalidationMessage(), TransInvalidationInfo::my_level, TransInvalidationInfo::parent, TransInvalidationInfo::PriorCmdInvalidMsgs, ProcessInvalidationMessages(), ProcessInvalidationMessagesMulti(), RelationCacheInitFilePostInvalidate(), RelationCacheInitFilePreInvalidate(), InvalidationInfo::RelcacheInitFileInval, SendSharedInvalidMessages(), and transInvalInfo.

Referenced by AbortTransaction(), CommitTransaction(), and PostPrepare_Inval().

◆ AtInplace_Inval()

◆ CacheInvalidateCatalog()

void CacheInvalidateCatalog ( Oid  catalogId)

Definition at line 1598 of file inval.c.

1599{
1600 Oid databaseId;
1601
1602 if (IsSharedRelation(catalogId))
1603 databaseId = InvalidOid;
1604 else
1605 databaseId = MyDatabaseId;
1606
1608 databaseId, catalogId);
1609}
bool IsSharedRelation(Oid relationId)
Definition: catalog.c:273
Oid MyDatabaseId
Definition: globals.c:95
static InvalidationInfo * PrepareInvalidationState(void)
Definition: inval.c:682
static void RegisterCatalogInvalidation(InvalidationInfo *info, Oid dbId, Oid catId)
Definition: inval.c:621
#define InvalidOid
Definition: postgres_ext.h:35
unsigned int Oid
Definition: postgres_ext.h:30

References InvalidOid, IsSharedRelation(), MyDatabaseId, PrepareInvalidationState(), and RegisterCatalogInvalidation().

Referenced by finish_heap_swap().

◆ CacheInvalidateHeapTuple()

void CacheInvalidateHeapTuple ( Relation  relation,
HeapTuple  tuple,
HeapTuple  newtuple 
)

Definition at line 1561 of file inval.c.

1564{
1565 CacheInvalidateHeapTupleCommon(relation, tuple, newtuple,
1567}
static void CacheInvalidateHeapTupleCommon(Relation relation, HeapTuple tuple, HeapTuple newtuple, InvalidationInfo *(*prepare_callback)(void))
Definition: inval.c:1429

References CacheInvalidateHeapTupleCommon(), and PrepareInvalidationState().

Referenced by AlterDomainAddConstraint(), AlterDomainDropConstraint(), heap_delete(), heap_inplace_update_and_unlock(), heap_insert(), heap_multi_insert(), and heap_update().

◆ CacheInvalidateHeapTupleInplace()

void CacheInvalidateHeapTupleInplace ( Relation  relation,
HeapTuple  tuple,
HeapTuple  newtuple 
)

Definition at line 1578 of file inval.c.

1581{
1582 CacheInvalidateHeapTupleCommon(relation, tuple, newtuple,
1584}
static InvalidationInfo * PrepareInplaceInvalidationState(void)
Definition: inval.c:751

References CacheInvalidateHeapTupleCommon(), and PrepareInplaceInvalidationState().

Referenced by heap_inplace_lock().

◆ CacheInvalidateRelcache()

◆ CacheInvalidateRelcacheAll()

◆ CacheInvalidateRelcacheByRelid()

void CacheInvalidateRelcacheByRelid ( Oid  relid)

Definition at line 1677 of file inval.c.

1678{
1679 HeapTuple tup;
1680
1681 tup = SearchSysCache1(RELOID, ObjectIdGetDatum(relid));
1682 if (!HeapTupleIsValid(tup))
1683 elog(ERROR, "cache lookup failed for relation %u", relid);
1685 ReleaseSysCache(tup);
1686}
#define ERROR
Definition: elog.h:39
#define elog(elevel,...)
Definition: elog.h:226
#define HeapTupleIsValid(tuple)
Definition: htup.h:78
void CacheInvalidateRelcacheByTuple(HeapTuple classTuple)
Definition: inval.c:1655
static Datum ObjectIdGetDatum(Oid X)
Definition: postgres.h:257
void ReleaseSysCache(HeapTuple tuple)
Definition: syscache.c:269
HeapTuple SearchSysCache1(int cacheId, Datum key1)
Definition: syscache.c:221

References CacheInvalidateRelcacheByTuple(), elog, ERROR, HeapTupleIsValid, ObjectIdGetDatum(), ReleaseSysCache(), and SearchSysCache1().

Referenced by AlterConstrUpdateConstraintEntry(), ATExecAlterConstraintInternal(), ATExecAttachPartition(), DefineIndex(), DetachPartitionFinalize(), heap_drop_with_catalog(), InvalidatePublicationRels(), ReindexRelationConcurrently(), RemoveStatisticsById(), and StorePartitionBound().

◆ CacheInvalidateRelcacheByTuple()

void CacheInvalidateRelcacheByTuple ( HeapTuple  classTuple)

Definition at line 1655 of file inval.c.

1656{
1657 Form_pg_class classtup = (Form_pg_class) GETSTRUCT(classTuple);
1658 Oid databaseId;
1659 Oid relationId;
1660
1661 relationId = classtup->oid;
1662 if (classtup->relisshared)
1663 databaseId = InvalidOid;
1664 else
1665 databaseId = MyDatabaseId;
1667 databaseId, relationId);
1668}
static void * GETSTRUCT(const HeapTupleData *tuple)
Definition: htup_details.h:728
FormData_pg_class * Form_pg_class
Definition: pg_class.h:156

References GETSTRUCT(), InvalidOid, MyDatabaseId, PrepareInvalidationState(), and RegisterRelcacheInvalidation().

Referenced by CacheInvalidateRelcacheByRelid(), copy_table_data(), CreateTriggerFiringOn(), index_update_stats(), RemoveRoleFromObjectPolicy(), SetRelationHasSubclass(), SetRelationRuleStatus(), and swap_relation_files().

◆ CacheInvalidateRelmap()

void CacheInvalidateRelmap ( Oid  databaseId)

Definition at line 1775 of file inval.c.

1776{
1778
1780 msg.rm.dbId = databaseId;
1781 /* check AddCatcacheInvalidationMessage() for an explanation */
1782 VALGRIND_MAKE_MEM_DEFINED(&msg, sizeof(msg));
1783
1785}
#define VALGRIND_MAKE_MEM_DEFINED(addr, size)
Definition: memdebug.h:26
#define SHAREDINVALRELMAP_ID
Definition: sinval.h:97
SharedInvalRelmapMsg rm
Definition: sinval.h:131

References SharedInvalRelmapMsg::dbId, SharedInvalRelmapMsg::id, SharedInvalidationMessage::rm, SendSharedInvalidMessages(), SHAREDINVALRELMAP_ID, and VALGRIND_MAKE_MEM_DEFINED.

Referenced by write_relmap_file().

◆ CacheInvalidateRelSync()

void CacheInvalidateRelSync ( Oid  relid)

Definition at line 1698 of file inval.c.

1699{
1701 MyDatabaseId, relid);
1702}
static void RegisterRelsyncInvalidation(InvalidationInfo *info, Oid dbId, Oid relId)
Definition: inval.c:660

References MyDatabaseId, PrepareInvalidationState(), and RegisterRelsyncInvalidation().

Referenced by CacheInvalidateRelSyncAll(), and InvalidatePubRelSyncCache().

◆ CacheInvalidateRelSyncAll()

void CacheInvalidateRelSyncAll ( void  )

Definition at line 1710 of file inval.c.

1711{
1713}
void CacheInvalidateRelSync(Oid relid)
Definition: inval.c:1698

References CacheInvalidateRelSync(), and InvalidOid.

Referenced by InvalidatePubRelSyncCache().

◆ CacheInvalidateSmgr()

void CacheInvalidateSmgr ( RelFileLocatorBackend  rlocator)

Definition at line 1741 of file inval.c.

1742{
1744
1745 /* verify optimization stated above stays valid */
1747 "MAX_BACKENDS_BITS is too big for inval.c");
1748
1749 msg.sm.id = SHAREDINVALSMGR_ID;
1750 msg.sm.backend_hi = rlocator.backend >> 16;
1751 msg.sm.backend_lo = rlocator.backend & 0xffff;
1752 msg.sm.rlocator = rlocator.locator;
1753 /* check AddCatcacheInvalidationMessage() for an explanation */
1754 VALGRIND_MAKE_MEM_DEFINED(&msg, sizeof(msg));
1755
1757}
#define StaticAssertStmt(condition, errmessage)
Definition: c.h:909
#define MAX_BACKENDS_BITS
Definition: procnumber.h:38
#define SHAREDINVALSMGR_ID
Definition: sinval.h:86
RelFileLocator locator
uint16 backend_lo
Definition: sinval.h:93
RelFileLocator rlocator
Definition: sinval.h:94
SharedInvalSmgrMsg sm
Definition: sinval.h:130

References RelFileLocatorBackend::backend, SharedInvalSmgrMsg::backend_hi, SharedInvalSmgrMsg::backend_lo, SharedInvalSmgrMsg::id, RelFileLocatorBackend::locator, MAX_BACKENDS_BITS, SharedInvalSmgrMsg::rlocator, SendSharedInvalidMessages(), SHAREDINVALSMGR_ID, SharedInvalidationMessage::sm, StaticAssertStmt, and VALGRIND_MAKE_MEM_DEFINED.

Referenced by smgrdounlinkall(), smgrtruncate(), and vm_extend().

◆ CacheRegisterRelcacheCallback()

void CacheRegisterRelcacheCallback ( RelcacheCallbackFunction  func,
Datum  arg 
)

Definition at line 1844 of file inval.c.

1846{
1848 elog(FATAL, "out of relcache_callback_list slots");
1849
1852
1854}
#define FATAL
Definition: elog.h:41
static int relcache_callback_count
Definition: inval.c:294
static struct RELCACHECALLBACK relcache_callback_list[MAX_RELCACHE_CALLBACKS]
#define MAX_RELCACHE_CALLBACKS
Definition: inval.c:273
void * arg
RelcacheCallbackFunction function
Definition: inval.c:290

References RELCACHECALLBACK::arg, arg, elog, FATAL, RELCACHECALLBACK::function, MAX_RELCACHE_CALLBACKS, relcache_callback_count, and relcache_callback_list.

Referenced by init_rel_sync_cache(), InitializeRelfilenumberMap(), InitPlanCache(), logicalrep_partmap_init(), logicalrep_relmap_init(), and lookup_type_cache().

◆ CacheRegisterRelSyncCallback()

void CacheRegisterRelSyncCallback ( RelSyncCallbackFunction  func,
Datum  arg 
)

Definition at line 1865 of file inval.c.

1867{
1869 elog(FATAL, "out of relsync_callback_list slots");
1870
1873
1875}
static int relsync_callback_count
Definition: inval.c:302
static struct RELSYNCCALLBACK relsync_callback_list[MAX_RELSYNC_CALLBACKS]
#define MAX_RELSYNC_CALLBACKS
Definition: inval.c:274
RelSyncCallbackFunction function
Definition: inval.c:298
Datum arg
Definition: inval.c:299

References RELSYNCCALLBACK::arg, arg, elog, FATAL, RELSYNCCALLBACK::function, MAX_RELSYNC_CALLBACKS, relsync_callback_count, and relsync_callback_list.

Referenced by pgoutput_startup().

◆ CacheRegisterSyscacheCallback()

void CacheRegisterSyscacheCallback ( int  cacheid,
SyscacheCallbackFunction  func,
Datum  arg 
)

Definition at line 1802 of file inval.c.

1805{
1806 if (cacheid < 0 || cacheid >= SysCacheSize)
1807 elog(FATAL, "invalid cache ID: %d", cacheid);
1809 elog(FATAL, "out of syscache_callback_list slots");
1810
1811 if (syscache_callback_links[cacheid] == 0)
1812 {
1813 /* first callback for this cache */
1815 }
1816 else
1817 {
1818 /* add to end of chain, so that older callbacks are called first */
1819 int i = syscache_callback_links[cacheid] - 1;
1820
1821 while (syscache_callback_list[i].link > 0)
1824 }
1825
1830
1832}
static struct SYSCACHECALLBACK syscache_callback_list[MAX_SYSCACHE_CALLBACKS]
#define MAX_SYSCACHE_CALLBACKS
Definition: inval.c:272
static int16 syscache_callback_links[SysCacheSize]
Definition: inval.c:284
static int syscache_callback_count
Definition: inval.c:286
int i
Definition: isn.c:77
SyscacheCallbackFunction function
Definition: inval.c:280
int16 link
Definition: inval.c:279

References SYSCACHECALLBACK::arg, arg, elog, FATAL, SYSCACHECALLBACK::function, i, SYSCACHECALLBACK::id, SYSCACHECALLBACK::link, MAX_SYSCACHE_CALLBACKS, syscache_callback_count, syscache_callback_links, and syscache_callback_list.

Referenced by BuildEventTriggerCache(), find_oper_cache_entry(), GetConnection(), init_rel_sync_cache(), init_ts_config_cache(), initialize_acl(), InitializeAttoptCache(), InitializeLogRepWorker(), InitializeSearchPath(), InitializeShippableCache(), InitializeTableSpaceCache(), InitPlanCache(), lookup_proof_cache(), lookup_ts_dictionary_cache(), lookup_ts_parser_cache(), lookup_type_cache(), ParallelApplyWorkerMain(), pgoutput_startup(), ri_InitHashTables(), SetupApplyOrSyncWorker(), and superuser_arg().

◆ CallRelSyncCallbacks()

void CallRelSyncCallbacks ( Oid  relid)

Definition at line 1906 of file inval.c.

1907{
1908 for (int i = 0; i < relsync_callback_count; i++)
1909 {
1910 struct RELSYNCCALLBACK *ccitem = relsync_callback_list + i;
1911
1912 ccitem->function(ccitem->arg, relid);
1913 }
1914}

References RELSYNCCALLBACK::arg, RELSYNCCALLBACK::function, i, relsync_callback_count, and relsync_callback_list.

Referenced by LocalExecuteInvalidationMessage().

◆ CallSyscacheCallbacks()

void CallSyscacheCallbacks ( int  cacheid,
uint32  hashvalue 
)

Definition at line 1884 of file inval.c.

1885{
1886 int i;
1887
1888 if (cacheid < 0 || cacheid >= SysCacheSize)
1889 elog(ERROR, "invalid cache ID: %d", cacheid);
1890
1891 i = syscache_callback_links[cacheid] - 1;
1892 while (i >= 0)
1893 {
1894 struct SYSCACHECALLBACK *ccitem = syscache_callback_list + i;
1895
1896 Assert(ccitem->id == cacheid);
1897 ccitem->function(ccitem->arg, cacheid, hashvalue);
1898 i = ccitem->link - 1;
1899 }
1900}

References SYSCACHECALLBACK::arg, Assert(), elog, ERROR, SYSCACHECALLBACK::function, i, SYSCACHECALLBACK::id, SYSCACHECALLBACK::link, syscache_callback_links, and syscache_callback_list.

Referenced by CatalogCacheFlushCatalog(), and LocalExecuteInvalidationMessage().

◆ CommandEndInvalidationMessages()

void CommandEndInvalidationMessages ( void  )

Definition at line 1402 of file inval.c.

1403{
1404 /*
1405 * You might think this shouldn't be called outside any transaction, but
1406 * bootstrap does it, and also ABORT issued when not in a transaction. So
1407 * just quietly return if no state to work on.
1408 */
1409 if (transInvalInfo == NULL)
1410 return;
1411
1414
1415 /* WAL Log per-command invalidation messages for wal_level=logical */
1418
1421}
void LogLogicalInvalidations(void)
Definition: inval.c:1925
#define XLogLogicalInfoActive()
Definition: xlog.h:126

References AppendInvalidationMessages(), InvalidationInfo::CurrentCmdInvalidMsgs, TransInvalidationInfo::ii, LocalExecuteInvalidationMessage(), LogLogicalInvalidations(), TransInvalidationInfo::PriorCmdInvalidMsgs, ProcessInvalidationMessages(), transInvalInfo, and XLogLogicalInfoActive.

Referenced by AtCCI_LocalCache(), and AtEOSubXact_Inval().

◆ ForgetInplace_Inval()

void ForgetInplace_Inval ( void  )

Definition at line 1279 of file inval.c.

1280{
1281 inplaceInvalInfo = NULL;
1282}

References inplaceInvalInfo.

Referenced by heap_inplace_lock(), and heap_inplace_unlock().

◆ InvalidateSystemCaches()

◆ InvalidateSystemCachesExtended()

void InvalidateSystemCachesExtended ( bool  debug_discard)

Definition at line 784 of file inval.c.

785{
786 int i;
787
789 ResetCatalogCachesExt(debug_discard);
790 RelationCacheInvalidate(debug_discard); /* gets smgr and relmap too */
791
792 for (i = 0; i < syscache_callback_count; i++)
793 {
794 struct SYSCACHECALLBACK *ccitem = syscache_callback_list + i;
795
796 ccitem->function(ccitem->arg, ccitem->id, 0);
797 }
798
799 for (i = 0; i < relcache_callback_count; i++)
800 {
801 struct RELCACHECALLBACK *ccitem = relcache_callback_list + i;
802
803 ccitem->function(ccitem->arg, InvalidOid);
804 }
805
806 for (i = 0; i < relsync_callback_count; i++)
807 {
808 struct RELSYNCCALLBACK *ccitem = relsync_callback_list + i;
809
810 ccitem->function(ccitem->arg, InvalidOid);
811 }
812}
void ResetCatalogCachesExt(bool debug_discard)
Definition: catcache.c:804
void RelationCacheInvalidate(bool debug_discard)
Definition: relcache.c:2980
void InvalidateCatalogSnapshot(void)
Definition: snapmgr.c:443

References SYSCACHECALLBACK::arg, RELCACHECALLBACK::arg, RELSYNCCALLBACK::arg, SYSCACHECALLBACK::function, RELCACHECALLBACK::function, RELSYNCCALLBACK::function, i, SYSCACHECALLBACK::id, InvalidateCatalogSnapshot(), InvalidOid, RelationCacheInvalidate(), relcache_callback_count, relcache_callback_list, relsync_callback_count, relsync_callback_list, ResetCatalogCachesExt(), syscache_callback_count, and syscache_callback_list.

Referenced by AcceptInvalidationMessages(), and InvalidateSystemCaches().

◆ LogLogicalInvalidations()

void LogLogicalInvalidations ( void  )

Definition at line 1925 of file inval.c.

1926{
1927 xl_xact_invals xlrec;
1928 InvalidationMsgsGroup *group;
1929 int nmsgs;
1930
1931 /* Quick exit if we haven't done anything with invalidation messages. */
1932 if (transInvalInfo == NULL)
1933 return;
1934
1936 nmsgs = NumMessagesInGroup(group);
1937
1938 if (nmsgs > 0)
1939 {
1940 /* prepare record */
1941 memset(&xlrec, 0, MinSizeOfXactInvals);
1942 xlrec.nmsgs = nmsgs;
1943
1944 /* perform insertion */
1948 XLogRegisterData(msgs,
1949 n * sizeof(SharedInvalidationMessage)));
1951 XLogRegisterData(msgs,
1952 n * sizeof(SharedInvalidationMessage)));
1954 }
1955}
#define NumMessagesInGroup(group)
Definition: inval.c:207
#define CatCacheMsgs
Definition: inval.c:171
#define ProcessMessageSubGroupMulti(group, subgroup, codeFragment)
Definition: inval.c:402
#define RelCacheMsgs
Definition: inval.c:172
int nmsgs
Definition: xact.h:304
#define MinSizeOfXactInvals
Definition: xact.h:307
#define XLOG_XACT_INVALIDATIONS
Definition: xact.h:175
XLogRecPtr XLogInsert(RmgrId rmid, uint8 info)
Definition: xloginsert.c:474
void XLogRegisterData(const void *data, uint32 len)
Definition: xloginsert.c:364
void XLogBeginInsert(void)
Definition: xloginsert.c:149

References CatCacheMsgs, InvalidationInfo::CurrentCmdInvalidMsgs, TransInvalidationInfo::ii, MinSizeOfXactInvals, xl_xact_invals::nmsgs, NumMessagesInGroup, ProcessMessageSubGroupMulti, RelCacheMsgs, transInvalInfo, XLOG_XACT_INVALIDATIONS, XLogBeginInsert(), XLogInsert(), and XLogRegisterData().

Referenced by CommandEndInvalidationMessages(), and RecordTransactionCommit().

◆ PostPrepare_Inval()

void PostPrepare_Inval ( void  )

Definition at line 986 of file inval.c.

987{
988 AtEOXact_Inval(false);
989}
void AtEOXact_Inval(bool isCommit)
Definition: inval.c:1192

References AtEOXact_Inval().

Referenced by PrepareTransaction().

◆ PreInplace_Inval()

Variable Documentation

◆ debug_discard_caches

PGDLLIMPORT int debug_discard_caches
extern

Definition at line 260 of file inval.c.

Referenced by AcceptInvalidationMessages(), LookupOpclassInfo(), and RelationBuildDesc().