PostgreSQL Source Code  git master
inval.c File Reference
#include "postgres.h"
#include <limits.h>
#include "access/htup_details.h"
#include "access/xact.h"
#include "catalog/catalog.h"
#include "catalog/pg_constraint.h"
#include "miscadmin.h"
#include "port/pg_bitutils.h"
#include "storage/sinval.h"
#include "storage/smgr.h"
#include "utils/catcache.h"
#include "utils/guc.h"
#include "utils/inval.h"
#include "utils/memdebug.h"
#include "utils/memutils.h"
#include "utils/rel.h"
#include "utils/relmapper.h"
#include "utils/snapmgr.h"
#include "utils/syscache.h"
Include dependency graph for inval.c:

Go to the source code of this file.

Data Structures

struct  InvalidationChunk
 
struct  InvalidationListHeader
 
struct  TransInvalidationInfo
 
struct  SYSCACHECALLBACK
 
struct  RELCACHECALLBACK
 

Macros

#define MAX_SYSCACHE_CALLBACKS   64
 
#define MAX_RELCACHE_CALLBACKS   10
 
#define FIRSTCHUNKSIZE   32
 
#define ProcessMessageList(listHdr, codeFragment)
 
#define ProcessMessageListMulti(listHdr, codeFragment)
 

Typedefs

typedef struct InvalidationChunk InvalidationChunk
 
typedef struct InvalidationListHeader InvalidationListHeader
 
typedef struct TransInvalidationInfo TransInvalidationInfo
 

Functions

static void AddInvalidationMessage (InvalidationChunk **listHdr, SharedInvalidationMessage *msg)
 
static void AppendInvalidationMessageList (InvalidationChunk **destHdr, InvalidationChunk **srcHdr)
 
static void AddCatcacheInvalidationMessage (InvalidationListHeader *hdr, int id, uint32 hashValue, Oid dbId)
 
static void AddCatalogInvalidationMessage (InvalidationListHeader *hdr, Oid dbId, Oid catId)
 
static void AddRelcacheInvalidationMessage (InvalidationListHeader *hdr, Oid dbId, Oid relId)
 
static void AddSnapshotInvalidationMessage (InvalidationListHeader *hdr, Oid dbId, Oid relId)
 
static void AppendInvalidationMessages (InvalidationListHeader *dest, InvalidationListHeader *src)
 
static void ProcessInvalidationMessages (InvalidationListHeader *hdr, void(*func)(SharedInvalidationMessage *msg))
 
static void ProcessInvalidationMessagesMulti (InvalidationListHeader *hdr, void(*func)(const SharedInvalidationMessage *msgs, int n))
 
static void RegisterCatcacheInvalidation (int cacheId, uint32 hashValue, Oid dbId)
 
static void RegisterCatalogInvalidation (Oid dbId, Oid catId)
 
static void RegisterRelcacheInvalidation (Oid dbId, Oid relId)
 
static void RegisterSnapshotInvalidation (Oid dbId, Oid relId)
 
void LocalExecuteInvalidationMessage (SharedInvalidationMessage *msg)
 
void InvalidateSystemCaches (void)
 
void AcceptInvalidationMessages (void)
 
static void PrepareInvalidationState (void)
 
void PostPrepare_Inval (void)
 
static void MakeSharedInvalidMessagesArray (const SharedInvalidationMessage *msgs, int n)
 
int xactGetCommittedInvalidationMessages (SharedInvalidationMessage **msgs, bool *RelcacheInitFileInval)
 
void ProcessCommittedInvalidationMessages (SharedInvalidationMessage *msgs, int nmsgs, bool RelcacheInitFileInval, Oid dbid, Oid tsid)
 
void AtEOXact_Inval (bool isCommit)
 
void AtEOSubXact_Inval (bool isCommit)
 
void CommandEndInvalidationMessages (void)
 
void CacheInvalidateHeapTuple (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 CacheInvalidateSmgr (RelFileNodeBackend rnode)
 
void CacheInvalidateRelmap (Oid databaseId)
 
void CacheRegisterSyscacheCallback (int cacheid, SyscacheCallbackFunction func, Datum arg)
 
void CacheRegisterRelcacheCallback (RelcacheCallbackFunction func, Datum arg)
 
void CallSyscacheCallbacks (int cacheid, uint32 hashvalue)
 
void LogLogicalInvalidations ()
 

Variables

static TransInvalidationInfotransInvalInfo = NULL
 
static SharedInvalidationMessageSharedInvalidMessagesArray
 
static int numSharedInvalidMessagesArray
 
static int maxSharedInvalidMessagesArray
 
int debug_discard_caches = 0
 
static struct SYSCACHECALLBACK syscache_callback_list [MAX_SYSCACHE_CALLBACKS]
 
static int16 syscache_callback_links [SysCacheSize]
 
static int syscache_callback_count = 0
 
static struct RELCACHECALLBACK relcache_callback_list [MAX_RELCACHE_CALLBACKS]
 
static int relcache_callback_count = 0
 

Macro Definition Documentation

◆ FIRSTCHUNKSIZE

#define FIRSTCHUNKSIZE   32

◆ MAX_RELCACHE_CALLBACKS

#define MAX_RELCACHE_CALLBACKS   10

Definition at line 198 of file inval.c.

Referenced by CacheRegisterRelcacheCallback().

◆ MAX_SYSCACHE_CALLBACKS

#define MAX_SYSCACHE_CALLBACKS   64

Definition at line 197 of file inval.c.

Referenced by CacheRegisterSyscacheCallback().

◆ ProcessMessageList

#define ProcessMessageList (   listHdr,
  codeFragment 
)
Value:
do { \
InvalidationChunk *_chunk; \
for (_chunk = (listHdr); _chunk != NULL; _chunk = _chunk->next) \
{ \
int _cindex; \
for (_cindex = 0; _cindex < _chunk->nitems; _cindex++) \
{ \
SharedInvalidationMessage *msg = &_chunk->msgs[_cindex]; \
codeFragment; \
} \
} \
} while (0)

Definition at line 302 of file inval.c.

Referenced by AddRelcacheInvalidationMessage(), AddSnapshotInvalidationMessage(), and ProcessInvalidationMessages().

◆ ProcessMessageListMulti

#define ProcessMessageListMulti (   listHdr,
  codeFragment 
)
Value:
do { \
InvalidationChunk *_chunk; \
for (_chunk = (listHdr); _chunk != NULL; _chunk = _chunk->next) \
{ \
SharedInvalidationMessage *msgs = _chunk->msgs; \
int n = _chunk->nitems; \
codeFragment; \
} \
} while (0)

Definition at line 322 of file inval.c.

Referenced by ProcessInvalidationMessagesMulti().

Typedef Documentation

◆ InvalidationChunk

◆ InvalidationListHeader

◆ TransInvalidationInfo

Function Documentation

◆ AcceptInvalidationMessages()

void AcceptInvalidationMessages ( void  )

Definition at line 688 of file inval.c.

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

Referenced by apply_handle_commit_internal(), AtStart_Cache(), ConditionalLockRelation(), ConditionalLockRelationOid(), delay_execution_planner(), InitializeSessionUserId(), LockDatabaseObject(), LockRelation(), LockRelationOid(), LockSharedObject(), LogicalRepApplyLoop(), ProcessCatchupInterrupt(), RangeVarGetRelidExtended(), relation_openrv(), relation_openrv_extended(), RemoveRelations(), and write_relcache_init_file().

689 {
692 
693  /*----------
694  * Test code to force cache flushes anytime a flush could happen.
695  *
696  * This helps detect intermittent faults caused by code that reads a cache
697  * entry and then performs an action that could invalidate the entry, but
698  * rarely actually does so. This can spot issues that would otherwise
699  * only arise with badly timed concurrent DDL, for example.
700  *
701  * The default debug_discard_caches = 0 does no forced cache flushes.
702  *
703  * If used with CLOBBER_FREED_MEMORY,
704  * debug_discard_caches = 1 (formerly known as CLOBBER_CACHE_ALWAYS)
705  * provides a fairly thorough test that the system contains no cache-flush
706  * hazards. However, it also makes the system unbelievably slow --- the
707  * regression tests take about 100 times longer than normal.
708  *
709  * If you're a glutton for punishment, try
710  * debug_discard_caches = 3 (formerly known as CLOBBER_CACHE_RECURSIVELY).
711  * This slows things by at least a factor of 10000, so I wouldn't suggest
712  * trying to run the entire regression tests that way. It's useful to try
713  * a few simple tests, to make sure that cache reload isn't subject to
714  * internal cache-flush hazards, but after you've done a few thousand
715  * recursive reloads it's unlikely you'll learn more.
716  *----------
717  */
718 #ifdef DISCARD_CACHES_ENABLED
719  {
720  static int recursion_depth = 0;
721 
722  if (recursion_depth < debug_discard_caches)
723  {
724  recursion_depth++;
726  recursion_depth--;
727  }
728  }
729 #endif
730 }
static int recursion_depth
Definition: elog.c:149
int debug_discard_caches
Definition: inval.c:185
void InvalidateSystemCaches(void)
Definition: inval.c:650
void ReceiveSharedInvalidMessages(void(*invalFunction)(SharedInvalidationMessage *msg), void(*resetFunction)(void))
Definition: sinval.c:71
void LocalExecuteInvalidationMessage(SharedInvalidationMessage *msg)
Definition: inval.c:563

◆ AddCatalogInvalidationMessage()

static void AddCatalogInvalidationMessage ( InvalidationListHeader hdr,
Oid  dbId,
Oid  catId 
)
static

Definition at line 374 of file inval.c.

References AddInvalidationMessage(), SharedInvalidationMessage::cat, SharedInvalCatalogMsg::catId, InvalidationListHeader::cclist, SharedInvalCatalogMsg::dbId, SharedInvalCatalogMsg::id, SHAREDINVALCATALOG_ID, and VALGRIND_MAKE_MEM_DEFINED.

Referenced by RegisterCatalogInvalidation().

376 {
378 
380  msg.cat.dbId = dbId;
381  msg.cat.catId = catId;
382  /* check AddCatcacheInvalidationMessage() for an explanation */
383  VALGRIND_MAKE_MEM_DEFINED(&msg, sizeof(msg));
384 
385  AddInvalidationMessage(&hdr->cclist, &msg);
386 }
static void AddInvalidationMessage(InvalidationChunk **listHdr, SharedInvalidationMessage *msg)
Definition: inval.c:236
#define VALGRIND_MAKE_MEM_DEFINED(addr, size)
Definition: memdebug.h:26
InvalidationChunk * cclist
Definition: inval.c:139
SharedInvalCatalogMsg cat
Definition: sinval.h:117
#define SHAREDINVALCATALOG_ID
Definition: sinval.h:67

◆ AddCatcacheInvalidationMessage()

static void AddCatcacheInvalidationMessage ( InvalidationListHeader hdr,
int  id,
uint32  hashValue,
Oid  dbId 
)
static

Definition at line 346 of file inval.c.

References AddInvalidationMessage(), Assert, SharedInvalidationMessage::cc, InvalidationListHeader::cclist, SharedInvalCatcacheMsg::dbId, SharedInvalCatcacheMsg::hashValue, SharedInvalCatcacheMsg::id, and VALGRIND_MAKE_MEM_DEFINED.

Referenced by RegisterCatcacheInvalidation().

348 {
350 
351  Assert(id < CHAR_MAX);
352  msg.cc.id = (int8) id;
353  msg.cc.dbId = dbId;
354  msg.cc.hashValue = hashValue;
355 
356  /*
357  * Define padding bytes in SharedInvalidationMessage structs to be
358  * defined. Otherwise the sinvaladt.c ringbuffer, which is accessed by
359  * multiple processes, will cause spurious valgrind warnings about
360  * undefined memory being used. That's because valgrind remembers the
361  * undefined bytes from the last local process's store, not realizing that
362  * another process has written since, filling the previously uninitialized
363  * bytes
364  */
365  VALGRIND_MAKE_MEM_DEFINED(&msg, sizeof(msg));
366 
367  AddInvalidationMessage(&hdr->cclist, &msg);
368 }
static void AddInvalidationMessage(InvalidationChunk **listHdr, SharedInvalidationMessage *msg)
Definition: inval.c:236
#define VALGRIND_MAKE_MEM_DEFINED(addr, size)
Definition: memdebug.h:26
InvalidationChunk * cclist
Definition: inval.c:139
SharedInvalCatcacheMsg cc
Definition: sinval.h:116
signed char int8
Definition: c.h:427
#define Assert(condition)
Definition: c.h:804

◆ AddInvalidationMessage()

static void AddInvalidationMessage ( InvalidationChunk **  listHdr,
SharedInvalidationMessage msg 
)
static

Definition at line 236 of file inval.c.

References CurTransactionContext, FIRSTCHUNKSIZE, InvalidationChunk::maxitems, MemoryContextAlloc(), InvalidationChunk::msgs, InvalidationChunk::next, InvalidationChunk::nitems, and offsetof.

Referenced by AddCatalogInvalidationMessage(), AddCatcacheInvalidationMessage(), AddRelcacheInvalidationMessage(), and AddSnapshotInvalidationMessage().

238 {
239  InvalidationChunk *chunk = *listHdr;
240 
241  if (chunk == NULL)
242  {
243  /* First time through; create initial chunk */
244 #define FIRSTCHUNKSIZE 32
245  chunk = (InvalidationChunk *)
247  offsetof(InvalidationChunk, msgs) +
249  chunk->nitems = 0;
250  chunk->maxitems = FIRSTCHUNKSIZE;
251  chunk->next = *listHdr;
252  *listHdr = chunk;
253  }
254  else if (chunk->nitems >= chunk->maxitems)
255  {
256  /* Need another chunk; double size of last chunk */
257  int chunksize = 2 * chunk->maxitems;
258 
259  chunk = (InvalidationChunk *)
261  offsetof(InvalidationChunk, msgs) +
262  chunksize * sizeof(SharedInvalidationMessage));
263  chunk->nitems = 0;
264  chunk->maxitems = chunksize;
265  chunk->next = *listHdr;
266  *listHdr = chunk;
267  }
268  /* Okay, add message to current chunk */
269  chunk->msgs[chunk->nitems] = *msg;
270  chunk->nitems++;
271 }
#define FIRSTCHUNKSIZE
SharedInvalidationMessage msgs[FLEXIBLE_ARRAY_MEMBER]
Definition: inval.c:134
MemoryContext CurTransactionContext
Definition: mcxt.c:54
struct InvalidationChunk * next
Definition: inval.c:131
void * MemoryContextAlloc(MemoryContext context, Size size)
Definition: mcxt.c:863
#define offsetof(type, field)
Definition: c.h:727

◆ AddRelcacheInvalidationMessage()

static void AddRelcacheInvalidationMessage ( InvalidationListHeader hdr,
Oid  dbId,
Oid  relId 
)
static

Definition at line 392 of file inval.c.

References AddInvalidationMessage(), SharedInvalRelcacheMsg::dbId, SharedInvalRelcacheMsg::id, InvalidOid, ProcessMessageList, SharedInvalidationMessage::rc, InvalidationListHeader::rclist, SharedInvalRelcacheMsg::relId, SHAREDINVALRELCACHE_ID, and VALGRIND_MAKE_MEM_DEFINED.

Referenced by RegisterRelcacheInvalidation().

394 {
396 
397  /*
398  * Don't add a duplicate item. We assume dbId need not be checked because
399  * it will never change. InvalidOid for relId means all relations so we
400  * don't need to add individual ones when it is present.
401  */
403  if (msg->rc.id == SHAREDINVALRELCACHE_ID &&
404  (msg->rc.relId == relId ||
405  msg->rc.relId == InvalidOid))
406  return);
407 
408  /* OK, add the item */
410  msg.rc.dbId = dbId;
411  msg.rc.relId = relId;
412  /* check AddCatcacheInvalidationMessage() for an explanation */
413  VALGRIND_MAKE_MEM_DEFINED(&msg, sizeof(msg));
414 
415  AddInvalidationMessage(&hdr->rclist, &msg);
416 }
static void AddInvalidationMessage(InvalidationChunk **listHdr, SharedInvalidationMessage *msg)
Definition: inval.c:236
#define VALGRIND_MAKE_MEM_DEFINED(addr, size)
Definition: memdebug.h:26
SharedInvalRelcacheMsg rc
Definition: sinval.h:118
#define ProcessMessageList(listHdr, codeFragment)
Definition: inval.c:302
#define SHAREDINVALRELCACHE_ID
Definition: sinval.h:76
#define InvalidOid
Definition: postgres_ext.h:36
InvalidationChunk * rclist
Definition: inval.c:140

◆ AddSnapshotInvalidationMessage()

static void AddSnapshotInvalidationMessage ( InvalidationListHeader hdr,
Oid  dbId,
Oid  relId 
)
static

Definition at line 422 of file inval.c.

References AddInvalidationMessage(), SharedInvalSnapshotMsg::dbId, SharedInvalSnapshotMsg::id, ProcessMessageList, InvalidationListHeader::rclist, SharedInvalSnapshotMsg::relId, SHAREDINVALSNAPSHOT_ID, SharedInvalidationMessage::sn, and VALGRIND_MAKE_MEM_DEFINED.

Referenced by RegisterSnapshotInvalidation().

424 {
426 
427  /* Don't add a duplicate item */
428  /* We assume dbId need not be checked because it will never change */
430  if (msg->sn.id == SHAREDINVALSNAPSHOT_ID &&
431  msg->sn.relId == relId)
432  return);
433 
434  /* OK, add the item */
436  msg.sn.dbId = dbId;
437  msg.sn.relId = relId;
438  /* check AddCatcacheInvalidationMessage() for an explanation */
439  VALGRIND_MAKE_MEM_DEFINED(&msg, sizeof(msg));
440 
441  AddInvalidationMessage(&hdr->rclist, &msg);
442 }
SharedInvalSnapshotMsg sn
Definition: sinval.h:121
static void AddInvalidationMessage(InvalidationChunk **listHdr, SharedInvalidationMessage *msg)
Definition: inval.c:236
#define VALGRIND_MAKE_MEM_DEFINED(addr, size)
Definition: memdebug.h:26
#define ProcessMessageList(listHdr, codeFragment)
Definition: inval.c:302
#define SHAREDINVALSNAPSHOT_ID
Definition: sinval.h:104
InvalidationChunk * rclist
Definition: inval.c:140

◆ AppendInvalidationMessageList()

static void AppendInvalidationMessageList ( InvalidationChunk **  destHdr,
InvalidationChunk **  srcHdr 
)
static

Definition at line 278 of file inval.c.

References InvalidationChunk::next.

Referenced by AppendInvalidationMessages().

280 {
281  InvalidationChunk *chunk = *srcHdr;
282 
283  if (chunk == NULL)
284  return; /* nothing to do */
285 
286  while (chunk->next != NULL)
287  chunk = chunk->next;
288 
289  chunk->next = *destHdr;
290 
291  *destHdr = *srcHdr;
292 
293  *srcHdr = NULL;
294 }
struct InvalidationChunk * next
Definition: inval.c:131

◆ AppendInvalidationMessages()

static void AppendInvalidationMessages ( InvalidationListHeader dest,
InvalidationListHeader src 
)
static

Definition at line 449 of file inval.c.

References AppendInvalidationMessageList(), InvalidationListHeader::cclist, and InvalidationListHeader::rclist.

Referenced by AtEOSubXact_Inval(), AtEOXact_Inval(), and CommandEndInvalidationMessages().

451 {
454 }
InvalidationChunk * cclist
Definition: inval.c:139
InvalidationChunk * rclist
Definition: inval.c:140
static void AppendInvalidationMessageList(InvalidationChunk **destHdr, InvalidationChunk **srcHdr)
Definition: inval.c:278

◆ AtEOSubXact_Inval()

void AtEOSubXact_Inval ( bool  isCommit)

Definition at line 1012 of file inval.c.

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

Referenced by AbortSubTransaction(), and CommitSubTransaction().

1013 {
1014  int my_level;
1016 
1017  /* Quick exit if no messages. */
1018  if (myInfo == NULL)
1019  return;
1020 
1021  /* Also bail out quickly if messages are not for this level. */
1022  my_level = GetCurrentTransactionNestLevel();
1023  if (myInfo->my_level != my_level)
1024  {
1025  Assert(myInfo->my_level < my_level);
1026  return;
1027  }
1028 
1029  if (isCommit)
1030  {
1031  /* If CurrentCmdInvalidMsgs still has anything, fix it */
1033 
1034  /*
1035  * We create invalidation stack entries lazily, so the parent might
1036  * not have one. Instead of creating one, moving all the data over,
1037  * and then freeing our own, we can just adjust the level of our own
1038  * entry.
1039  */
1040  if (myInfo->parent == NULL || myInfo->parent->my_level < my_level - 1)
1041  {
1042  myInfo->my_level--;
1043  return;
1044  }
1045 
1046  /* Pass up my inval messages to parent */
1048  &myInfo->PriorCmdInvalidMsgs);
1049 
1050  /* Pending relcache inval becomes parent's problem too */
1051  if (myInfo->RelcacheInitFileInval)
1052  myInfo->parent->RelcacheInitFileInval = true;
1053 
1054  /* Pop the transaction state stack */
1055  transInvalInfo = myInfo->parent;
1056 
1057  /* Need not free anything else explicitly */
1058  pfree(myInfo);
1059  }
1060  else
1061  {
1064 
1065  /* Pop the transaction state stack */
1066  transInvalInfo = myInfo->parent;
1067 
1068  /* Need not free anything else explicitly */
1069  pfree(myInfo);
1070  }
1071 }
static void AppendInvalidationMessages(InvalidationListHeader *dest, InvalidationListHeader *src)
Definition: inval.c:449
InvalidationListHeader PriorCmdInvalidMsgs
Definition: inval.c:172
void CommandEndInvalidationMessages(void)
Definition: inval.c:1089
struct TransInvalidationInfo * parent
Definition: inval.c:163
static TransInvalidationInfo * transInvalInfo
Definition: inval.c:178
void pfree(void *pointer)
Definition: mcxt.c:1169
bool RelcacheInitFileInval
Definition: inval.c:175
static void ProcessInvalidationMessages(InvalidationListHeader *hdr, void(*func)(SharedInvalidationMessage *msg))
Definition: inval.c:463
int GetCurrentTransactionNestLevel(void)
Definition: xact.c:857
#define Assert(condition)
Definition: c.h:804
void LocalExecuteInvalidationMessage(SharedInvalidationMessage *msg)
Definition: inval.c:563

◆ AtEOXact_Inval()

void AtEOXact_Inval ( bool  isCommit)

Definition at line 953 of file inval.c.

References AppendInvalidationMessages(), Assert, TransInvalidationInfo::CurrentCmdInvalidMsgs, LocalExecuteInvalidationMessage(), TransInvalidationInfo::my_level, numSharedInvalidMessagesArray, TransInvalidationInfo::parent, TransInvalidationInfo::PriorCmdInvalidMsgs, ProcessInvalidationMessages(), ProcessInvalidationMessagesMulti(), RelationCacheInitFilePostInvalidate(), RelationCacheInitFilePreInvalidate(), TransInvalidationInfo::RelcacheInitFileInval, and SendSharedInvalidMessages().

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

954 {
955  /* Quick exit if no messages */
956  if (transInvalInfo == NULL)
957  return;
958 
959  /* Must be at top of stack */
961 
962  if (isCommit)
963  {
964  /*
965  * Relcache init file invalidation requires processing both before and
966  * after we send the SI messages. However, we need not do anything
967  * unless we committed.
968  */
971 
974 
977 
980  }
981  else
982  {
985  }
986 
987  /* Need not free anything explicitly */
988  transInvalInfo = NULL;
991 }
static void AppendInvalidationMessages(InvalidationListHeader *dest, InvalidationListHeader *src)
Definition: inval.c:449
static SharedInvalidationMessage * SharedInvalidMessagesArray
Definition: inval.c:180
InvalidationListHeader PriorCmdInvalidMsgs
Definition: inval.c:172
struct TransInvalidationInfo * parent
Definition: inval.c:163
static TransInvalidationInfo * transInvalInfo
Definition: inval.c:178
InvalidationListHeader CurrentCmdInvalidMsgs
Definition: inval.c:169
static int numSharedInvalidMessagesArray
Definition: inval.c:181
static void ProcessInvalidationMessagesMulti(InvalidationListHeader *hdr, void(*func)(const SharedInvalidationMessage *msgs, int n))
Definition: inval.c:475
bool RelcacheInitFileInval
Definition: inval.c:175
static void ProcessInvalidationMessages(InvalidationListHeader *hdr, void(*func)(SharedInvalidationMessage *msg))
Definition: inval.c:463
void RelationCacheInitFilePostInvalidate(void)
Definition: relcache.c:6465
void RelationCacheInitFilePreInvalidate(void)
Definition: relcache.c:6440
#define Assert(condition)
Definition: c.h:804
void SendSharedInvalidMessages(const SharedInvalidationMessage *msgs, int n)
Definition: sinval.c:49
void LocalExecuteInvalidationMessage(SharedInvalidationMessage *msg)
Definition: inval.c:563

◆ CacheInvalidateCatalog()

void CacheInvalidateCatalog ( Oid  catalogId)

Definition at line 1255 of file inval.c.

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

Referenced by finish_heap_swap().

1256 {
1257  Oid databaseId;
1258 
1260 
1261  if (IsSharedRelation(catalogId))
1262  databaseId = InvalidOid;
1263  else
1264  databaseId = MyDatabaseId;
1265 
1266  RegisterCatalogInvalidation(databaseId, catalogId);
1267 }
unsigned int Oid
Definition: postgres_ext.h:31
static void PrepareInvalidationState(void)
Definition: inval.c:737
Oid MyDatabaseId
Definition: globals.c:88
static void RegisterCatalogInvalidation(Oid dbId, Oid catId)
Definition: inval.c:507
bool IsSharedRelation(Oid relationId)
Definition: catalog.c:244
#define InvalidOid
Definition: postgres_ext.h:36

◆ CacheInvalidateHeapTuple()

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

Definition at line 1123 of file inval.c.

References GETSTRUCT, InvalidOid, IsBootstrapProcessingMode, IsCatalogRelation(), IsSharedRelation(), IsToastRelation(), MyDatabaseId, OidIsValid, PrepareInvalidationState(), PrepareToInvalidateCacheTuple(), RegisterCatcacheInvalidation(), RegisterRelcacheInvalidation(), RegisterSnapshotInvalidation(), RelationGetRelid, and RelationInvalidatesSnapshotsOnly().

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

1126 {
1127  Oid tupleRelId;
1128  Oid databaseId;
1129  Oid relationId;
1130 
1131  /* Do nothing during bootstrap */
1133  return;
1134 
1135  /*
1136  * We only need to worry about invalidation for tuples that are in system
1137  * catalogs; user-relation tuples are never in catcaches and can't affect
1138  * the relcache either.
1139  */
1140  if (!IsCatalogRelation(relation))
1141  return;
1142 
1143  /*
1144  * IsCatalogRelation() will return true for TOAST tables of system
1145  * catalogs, but we don't care about those, either.
1146  */
1147  if (IsToastRelation(relation))
1148  return;
1149 
1150  /*
1151  * If we're not prepared to queue invalidation messages for this
1152  * subtransaction level, get ready now.
1153  */
1155 
1156  /*
1157  * First let the catcache do its thing
1158  */
1159  tupleRelId = RelationGetRelid(relation);
1160  if (RelationInvalidatesSnapshotsOnly(tupleRelId))
1161  {
1162  databaseId = IsSharedRelation(tupleRelId) ? InvalidOid : MyDatabaseId;
1163  RegisterSnapshotInvalidation(databaseId, tupleRelId);
1164  }
1165  else
1166  PrepareToInvalidateCacheTuple(relation, tuple, newtuple,
1168 
1169  /*
1170  * Now, is this tuple one of the primary definers of a relcache entry? See
1171  * comments in file header for deeper explanation.
1172  *
1173  * Note we ignore newtuple here; we assume an update cannot move a tuple
1174  * from being part of one relcache entry to being part of another.
1175  */
1176  if (tupleRelId == RelationRelationId)
1177  {
1178  Form_pg_class classtup = (Form_pg_class) GETSTRUCT(tuple);
1179 
1180  relationId = classtup->oid;
1181  if (classtup->relisshared)
1182  databaseId = InvalidOid;
1183  else
1184  databaseId = MyDatabaseId;
1185  }
1186  else if (tupleRelId == AttributeRelationId)
1187  {
1188  Form_pg_attribute atttup = (Form_pg_attribute) GETSTRUCT(tuple);
1189 
1190  relationId = atttup->attrelid;
1191 
1192  /*
1193  * KLUGE ALERT: we always send the relcache event with MyDatabaseId,
1194  * even if the rel in question is shared (which we can't easily tell).
1195  * This essentially means that only backends in this same database
1196  * will react to the relcache flush request. This is in fact
1197  * appropriate, since only those backends could see our pg_attribute
1198  * change anyway. It looks a bit ugly though. (In practice, shared
1199  * relations can't have schema changes after bootstrap, so we should
1200  * never come here for a shared rel anyway.)
1201  */
1202  databaseId = MyDatabaseId;
1203  }
1204  else if (tupleRelId == IndexRelationId)
1205  {
1206  Form_pg_index indextup = (Form_pg_index) GETSTRUCT(tuple);
1207 
1208  /*
1209  * When a pg_index row is updated, we should send out a relcache inval
1210  * for the index relation. As above, we don't know the shared status
1211  * of the index, but in practice it doesn't matter since indexes of
1212  * shared catalogs can't have such updates.
1213  */
1214  relationId = indextup->indexrelid;
1215  databaseId = MyDatabaseId;
1216  }
1217  else if (tupleRelId == ConstraintRelationId)
1218  {
1219  Form_pg_constraint constrtup = (Form_pg_constraint) GETSTRUCT(tuple);
1220 
1221  /*
1222  * Foreign keys are part of relcache entries, too, so send out an
1223  * inval for the table that the FK applies to.
1224  */
1225  if (constrtup->contype == CONSTRAINT_FOREIGN &&
1226  OidIsValid(constrtup->conrelid))
1227  {
1228  relationId = constrtup->conrelid;
1229  databaseId = MyDatabaseId;
1230  }
1231  else
1232  return;
1233  }
1234  else
1235  return;
1236 
1237  /*
1238  * Yes. We need to register a relcache invalidation event.
1239  */
1240  RegisterRelcacheInvalidation(databaseId, relationId);
1241 }
bool IsToastRelation(Relation relation)
Definition: catalog.c:146
bool IsCatalogRelation(Relation relation)
Definition: catalog.c:104
#define GETSTRUCT(TUP)
Definition: htup_details.h:654
void PrepareToInvalidateCacheTuple(Relation relation, HeapTuple tuple, HeapTuple newtuple, void(*function)(int, uint32, Oid))
Definition: catcache.c:2009
unsigned int Oid
Definition: postgres_ext.h:31
#define OidIsValid(objectId)
Definition: c.h:710
FormData_pg_attribute * Form_pg_attribute
Definition: pg_attribute.h:207
static void PrepareInvalidationState(void)
Definition: inval.c:737
FormData_pg_index * Form_pg_index
Definition: pg_index.h:69
Oid MyDatabaseId
Definition: globals.c:88
bool IsSharedRelation(Oid relationId)
Definition: catalog.c:244
#define InvalidOid
Definition: postgres_ext.h:36
static void RegisterRelcacheInvalidation(Oid dbId, Oid relId)
Definition: inval.c:519
FormData_pg_constraint * Form_pg_constraint
static void RegisterCatcacheInvalidation(int cacheId, uint32 hashValue, Oid dbId)
Definition: inval.c:493
bool RelationInvalidatesSnapshotsOnly(Oid relid)
Definition: syscache.c:1484
#define IsBootstrapProcessingMode()
Definition: miscadmin.h:406
FormData_pg_class * Form_pg_class
Definition: pg_class.h:153
#define RelationGetRelid(relation)
Definition: rel.h:477
static void RegisterSnapshotInvalidation(Oid dbId, Oid relId)
Definition: inval.c:549

◆ CacheInvalidateRelcache()

void CacheInvalidateRelcache ( Relation  relation)

Definition at line 1279 of file inval.c.

References InvalidOid, MyDatabaseId, PrepareInvalidationState(), RelationData::rd_rel, RegisterRelcacheInvalidation(), and RelationGetRelid.

Referenced by AlterPolicy(), ATExecAlterConstrRecurse(), ATExecDetachPartition(), ATExecGenericOptions(), ATExecValidateConstraint(), CreatePolicy(), CreateStatistics(), DetachPartitionFinalize(), EnableDisableRule(), EnableDisableTrigger(), index_concurrently_set_dead(), index_create(), index_drop(), publication_add_relation(), reindex_index(), RelationSetNewRelfilenode(), RemovePolicyById(), RemoveRewriteRuleById(), RemoveTriggerById(), rename_constraint_internal(), rename_policy(), RenameRewriteRule(), renametrig_internal(), SetRelationNumChecks(), StorePartitionBound(), and StorePartitionKey().

1280 {
1281  Oid databaseId;
1282  Oid relationId;
1283 
1285 
1286  relationId = RelationGetRelid(relation);
1287  if (relation->rd_rel->relisshared)
1288  databaseId = InvalidOid;
1289  else
1290  databaseId = MyDatabaseId;
1291 
1292  RegisterRelcacheInvalidation(databaseId, relationId);
1293 }
Form_pg_class rd_rel
Definition: rel.h:109
unsigned int Oid
Definition: postgres_ext.h:31
static void PrepareInvalidationState(void)
Definition: inval.c:737
Oid MyDatabaseId
Definition: globals.c:88
#define InvalidOid
Definition: postgres_ext.h:36
static void RegisterRelcacheInvalidation(Oid dbId, Oid relId)
Definition: inval.c:519
#define RelationGetRelid(relation)
Definition: rel.h:477

◆ CacheInvalidateRelcacheAll()

void CacheInvalidateRelcacheAll ( void  )

Definition at line 1303 of file inval.c.

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

Referenced by AlterPublicationOptions().

1304 {
1306 
1308 }
static void PrepareInvalidationState(void)
Definition: inval.c:737
#define InvalidOid
Definition: postgres_ext.h:36
static void RegisterRelcacheInvalidation(Oid dbId, Oid relId)
Definition: inval.c:519

◆ CacheInvalidateRelcacheByRelid()

void CacheInvalidateRelcacheByRelid ( Oid  relid)

Definition at line 1338 of file inval.c.

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

Referenced by AlterPublicationOptions(), ATExecAlterConstraint(), DefineIndex(), DetachPartitionFinalize(), heap_drop_with_catalog(), ReindexRelationConcurrently(), RemovePublicationRelById(), RemoveStatisticsById(), and StorePartitionBound().

1339 {
1340  HeapTuple tup;
1341 
1343 
1344  tup = SearchSysCache1(RELOID, ObjectIdGetDatum(relid));
1345  if (!HeapTupleIsValid(tup))
1346  elog(ERROR, "cache lookup failed for relation %u", relid);
1348  ReleaseSysCache(tup);
1349 }
#define ObjectIdGetDatum(X)
Definition: postgres.h:551
#define ERROR
Definition: elog.h:46
static void PrepareInvalidationState(void)
Definition: inval.c:737
HeapTuple SearchSysCache1(int cacheId, Datum key1)
Definition: syscache.c:1127
void ReleaseSysCache(HeapTuple tuple)
Definition: syscache.c:1175
#define HeapTupleIsValid(tuple)
Definition: htup.h:78
#define elog(elevel,...)
Definition: elog.h:232
void CacheInvalidateRelcacheByTuple(HeapTuple classTuple)
Definition: inval.c:1315

◆ CacheInvalidateRelcacheByTuple()

void CacheInvalidateRelcacheByTuple ( HeapTuple  classTuple)

Definition at line 1315 of file inval.c.

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

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

1316 {
1317  Form_pg_class classtup = (Form_pg_class) GETSTRUCT(classTuple);
1318  Oid databaseId;
1319  Oid relationId;
1320 
1322 
1323  relationId = classtup->oid;
1324  if (classtup->relisshared)
1325  databaseId = InvalidOid;
1326  else
1327  databaseId = MyDatabaseId;
1328  RegisterRelcacheInvalidation(databaseId, relationId);
1329 }
#define GETSTRUCT(TUP)
Definition: htup_details.h:654
unsigned int Oid
Definition: postgres_ext.h:31
static void PrepareInvalidationState(void)
Definition: inval.c:737
Oid MyDatabaseId
Definition: globals.c:88
#define InvalidOid
Definition: postgres_ext.h:36
static void RegisterRelcacheInvalidation(Oid dbId, Oid relId)
Definition: inval.c:519
FormData_pg_class * Form_pg_class
Definition: pg_class.h:153

◆ CacheInvalidateRelmap()

void CacheInvalidateRelmap ( Oid  databaseId)

Definition at line 1408 of file inval.c.

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

Referenced by write_relmap_file().

1409 {
1411 
1412  msg.rm.id = SHAREDINVALRELMAP_ID;
1413  msg.rm.dbId = databaseId;
1414  /* check AddCatcacheInvalidationMessage() for an explanation */
1415  VALGRIND_MAKE_MEM_DEFINED(&msg, sizeof(msg));
1416 
1417  SendSharedInvalidMessages(&msg, 1);
1418 }
#define VALGRIND_MAKE_MEM_DEFINED(addr, size)
Definition: memdebug.h:26
SharedInvalRelmapMsg rm
Definition: sinval.h:120
#define SHAREDINVALRELMAP_ID
Definition: sinval.h:96
void SendSharedInvalidMessages(const SharedInvalidationMessage *msgs, int n)
Definition: sinval.c:49

◆ CacheInvalidateSmgr()

void CacheInvalidateSmgr ( RelFileNodeBackend  rnode)

Definition at line 1378 of file inval.c.

References RelFileNodeBackend::backend, SharedInvalSmgrMsg::backend_hi, SharedInvalSmgrMsg::backend_lo, SharedInvalSmgrMsg::id, RelFileNodeBackend::node, SharedInvalSmgrMsg::rnode, SendSharedInvalidMessages(), SHAREDINVALSMGR_ID, SharedInvalidationMessage::sm, and VALGRIND_MAKE_MEM_DEFINED.

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

1379 {
1381 
1382  msg.sm.id = SHAREDINVALSMGR_ID;
1383  msg.sm.backend_hi = rnode.backend >> 16;
1384  msg.sm.backend_lo = rnode.backend & 0xffff;
1385  msg.sm.rnode = rnode.node;
1386  /* check AddCatcacheInvalidationMessage() for an explanation */
1387  VALGRIND_MAKE_MEM_DEFINED(&msg, sizeof(msg));
1388 
1389  SendSharedInvalidMessages(&msg, 1);
1390 }
#define VALGRIND_MAKE_MEM_DEFINED(addr, size)
Definition: memdebug.h:26
RelFileNode node
Definition: relfilenode.h:74
SharedInvalSmgrMsg sm
Definition: sinval.h:119
BackendId backend
Definition: relfilenode.h:75
void SendSharedInvalidMessages(const SharedInvalidationMessage *msgs, int n)
Definition: sinval.c:49
uint16 backend_lo
Definition: sinval.h:92
RelFileNode rnode
Definition: sinval.h:93
#define SHAREDINVALSMGR_ID
Definition: sinval.h:85

◆ CacheRegisterRelcacheCallback()

void CacheRegisterRelcacheCallback ( RelcacheCallbackFunction  func,
Datum  arg 
)

Definition at line 1477 of file inval.c.

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

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

1479 {
1481  elog(FATAL, "out of relcache_callback_list slots");
1482 
1485 
1487 }
static struct RELCACHECALLBACK relcache_callback_list[MAX_RELCACHE_CALLBACKS]
#define MAX_RELCACHE_CALLBACKS
Definition: inval.c:198
static int relcache_callback_count
Definition: inval.c:218
RelcacheCallbackFunction function
Definition: inval.c:214
#define FATAL
Definition: elog.h:49
#define elog(elevel,...)
Definition: elog.h:232
void * arg

◆ CacheRegisterSyscacheCallback()

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

Definition at line 1435 of file inval.c.

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

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

1438 {
1439  if (cacheid < 0 || cacheid >= SysCacheSize)
1440  elog(FATAL, "invalid cache ID: %d", cacheid);
1442  elog(FATAL, "out of syscache_callback_list slots");
1443 
1444  if (syscache_callback_links[cacheid] == 0)
1445  {
1446  /* first callback for this cache */
1448  }
1449  else
1450  {
1451  /* add to end of chain, so that older callbacks are called first */
1452  int i = syscache_callback_links[cacheid] - 1;
1453 
1454  while (syscache_callback_list[i].link > 0)
1455  i = syscache_callback_list[i].link - 1;
1457  }
1458 
1463 
1465 }
int16 link
Definition: inval.c:203
#define SysCacheSize
Definition: syscache.h:114
#define FATAL
Definition: elog.h:49
#define MAX_SYSCACHE_CALLBACKS
Definition: inval.c:197
static struct SYSCACHECALLBACK syscache_callback_list[MAX_SYSCACHE_CALLBACKS]
static int syscache_callback_count
Definition: inval.c:210
static int16 syscache_callback_links[SysCacheSize]
Definition: inval.c:208
#define elog(elevel,...)
Definition: elog.h:232
int i
void * arg
SyscacheCallbackFunction function
Definition: inval.c:204

◆ CallSyscacheCallbacks()

void CallSyscacheCallbacks ( int  cacheid,
uint32  hashvalue 
)

Definition at line 1496 of file inval.c.

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

Referenced by CatalogCacheFlushCatalog(), and LocalExecuteInvalidationMessage().

1497 {
1498  int i;
1499 
1500  if (cacheid < 0 || cacheid >= SysCacheSize)
1501  elog(ERROR, "invalid cache ID: %d", cacheid);
1502 
1503  i = syscache_callback_links[cacheid] - 1;
1504  while (i >= 0)
1505  {
1506  struct SYSCACHECALLBACK *ccitem = syscache_callback_list + i;
1507 
1508  Assert(ccitem->id == cacheid);
1509  ccitem->function(ccitem->arg, cacheid, hashvalue);
1510  i = ccitem->link - 1;
1511  }
1512 }
int16 link
Definition: inval.c:203
#define SysCacheSize
Definition: syscache.h:114
#define ERROR
Definition: elog.h:46
static struct SYSCACHECALLBACK syscache_callback_list[MAX_SYSCACHE_CALLBACKS]
#define Assert(condition)
Definition: c.h:804
static int16 syscache_callback_links[SysCacheSize]
Definition: inval.c:208
#define elog(elevel,...)
Definition: elog.h:232
int i
SyscacheCallbackFunction function
Definition: inval.c:204

◆ CommandEndInvalidationMessages()

void CommandEndInvalidationMessages ( void  )

Definition at line 1089 of file inval.c.

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

Referenced by AtCCI_LocalCache(), and AtEOSubXact_Inval().

1090 {
1091  /*
1092  * You might think this shouldn't be called outside any transaction, but
1093  * bootstrap does it, and also ABORT issued when not in a transaction. So
1094  * just quietly return if no state to work on.
1095  */
1096  if (transInvalInfo == NULL)
1097  return;
1098 
1101 
1102  /* WAL Log per-command invalidation messages for wal_level=logical */
1103  if (XLogLogicalInfoActive())
1105 
1108 }
static void AppendInvalidationMessages(InvalidationListHeader *dest, InvalidationListHeader *src)
Definition: inval.c:449
InvalidationListHeader PriorCmdInvalidMsgs
Definition: inval.c:172
static TransInvalidationInfo * transInvalInfo
Definition: inval.c:178
InvalidationListHeader CurrentCmdInvalidMsgs
Definition: inval.c:169
#define XLogLogicalInfoActive()
Definition: xlog.h:183
void LogLogicalInvalidations()
Definition: inval.c:1522
static void ProcessInvalidationMessages(InvalidationListHeader *hdr, void(*func)(SharedInvalidationMessage *msg))
Definition: inval.c:463
void LocalExecuteInvalidationMessage(SharedInvalidationMessage *msg)
Definition: inval.c:563

◆ InvalidateSystemCaches()

void InvalidateSystemCaches ( void  )

Definition at line 650 of file inval.c.

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

Referenced by AcceptInvalidationMessages(), ParallelWorkerMain(), pg_logical_replication_slot_advance(), and pg_logical_slot_get_changes_guts().

651 {
652  int i;
653 
656  RelationCacheInvalidate(); /* gets smgr and relmap too */
657 
658  for (i = 0; i < syscache_callback_count; i++)
659  {
660  struct SYSCACHECALLBACK *ccitem = syscache_callback_list + i;
661 
662  ccitem->function(ccitem->arg, ccitem->id, 0);
663  }
664 
665  for (i = 0; i < relcache_callback_count; i++)
666  {
667  struct RELCACHECALLBACK *ccitem = relcache_callback_list + i;
668 
669  ccitem->function(ccitem->arg, InvalidOid);
670  }
671 }
static struct RELCACHECALLBACK relcache_callback_list[MAX_RELCACHE_CALLBACKS]
static int relcache_callback_count
Definition: inval.c:218
RelcacheCallbackFunction function
Definition: inval.c:214
void InvalidateCatalogSnapshot(void)
Definition: snapmgr.c:456
static struct SYSCACHECALLBACK syscache_callback_list[MAX_SYSCACHE_CALLBACKS]
static int syscache_callback_count
Definition: inval.c:210
#define InvalidOid
Definition: postgres_ext.h:36
void ResetCatalogCaches(void)
Definition: catcache.c:689
void RelationCacheInvalidate(void)
Definition: relcache.c:2840
int i
SyscacheCallbackFunction function
Definition: inval.c:204

◆ LocalExecuteInvalidationMessage()

void LocalExecuteInvalidationMessage ( SharedInvalidationMessage msg)

Definition at line 563 of file inval.c.

References RELCACHECALLBACK::arg, RelFileNodeBackend::backend, SharedInvalSmgrMsg::backend_hi, SharedInvalSmgrMsg::backend_lo, CallSyscacheCallbacks(), SharedInvalidationMessage::cat, CatalogCacheFlushCatalog(), SharedInvalCatalogMsg::catId, SharedInvalidationMessage::cc, SharedInvalCatcacheMsg::dbId, SharedInvalCatalogMsg::dbId, SharedInvalRelcacheMsg::dbId, SharedInvalRelmapMsg::dbId, SharedInvalSnapshotMsg::dbId, elog, FATAL, RELCACHECALLBACK::function, SharedInvalCatcacheMsg::hashValue, i, SharedInvalCatcacheMsg::id, SharedInvalidationMessage::id, InvalidateCatalogSnapshot(), InvalidOid, MyDatabaseId, RelFileNodeBackend::node, SharedInvalidationMessage::rc, RelationCacheInvalidate(), RelationCacheInvalidateEntry(), RelationMapInvalidate(), relcache_callback_count, relcache_callback_list, SharedInvalRelcacheMsg::relId, SharedInvalidationMessage::rm, SharedInvalSmgrMsg::rnode, SHAREDINVALCATALOG_ID, SHAREDINVALRELCACHE_ID, SHAREDINVALRELMAP_ID, SHAREDINVALSMGR_ID, SHAREDINVALSNAPSHOT_ID, SharedInvalidationMessage::sm, smgrclosenode(), SharedInvalidationMessage::sn, and SysCacheInvalidate().

Referenced by AcceptInvalidationMessages(), AtEOSubXact_Inval(), AtEOXact_Inval(), CommandEndInvalidationMessages(), ReorderBufferExecuteInvalidations(), and ReorderBufferImmediateInvalidation().

564 {
565  if (msg->id >= 0)
566  {
567  if (msg->cc.dbId == MyDatabaseId || msg->cc.dbId == InvalidOid)
568  {
570 
571  SysCacheInvalidate(msg->cc.id, msg->cc.hashValue);
572 
573  CallSyscacheCallbacks(msg->cc.id, msg->cc.hashValue);
574  }
575  }
576  else if (msg->id == SHAREDINVALCATALOG_ID)
577  {
578  if (msg->cat.dbId == MyDatabaseId || msg->cat.dbId == InvalidOid)
579  {
581 
583 
584  /* CatalogCacheFlushCatalog calls CallSyscacheCallbacks as needed */
585  }
586  }
587  else if (msg->id == SHAREDINVALRELCACHE_ID)
588  {
589  if (msg->rc.dbId == MyDatabaseId || msg->rc.dbId == InvalidOid)
590  {
591  int i;
592 
593  if (msg->rc.relId == InvalidOid)
595  else
597 
598  for (i = 0; i < relcache_callback_count; i++)
599  {
600  struct RELCACHECALLBACK *ccitem = relcache_callback_list + i;
601 
602  ccitem->function(ccitem->arg, msg->rc.relId);
603  }
604  }
605  }
606  else if (msg->id == SHAREDINVALSMGR_ID)
607  {
608  /*
609  * We could have smgr entries for relations of other databases, so no
610  * short-circuit test is possible here.
611  */
612  RelFileNodeBackend rnode;
613 
614  rnode.node = msg->sm.rnode;
615  rnode.backend = (msg->sm.backend_hi << 16) | (int) msg->sm.backend_lo;
616  smgrclosenode(rnode);
617  }
618  else if (msg->id == SHAREDINVALRELMAP_ID)
619  {
620  /* We only care about our own database and shared catalogs */
621  if (msg->rm.dbId == InvalidOid)
622  RelationMapInvalidate(true);
623  else if (msg->rm.dbId == MyDatabaseId)
624  RelationMapInvalidate(false);
625  }
626  else if (msg->id == SHAREDINVALSNAPSHOT_ID)
627  {
628  /* We only care about our own database and shared catalogs */
629  if (msg->sn.dbId == InvalidOid)
631  else if (msg->sn.dbId == MyDatabaseId)
633  }
634  else
635  elog(FATAL, "unrecognized SI message ID: %d", msg->id);
636 }
SharedInvalSnapshotMsg sn
Definition: sinval.h:121
SharedInvalRelcacheMsg rc
Definition: sinval.h:118
static struct RELCACHECALLBACK relcache_callback_list[MAX_RELCACHE_CALLBACKS]
static int relcache_callback_count
Definition: inval.c:218
RelcacheCallbackFunction function
Definition: inval.c:214
void RelationMapInvalidate(bool shared)
Definition: relmapper.c:403
#define FATAL
Definition: elog.h:49
#define SHAREDINVALRELCACHE_ID
Definition: sinval.h:76
SharedInvalRelmapMsg rm
Definition: sinval.h:120
#define SHAREDINVALRELMAP_ID
Definition: sinval.h:96
SharedInvalCatcacheMsg cc
Definition: sinval.h:116
void smgrclosenode(RelFileNodeBackend rnode)
Definition: smgr.c:310
SharedInvalCatalogMsg cat
Definition: sinval.h:117
void InvalidateCatalogSnapshot(void)
Definition: snapmgr.c:456
void CallSyscacheCallbacks(int cacheid, uint32 hashvalue)
Definition: inval.c:1496
Oid MyDatabaseId
Definition: globals.c:88
#define InvalidOid
Definition: postgres_ext.h:36
#define SHAREDINVALSNAPSHOT_ID
Definition: sinval.h:104
RelFileNode node
Definition: relfilenode.h:74
SharedInvalSmgrMsg sm
Definition: sinval.h:119
void SysCacheInvalidate(int cacheId, uint32 hashValue)
Definition: syscache.c:1460
void CatalogCacheFlushCatalog(Oid catId)
Definition: catcache.c:719
BackendId backend
Definition: relfilenode.h:75
void RelationCacheInvalidateEntry(Oid relationId)
Definition: relcache.c:2797
uint16 backend_lo
Definition: sinval.h:92
#define SHAREDINVALCATALOG_ID
Definition: sinval.h:67
#define elog(elevel,...)
Definition: elog.h:232
void RelationCacheInvalidate(void)
Definition: relcache.c:2840
int i
RelFileNode rnode
Definition: sinval.h:93
#define SHAREDINVALSMGR_ID
Definition: sinval.h:85

◆ LogLogicalInvalidations()

void LogLogicalInvalidations ( void  )

Definition at line 1522 of file inval.c.

References Assert, TransInvalidationInfo::CurrentCmdInvalidMsgs, MakeSharedInvalidMessagesArray(), MinSizeOfXactInvals, xl_xact_invals::nmsgs, numSharedInvalidMessagesArray, pfree(), ProcessInvalidationMessagesMulti(), SharedInvalidMessagesArray, XLOG_XACT_INVALIDATIONS, XLogBeginInsert(), XLogInsert(), and XLogRegisterData().

Referenced by CommandEndInvalidationMessages(), and RecordTransactionCommit().

1523 {
1524  xl_xact_invals xlrec;
1525  SharedInvalidationMessage *invalMessages;
1526  int nmsgs = 0;
1527 
1528  /* Quick exit if we haven't done anything with invalidation messages. */
1529  if (transInvalInfo == NULL)
1530  return;
1531 
1534 
1536  SharedInvalidMessagesArray == NULL));
1537 
1538  invalMessages = SharedInvalidMessagesArray;
1542 
1543  if (nmsgs > 0)
1544  {
1545  /* prepare record */
1546  memset(&xlrec, 0, MinSizeOfXactInvals);
1547  xlrec.nmsgs = nmsgs;
1548 
1549  /* perform insertion */
1550  XLogBeginInsert();
1551  XLogRegisterData((char *) (&xlrec), MinSizeOfXactInvals);
1552  XLogRegisterData((char *) invalMessages,
1553  nmsgs * sizeof(SharedInvalidationMessage));
1554  XLogInsert(RM_XACT_ID, XLOG_XACT_INVALIDATIONS);
1555 
1556  pfree(invalMessages);
1557  }
1558 }
static SharedInvalidationMessage * SharedInvalidMessagesArray
Definition: inval.c:180
#define XLOG_XACT_INVALIDATIONS
Definition: xact.h:154
static TransInvalidationInfo * transInvalInfo
Definition: inval.c:178
InvalidationListHeader CurrentCmdInvalidMsgs
Definition: inval.c:169
void pfree(void *pointer)
Definition: mcxt.c:1169
static void MakeSharedInvalidMessagesArray(const SharedInvalidationMessage *msgs, int n)
Definition: inval.c:783
static int numSharedInvalidMessagesArray
Definition: inval.c:181
#define MinSizeOfXactInvals
Definition: xact.h:257
static void ProcessInvalidationMessagesMulti(InvalidationListHeader *hdr, void(*func)(const SharedInvalidationMessage *msgs, int n))
Definition: inval.c:475
void XLogRegisterData(char *data, int len)
Definition: xloginsert.c:340
XLogRecPtr XLogInsert(RmgrId rmid, uint8 info)
Definition: xloginsert.c:432
#define Assert(condition)
Definition: c.h:804
void XLogBeginInsert(void)
Definition: xloginsert.c:135
int nmsgs
Definition: xact.h:254

◆ MakeSharedInvalidMessagesArray()

static void MakeSharedInvalidMessagesArray ( const SharedInvalidationMessage msgs,
int  n 
)
static

Definition at line 783 of file inval.c.

References FIRSTCHUNKSIZE, maxSharedInvalidMessagesArray, numSharedInvalidMessagesArray, palloc(), pg_nextpower2_32(), and repalloc().

Referenced by LogLogicalInvalidations(), and xactGetCommittedInvalidationMessages().

784 {
785  /*
786  * Initialise array first time through in each commit
787  */
788  if (SharedInvalidMessagesArray == NULL)
789  {
792 
793  /*
794  * Although this is being palloc'd we don't actually free it directly.
795  * We're so close to EOXact that we now we're going to lose it anyhow.
796  */
798  * sizeof(SharedInvalidationMessage));
799  }
800 
802  {
804 
807  * sizeof(SharedInvalidationMessage));
808  }
809 
810  /*
811  * Append the next chunk onto the array
812  */
814  msgs, n * sizeof(SharedInvalidationMessage));
816 }
#define FIRSTCHUNKSIZE
static SharedInvalidationMessage * SharedInvalidMessagesArray
Definition: inval.c:180
static uint32 pg_nextpower2_32(uint32 num)
Definition: pg_bitutils.h:146
static int numSharedInvalidMessagesArray
Definition: inval.c:181
void * repalloc(void *pointer, Size size)
Definition: mcxt.c:1182
static int maxSharedInvalidMessagesArray
Definition: inval.c:182
void * palloc(Size size)
Definition: mcxt.c:1062

◆ PostPrepare_Inval()

void PostPrepare_Inval ( void  )

Definition at line 774 of file inval.c.

References AtEOXact_Inval().

Referenced by PrepareTransaction().

775 {
776  AtEOXact_Inval(false);
777 }
void AtEOXact_Inval(bool isCommit)
Definition: inval.c:953

◆ PrepareInvalidationState()

static void PrepareInvalidationState ( void  )
static

Definition at line 737 of file inval.c.

References Assert, GetCurrentTransactionNestLevel(), MemoryContextAllocZero(), TransInvalidationInfo::my_level, TransInvalidationInfo::parent, TopTransactionContext, and transInvalInfo.

Referenced by CacheInvalidateCatalog(), CacheInvalidateHeapTuple(), CacheInvalidateRelcache(), CacheInvalidateRelcacheAll(), CacheInvalidateRelcacheByRelid(), and CacheInvalidateRelcacheByTuple().

738 {
739  TransInvalidationInfo *myInfo;
740 
741  if (transInvalInfo != NULL &&
743  return;
744 
745  myInfo = (TransInvalidationInfo *)
747  sizeof(TransInvalidationInfo));
748  myInfo->parent = transInvalInfo;
750 
751  /*
752  * If there's any previous entry, this one should be for a deeper nesting
753  * level.
754  */
755  Assert(transInvalInfo == NULL ||
756  myInfo->my_level > transInvalInfo->my_level);
757 
758  transInvalInfo = myInfo;
759 }
MemoryContext TopTransactionContext
Definition: mcxt.c:53
struct TransInvalidationInfo * parent
Definition: inval.c:163
static TransInvalidationInfo * transInvalInfo
Definition: inval.c:178
void * MemoryContextAllocZero(MemoryContext context, Size size)
Definition: mcxt.c:906
int GetCurrentTransactionNestLevel(void)
Definition: xact.c:857
#define Assert(condition)
Definition: c.h:804

◆ ProcessCommittedInvalidationMessages()

void ProcessCommittedInvalidationMessages ( SharedInvalidationMessage msgs,
int  nmsgs,
bool  RelcacheInitFileInval,
Oid  dbid,
Oid  tsid 
)

Definition at line 888 of file inval.c.

References DatabasePath, DEBUG4, elog, GetDatabasePath(), OidIsValid, pfree(), RelationCacheInitFilePostInvalidate(), RelationCacheInitFilePreInvalidate(), SendSharedInvalidMessages(), and trace_recovery().

Referenced by standby_redo(), and xact_redo_commit().

891 {
892  if (nmsgs <= 0)
893  return;
894 
895  elog(trace_recovery(DEBUG4), "replaying commit with %d messages%s", nmsgs,
896  (RelcacheInitFileInval ? " and relcache file invalidation" : ""));
897 
898  if (RelcacheInitFileInval)
899  {
900  elog(trace_recovery(DEBUG4), "removing relcache init files for database %u",
901  dbid);
902 
903  /*
904  * RelationCacheInitFilePreInvalidate, when the invalidation message
905  * is for a specific database, requires DatabasePath to be set, but we
906  * should not use SetDatabasePath during recovery, since it is
907  * intended to be used only once by normal backends. Hence, a quick
908  * hack: set DatabasePath directly then unset after use.
909  */
910  if (OidIsValid(dbid))
911  DatabasePath = GetDatabasePath(dbid, tsid);
912 
914 
915  if (OidIsValid(dbid))
916  {
918  DatabasePath = NULL;
919  }
920  }
921 
922  SendSharedInvalidMessages(msgs, nmsgs);
923 
924  if (RelcacheInitFileInval)
926 }
#define DEBUG4
Definition: elog.h:22
#define OidIsValid(objectId)
Definition: c.h:710
int trace_recovery(int trace_level)
Definition: elog.c:3609
void pfree(void *pointer)
Definition: mcxt.c:1169
char * GetDatabasePath(Oid dbNode, Oid spcNode)
Definition: relpath.c:110
void RelationCacheInitFilePostInvalidate(void)
Definition: relcache.c:6465
char * DatabasePath
Definition: globals.c:96
void RelationCacheInitFilePreInvalidate(void)
Definition: relcache.c:6440
void SendSharedInvalidMessages(const SharedInvalidationMessage *msgs, int n)
Definition: sinval.c:49
#define elog(elevel,...)
Definition: elog.h:232

◆ ProcessInvalidationMessages()

static void ProcessInvalidationMessages ( InvalidationListHeader hdr,
void(*)(SharedInvalidationMessage *msg)  func 
)
static

Definition at line 463 of file inval.c.

References InvalidationListHeader::cclist, ProcessMessageList, and InvalidationListHeader::rclist.

Referenced by AtEOSubXact_Inval(), AtEOXact_Inval(), and CommandEndInvalidationMessages().

465 {
466  ProcessMessageList(hdr->cclist, func(msg));
467  ProcessMessageList(hdr->rclist, func(msg));
468 }
#define ProcessMessageList(listHdr, codeFragment)
Definition: inval.c:302
InvalidationChunk * cclist
Definition: inval.c:139
InvalidationChunk * rclist
Definition: inval.c:140

◆ ProcessInvalidationMessagesMulti()

static void ProcessInvalidationMessagesMulti ( InvalidationListHeader hdr,
void(*)(const SharedInvalidationMessage *msgs, int n)  func 
)
static

Definition at line 475 of file inval.c.

References InvalidationListHeader::cclist, ProcessMessageListMulti, and InvalidationListHeader::rclist.

Referenced by AtEOXact_Inval(), LogLogicalInvalidations(), and xactGetCommittedInvalidationMessages().

477 {
478  ProcessMessageListMulti(hdr->cclist, func(msgs, n));
479  ProcessMessageListMulti(hdr->rclist, func(msgs, n));
480 }
#define ProcessMessageListMulti(listHdr, codeFragment)
Definition: inval.c:322
InvalidationChunk * cclist
Definition: inval.c:139
InvalidationChunk * rclist
Definition: inval.c:140

◆ RegisterCatalogInvalidation()

static void RegisterCatalogInvalidation ( Oid  dbId,
Oid  catId 
)
static

Definition at line 507 of file inval.c.

References AddCatalogInvalidationMessage(), and TransInvalidationInfo::CurrentCmdInvalidMsgs.

Referenced by CacheInvalidateCatalog().

508 {
510  dbId, catId);
511 }
static TransInvalidationInfo * transInvalInfo
Definition: inval.c:178
InvalidationListHeader CurrentCmdInvalidMsgs
Definition: inval.c:169
static void AddCatalogInvalidationMessage(InvalidationListHeader *hdr, Oid dbId, Oid catId)
Definition: inval.c:374

◆ RegisterCatcacheInvalidation()

static void RegisterCatcacheInvalidation ( int  cacheId,
uint32  hashValue,
Oid  dbId 
)
static

Definition at line 493 of file inval.c.

References AddCatcacheInvalidationMessage(), and TransInvalidationInfo::CurrentCmdInvalidMsgs.

Referenced by CacheInvalidateHeapTuple().

496 {
498  cacheId, hashValue, dbId);
499 }
static TransInvalidationInfo * transInvalInfo
Definition: inval.c:178
InvalidationListHeader CurrentCmdInvalidMsgs
Definition: inval.c:169
static void AddCatcacheInvalidationMessage(InvalidationListHeader *hdr, int id, uint32 hashValue, Oid dbId)
Definition: inval.c:346

◆ RegisterRelcacheInvalidation()

static void RegisterRelcacheInvalidation ( Oid  dbId,
Oid  relId 
)
static

Definition at line 519 of file inval.c.

References AddRelcacheInvalidationMessage(), TransInvalidationInfo::CurrentCmdInvalidMsgs, GetCurrentCommandId(), InvalidOid, RelationIdIsInInitFile(), and TransInvalidationInfo::RelcacheInitFileInval.

Referenced by CacheInvalidateHeapTuple(), CacheInvalidateRelcache(), CacheInvalidateRelcacheAll(), and CacheInvalidateRelcacheByTuple().

520 {
522  dbId, relId);
523 
524  /*
525  * Most of the time, relcache invalidation is associated with system
526  * catalog updates, but there are a few cases where it isn't. Quick hack
527  * to ensure that the next CommandCounterIncrement() will think that we
528  * need to do CommandEndInvalidationMessages().
529  */
530  (void) GetCurrentCommandId(true);
531 
532  /*
533  * If the relation being invalidated is one of those cached in a relcache
534  * init file, mark that we need to zap that file at commit. For simplicity
535  * invalidations for a specific database always invalidate the shared file
536  * as well. Also zap when we are invalidating whole relcache.
537  */
538  if (relId == InvalidOid || RelationIdIsInInitFile(relId))
540 }
bool RelationIdIsInInitFile(Oid relationId)
Definition: relcache.c:6400
static TransInvalidationInfo * transInvalInfo
Definition: inval.c:178
InvalidationListHeader CurrentCmdInvalidMsgs
Definition: inval.c:169
bool RelcacheInitFileInval
Definition: inval.c:175
#define InvalidOid
Definition: postgres_ext.h:36
static void AddRelcacheInvalidationMessage(InvalidationListHeader *hdr, Oid dbId, Oid relId)
Definition: inval.c:392
CommandId GetCurrentCommandId(bool used)
Definition: xact.c:761

◆ RegisterSnapshotInvalidation()

static void RegisterSnapshotInvalidation ( Oid  dbId,
Oid  relId 
)
static

Definition at line 549 of file inval.c.

References AddSnapshotInvalidationMessage(), and TransInvalidationInfo::CurrentCmdInvalidMsgs.

Referenced by CacheInvalidateHeapTuple().

550 {
552  dbId, relId);
553 }
static TransInvalidationInfo * transInvalInfo
Definition: inval.c:178
InvalidationListHeader CurrentCmdInvalidMsgs
Definition: inval.c:169
static void AddSnapshotInvalidationMessage(InvalidationListHeader *hdr, Oid dbId, Oid relId)
Definition: inval.c:422

◆ xactGetCommittedInvalidationMessages()

int xactGetCommittedInvalidationMessages ( SharedInvalidationMessage **  msgs,
bool RelcacheInitFileInval 
)

Definition at line 832 of file inval.c.

References Assert, TransInvalidationInfo::CurrentCmdInvalidMsgs, CurTransactionContext, MakeSharedInvalidMessagesArray(), MemoryContextSwitchTo(), TransInvalidationInfo::my_level, numSharedInvalidMessagesArray, TransInvalidationInfo::parent, TransInvalidationInfo::PriorCmdInvalidMsgs, ProcessInvalidationMessagesMulti(), TransInvalidationInfo::RelcacheInitFileInval, and SharedInvalidMessagesArray.

Referenced by RecordTransactionCommit(), and StartPrepare().

834 {
835  MemoryContext oldcontext;
836 
837  /* Quick exit if we haven't done anything with invalidation messages. */
838  if (transInvalInfo == NULL)
839  {
840  *RelcacheInitFileInval = false;
841  *msgs = NULL;
842  return 0;
843  }
844 
845  /* Must be at top of stack */
847 
848  /*
849  * Relcache init file invalidation requires processing both before and
850  * after we send the SI messages. However, we need not do anything unless
851  * we committed.
852  */
853  *RelcacheInitFileInval = transInvalInfo->RelcacheInitFileInval;
854 
855  /*
856  * Walk through TransInvalidationInfo to collect all the messages into a
857  * single contiguous array of invalidation messages. It must be contiguous
858  * so we can copy directly into WAL message. Maintain the order that they
859  * would be processed in by AtEOXact_Inval(), to ensure emulated behaviour
860  * in redo is as similar as possible to original. We want the same bugs,
861  * if any, not new ones.
862  */
864 
869  MemoryContextSwitchTo(oldcontext);
870 
872  SharedInvalidMessagesArray == NULL));
873 
875 
877 }
static SharedInvalidationMessage * SharedInvalidMessagesArray
Definition: inval.c:180
InvalidationListHeader PriorCmdInvalidMsgs
Definition: inval.c:172
static MemoryContext MemoryContextSwitchTo(MemoryContext context)
Definition: palloc.h:109
MemoryContext CurTransactionContext
Definition: mcxt.c:54
struct TransInvalidationInfo * parent
Definition: inval.c:163
static TransInvalidationInfo * transInvalInfo
Definition: inval.c:178
InvalidationListHeader CurrentCmdInvalidMsgs
Definition: inval.c:169
static void MakeSharedInvalidMessagesArray(const SharedInvalidationMessage *msgs, int n)
Definition: inval.c:783
static int numSharedInvalidMessagesArray
Definition: inval.c:181
static void ProcessInvalidationMessagesMulti(InvalidationListHeader *hdr, void(*func)(const SharedInvalidationMessage *msgs, int n))
Definition: inval.c:475
bool RelcacheInitFileInval
Definition: inval.c:175
#define Assert(condition)
Definition: c.h:804

Variable Documentation

◆ debug_discard_caches

int debug_discard_caches = 0

Definition at line 185 of file inval.c.

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

◆ maxSharedInvalidMessagesArray

int maxSharedInvalidMessagesArray
static

Definition at line 182 of file inval.c.

Referenced by MakeSharedInvalidMessagesArray().

◆ numSharedInvalidMessagesArray

int numSharedInvalidMessagesArray
static

◆ relcache_callback_count

int relcache_callback_count = 0
static

◆ relcache_callback_list

◆ SharedInvalidMessagesArray

SharedInvalidationMessage* SharedInvalidMessagesArray
static

Definition at line 180 of file inval.c.

Referenced by LogLogicalInvalidations(), and xactGetCommittedInvalidationMessages().

◆ syscache_callback_count

int syscache_callback_count = 0
static

Definition at line 210 of file inval.c.

Referenced by CacheRegisterSyscacheCallback(), and InvalidateSystemCaches().

◆ syscache_callback_links

int16 syscache_callback_links[SysCacheSize]
static

Definition at line 208 of file inval.c.

Referenced by CacheRegisterSyscacheCallback(), and CallSyscacheCallbacks().

◆ syscache_callback_list

◆ transInvalInfo

TransInvalidationInfo* transInvalInfo = NULL
static

Definition at line 178 of file inval.c.

Referenced by AtEOSubXact_Inval(), and PrepareInvalidationState().