PostgreSQL Source Code git master
Loading...
Searching...
No Matches
inval.h File Reference
#include "access/htup.h"
#include "catalog/syscache_ids.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.

Macros

#define MIN_DEBUG_DISCARD_CACHES   0
 
#define DEFAULT_DEBUG_DISCARD_CACHES   0
 
#define MAX_DEBUG_DISCARD_CACHES   0
 

Typedefs

typedef void(* SyscacheCallbackFunction) (Datum arg, SysCacheIdentifier 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 key_equivalent_tuple)
 
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 (SysCacheIdentifier cacheid, SyscacheCallbackFunction func, Datum arg)
 
void CacheRegisterRelcacheCallback (RelcacheCallbackFunction func, Datum arg)
 
void CacheRegisterRelSyncCallback (RelSyncCallbackFunction func, Datum arg)
 
void CallSyscacheCallbacks (SysCacheIdentifier cacheid, uint32 hashvalue)
 
void CallRelSyncCallbacks (Oid relid)
 
void InvalidateSystemCaches (void)
 
void InvalidateSystemCachesExtended (bool debug_discard)
 
void LogLogicalInvalidations (void)
 

Variables

PGDLLIMPORT int debug_discard_caches
 

Macro Definition Documentation

◆ DEFAULT_DEBUG_DISCARD_CACHES

#define DEFAULT_DEBUG_DISCARD_CACHES   0

Definition at line 37 of file inval.h.

◆ MAX_DEBUG_DISCARD_CACHES

#define MAX_DEBUG_DISCARD_CACHES   0

Definition at line 38 of file inval.h.

◆ MIN_DEBUG_DISCARD_CACHES

#define MIN_DEBUG_DISCARD_CACHES   0

Definition at line 24 of file inval.h.

Typedef Documentation

◆ RelcacheCallbackFunction

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

Definition at line 44 of file inval.h.

◆ RelSyncCallbackFunction

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

Definition at line 45 of file inval.h.

◆ SyscacheCallbackFunction

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

Definition at line 42 of file inval.h.

Function Documentation

◆ AcceptInvalidationMessages()

void AcceptInvalidationMessages ( void  )
extern

Definition at line 930 of file inval.c.

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

References AssertCouldGetRelation(), debug_discard_caches, InvalidateSystemCaches(), InvalidateSystemCachesExtended(), IsTransactionState(), 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)
extern

Definition at line 1307 of file inval.c.

1308{
1309 int my_level;
1311
1312 /*
1313 * Successful inplace update must clear this, but we clear it on abort.
1314 * Inplace updates allocate this in CurrentMemoryContext, which has
1315 * lifespan <= subtransaction lifespan. Hence, don't free it explicitly.
1316 */
1317 if (isCommit)
1319 else
1321
1322 /* Quick exit if no transactional messages. */
1324 if (myInfo == NULL)
1325 return;
1326
1327 /* Also bail out quickly if messages are not for this level. */
1328 my_level = GetCurrentTransactionNestLevel();
1329 if (myInfo->my_level != my_level)
1330 {
1331 Assert(myInfo->my_level < my_level);
1332 return;
1333 }
1334
1335 if (isCommit)
1336 {
1337 /* If CurrentCmdInvalidMsgs still has anything, fix it */
1339
1340 /*
1341 * We create invalidation stack entries lazily, so the parent might
1342 * not have one. Instead of creating one, moving all the data over,
1343 * and then freeing our own, we can just adjust the level of our own
1344 * entry.
1345 */
1346 if (myInfo->parent == NULL || myInfo->parent->my_level < my_level - 1)
1347 {
1348 myInfo->my_level--;
1349 return;
1350 }
1351
1352 /*
1353 * Pass up my inval messages to parent. Notice that we stick them in
1354 * PriorCmdInvalidMsgs, not CurrentCmdInvalidMsgs, since they've
1355 * already been locally processed. (This would trigger the Assert in
1356 * AppendInvalidationMessageSubGroup if the parent's
1357 * CurrentCmdInvalidMsgs isn't empty; but we already checked that in
1358 * PrepareInvalidationState.)
1359 */
1360 AppendInvalidationMessages(&myInfo->parent->PriorCmdInvalidMsgs,
1361 &myInfo->PriorCmdInvalidMsgs);
1362
1363 /* Must readjust parent's CurrentCmdInvalidMsgs indexes now */
1364 SetGroupToFollow(&myInfo->parent->ii.CurrentCmdInvalidMsgs,
1365 &myInfo->parent->PriorCmdInvalidMsgs);
1366
1367 /* Pending relcache inval becomes parent's problem too */
1368 if (myInfo->ii.RelcacheInitFileInval)
1369 myInfo->parent->ii.RelcacheInitFileInval = true;
1370
1371 /* Pop the transaction state stack */
1373
1374 /* Need not free anything else explicitly */
1375 pfree(myInfo);
1376 }
1377 else
1378 {
1379 ProcessInvalidationMessages(&myInfo->PriorCmdInvalidMsgs,
1381
1382 /* Pop the transaction state stack */
1384
1385 /* Need not free anything else explicitly */
1386 pfree(myInfo);
1387 }
1388}
#define Assert(condition)
Definition c.h:943
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:1406
void pfree(void *pointer)
Definition mcxt.c:1619
static int fb(int x)
struct TransInvalidationInfo * parent
Definition inval.c:249
int GetCurrentTransactionNestLevel(void)
Definition xact.c:931

References AppendInvalidationMessages(), Assert, CommandEndInvalidationMessages(), fb(), GetCurrentTransactionNestLevel(), inplaceInvalInfo, LocalExecuteInvalidationMessage(), TransInvalidationInfo::parent, pfree(), ProcessInvalidationMessages(), SetGroupToFollow, and transInvalInfo.

Referenced by AbortSubTransaction(), and CommitSubTransaction().

◆ AtEOXact_Inval()

void AtEOXact_Inval ( bool  isCommit)
extern

Definition at line 1196 of file inval.c.

1197{
1199
1200 /* Quick exit if no transactional messages */
1201 if (transInvalInfo == NULL)
1202 return;
1203
1204 /* Must be at top of stack */
1206
1207 INJECTION_POINT("transaction-end-process-inval", NULL);
1208
1209 if (isCommit)
1210 {
1211 /*
1212 * Relcache init file invalidation requires processing both before and
1213 * after we send the SI messages. However, we need not do anything
1214 * unless we committed.
1215 */
1218
1221
1224
1227 }
1228 else
1229 {
1232 }
1233
1234 /* Need not free anything explicitly */
1236}
#define INJECTION_POINT(name, arg)
static void ProcessInvalidationMessagesMulti(InvalidationMsgsGroup *group, void(*func)(const SharedInvalidationMessage *msgs, int n))
Definition inval.c:586
void RelationCacheInitFilePostInvalidate(void)
Definition relcache.c:6911
void RelationCacheInitFilePreInvalidate(void)
Definition relcache.c:6886
void SendSharedInvalidMessages(const SharedInvalidationMessage *msgs, int n)
Definition sinval.c:47
bool RelcacheInitFileInval
Definition inval.c:236
InvalidationMsgsGroup CurrentCmdInvalidMsgs
Definition inval.c:233
struct InvalidationInfo ii
Definition inval.c:243
InvalidationMsgsGroup PriorCmdInvalidMsgs
Definition inval.c:246

References AppendInvalidationMessages(), Assert, InvalidationInfo::CurrentCmdInvalidMsgs, fb(), 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)
extern

Definition at line 1609 of file inval.c.

1610{
1611 Oid databaseId;
1612
1613 if (IsSharedRelation(catalogId))
1614 databaseId = InvalidOid;
1615 else
1616 databaseId = MyDatabaseId;
1617
1619 databaseId, catalogId);
1620}
bool IsSharedRelation(Oid relationId)
Definition catalog.c:304
Oid MyDatabaseId
Definition globals.c:96
static InvalidationInfo * PrepareInvalidationState(void)
Definition inval.c:682
static void RegisterCatalogInvalidation(InvalidationInfo *info, Oid dbId, Oid catId)
Definition inval.c:621
#define InvalidOid
unsigned int Oid

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

Referenced by finish_heap_swap().

◆ CacheInvalidateHeapTuple()

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

Definition at line 1568 of file inval.c.

1571{
1572 CacheInvalidateHeapTupleCommon(relation, tuple, newtuple,
1574}
static void CacheInvalidateHeapTupleCommon(Relation relation, HeapTuple tuple, HeapTuple newtuple, InvalidationInfo *(*prepare_callback)(void))
Definition inval.c:1433

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  key_equivalent_tuple 
)
extern

Definition at line 1590 of file inval.c.

1592{
1595}
static InvalidationInfo * PrepareInplaceInvalidationState(void)
Definition inval.c:752

References CacheInvalidateHeapTupleCommon(), fb(), and PrepareInplaceInvalidationState().

Referenced by heap_inplace_lock().

◆ CacheInvalidateRelcache()

◆ CacheInvalidateRelcacheAll()

◆ CacheInvalidateRelcacheByRelid()

void CacheInvalidateRelcacheByRelid ( Oid  relid)
extern

Definition at line 1688 of file inval.c.

1689{
1690 HeapTuple tup;
1691
1693 if (!HeapTupleIsValid(tup))
1694 elog(ERROR, "cache lookup failed for relation %u", relid);
1697}
#define ERROR
Definition elog.h:40
#define elog(elevel,...)
Definition elog.h:228
#define HeapTupleIsValid(tuple)
Definition htup.h:78
void CacheInvalidateRelcacheByTuple(HeapTuple classTuple)
Definition inval.c:1666
static Datum ObjectIdGetDatum(Oid X)
Definition postgres.h:252
void ReleaseSysCache(HeapTuple tuple)
Definition syscache.c:265
HeapTuple SearchSysCache1(SysCacheIdentifier cacheId, Datum key1)
Definition syscache.c:221

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

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

◆ CacheInvalidateRelcacheByTuple()

void CacheInvalidateRelcacheByTuple ( HeapTuple  classTuple)
extern

Definition at line 1666 of file inval.c.

1667{
1669 Oid databaseId;
1671
1672 relationId = classtup->oid;
1673 if (classtup->relisshared)
1674 databaseId = InvalidOid;
1675 else
1676 databaseId = MyDatabaseId;
1678 databaseId, relationId);
1679}
static void * GETSTRUCT(const HeapTupleData *tuple)
FormData_pg_class * Form_pg_class
Definition pg_class.h:160

References fb(), 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)
extern

Definition at line 1786 of file inval.c.

1787{
1789
1791 msg.rm.dbId = databaseId;
1792 /* check AddCatcacheInvalidationMessage() for an explanation */
1793 VALGRIND_MAKE_MEM_DEFINED(&msg, sizeof(msg));
1794
1796}
#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)
extern

Definition at line 1709 of file inval.c.

1710{
1712 MyDatabaseId, relid);
1713}
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  )
extern

Definition at line 1721 of file inval.c.

1722{
1724}
void CacheInvalidateRelSync(Oid relid)
Definition inval.c:1709

References CacheInvalidateRelSync(), and InvalidOid.

Referenced by InvalidatePubRelSyncCache().

◆ CacheInvalidateSmgr()

void CacheInvalidateSmgr ( RelFileLocatorBackend  rlocator)
extern

Definition at line 1752 of file inval.c.

1753{
1755
1756 /* verify optimization stated above stays valid */
1758 "MAX_BACKENDS_BITS is too big for inval.c");
1759
1760 msg.sm.id = SHAREDINVALSMGR_ID;
1761 msg.sm.backend_hi = rlocator.backend >> 16;
1762 msg.sm.backend_lo = rlocator.backend & 0xffff;
1763 msg.sm.rlocator = rlocator.locator;
1764 /* check AddCatcacheInvalidationMessage() for an explanation */
1765 VALGRIND_MAKE_MEM_DEFINED(&msg, sizeof(msg));
1766
1768}
#define StaticAssertDecl(condition, errmessage)
Definition c.h:1008
#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, StaticAssertDecl, and VALGRIND_MAKE_MEM_DEFINED.

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

◆ CacheRegisterRelcacheCallback()

void CacheRegisterRelcacheCallback ( RelcacheCallbackFunction  func,
Datum  arg 
)
extern

Definition at line 1855 of file inval.c.

1857{
1859 elog(FATAL, "out of relcache_callback_list slots");
1860
1863
1865}
Datum arg
Definition elog.c:1323
#define FATAL
Definition elog.h:42
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
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 
)
extern

Definition at line 1876 of file inval.c.

1878{
1880 elog(FATAL, "out of relsync_callback_list slots");
1881
1884
1886}
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

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 ( SysCacheIdentifier  cacheid,
SyscacheCallbackFunction  func,
Datum  arg 
)
extern

Definition at line 1813 of file inval.c.

1816{
1818 elog(FATAL, "invalid cache ID: %d", cacheid);
1820 elog(FATAL, "out of syscache_callback_list slots");
1821
1823 {
1824 /* first callback for this cache */
1826 }
1827 else
1828 {
1829 /* add to end of chain, so that older callbacks are called first */
1831
1832 while (syscache_callback_list[i].link > 0)
1835 }
1836
1841
1843}
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

References SYSCACHECALLBACK::arg, arg, elog, FATAL, fb(), 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(), get_function_sibling_type(), 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)
extern

Definition at line 1917 of file inval.c.

1918{
1919 for (int i = 0; i < relsync_callback_count; i++)
1920 {
1922
1923 ccitem->function(ccitem->arg, relid);
1924 }
1925}

References fb(), RELSYNCCALLBACK::function, i, relsync_callback_count, and relsync_callback_list.

Referenced by LocalExecuteInvalidationMessage().

◆ CallSyscacheCallbacks()

void CallSyscacheCallbacks ( SysCacheIdentifier  cacheid,
uint32  hashvalue 
)
extern

Definition at line 1895 of file inval.c.

1896{
1897 int i;
1898
1900 elog(ERROR, "invalid cache ID: %d", cacheid);
1901
1903 while (i >= 0)
1904 {
1906
1907 Assert(ccitem->id == cacheid);
1908 ccitem->function(ccitem->arg, cacheid, hashvalue);
1909 i = ccitem->link - 1;
1910 }
1911}

References Assert, elog, ERROR, fb(), i, syscache_callback_links, and syscache_callback_list.

Referenced by CatalogCacheFlushCatalog(), and LocalExecuteInvalidationMessage().

◆ CommandEndInvalidationMessages()

void CommandEndInvalidationMessages ( void  )
extern

Definition at line 1406 of file inval.c.

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

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

Referenced by AtCCI_LocalCache(), and AtEOSubXact_Inval().

◆ ForgetInplace_Inval()

void ForgetInplace_Inval ( void  )
extern

Definition at line 1283 of file inval.c.

1284{
1286}

References fb(), and inplaceInvalInfo.

Referenced by heap_inplace_lock(), and heap_inplace_unlock().

◆ InvalidateSystemCaches()

◆ InvalidateSystemCachesExtended()

void InvalidateSystemCachesExtended ( bool  debug_discard)
extern

Definition at line 785 of file inval.c.

786{
787 int i;
788
791 RelationCacheInvalidate(debug_discard); /* gets smgr and relmap too */
792
793 for (i = 0; i < syscache_callback_count; i++)
794 {
796
797 ccitem->function(ccitem->arg, ccitem->id, 0);
798 }
799
800 for (i = 0; i < relcache_callback_count; i++)
801 {
803
805 }
806
807 for (i = 0; i < relsync_callback_count; i++)
808 {
810
812 }
813}
void ResetCatalogCachesExt(bool debug_discard)
Definition catcache.c:822
void RelationCacheInvalidate(bool debug_discard)
Definition relcache.c:2994
void InvalidateCatalogSnapshot(void)
Definition snapmgr.c:455

References fb(), SYSCACHECALLBACK::function, RELCACHECALLBACK::function, RELSYNCCALLBACK::function, i, 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  )
extern

Definition at line 1936 of file inval.c.

1937{
1939 InvalidationMsgsGroup *group;
1940 int nmsgs;
1941
1942 /* Quick exit if we haven't done anything with invalidation messages. */
1943 if (transInvalInfo == NULL)
1944 return;
1945
1947 nmsgs = NumMessagesInGroup(group);
1948
1949 if (nmsgs > 0)
1950 {
1951 /* prepare record */
1953 xlrec.nmsgs = nmsgs;
1954
1955 /* perform insertion */
1959 XLogRegisterData(msgs,
1960 n * sizeof(SharedInvalidationMessage)));
1962 XLogRegisterData(msgs,
1963 n * sizeof(SharedInvalidationMessage)));
1965 }
1966}
#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
#define MinSizeOfXactInvals
Definition xact.h:308
#define XLOG_XACT_INVALIDATIONS
Definition xact.h:176
XLogRecPtr XLogInsert(RmgrId rmid, uint8 info)
Definition xloginsert.c:482
void XLogRegisterData(const void *data, uint32 len)
Definition xloginsert.c:372
void XLogBeginInsert(void)
Definition xloginsert.c:153

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

Referenced by CommandEndInvalidationMessages(), and RecordTransactionCommit().

◆ PostPrepare_Inval()

void PostPrepare_Inval ( void  )
extern

Definition at line 993 of file inval.c.

994{
995 AtEOXact_Inval(false);
996}
void AtEOXact_Inval(bool isCommit)
Definition inval.c:1196

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().