PostgreSQL Source Code  git master
resowner_private.h File Reference
#include "storage/dsm.h"
#include "storage/fd.h"
#include "storage/lock.h"
#include "utils/catcache.h"
#include "utils/plancache.h"
#include "utils/resowner.h"
#include "utils/snapshot.h"
Include dependency graph for resowner_private.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void ResourceOwnerEnlargeBuffers (ResourceOwner owner)
 
void ResourceOwnerRememberBuffer (ResourceOwner owner, Buffer buffer)
 
void ResourceOwnerForgetBuffer (ResourceOwner owner, Buffer buffer)
 
void ResourceOwnerRememberLock (ResourceOwner owner, LOCALLOCK *locallock)
 
void ResourceOwnerForgetLock (ResourceOwner owner, LOCALLOCK *locallock)
 
void ResourceOwnerEnlargeCatCacheRefs (ResourceOwner owner)
 
void ResourceOwnerRememberCatCacheRef (ResourceOwner owner, HeapTuple tuple)
 
void ResourceOwnerForgetCatCacheRef (ResourceOwner owner, HeapTuple tuple)
 
void ResourceOwnerEnlargeCatCacheListRefs (ResourceOwner owner)
 
void ResourceOwnerRememberCatCacheListRef (ResourceOwner owner, CatCList *list)
 
void ResourceOwnerForgetCatCacheListRef (ResourceOwner owner, CatCList *list)
 
void ResourceOwnerEnlargeRelationRefs (ResourceOwner owner)
 
void ResourceOwnerRememberRelationRef (ResourceOwner owner, Relation rel)
 
void ResourceOwnerForgetRelationRef (ResourceOwner owner, Relation rel)
 
void ResourceOwnerEnlargePlanCacheRefs (ResourceOwner owner)
 
void ResourceOwnerRememberPlanCacheRef (ResourceOwner owner, CachedPlan *plan)
 
void ResourceOwnerForgetPlanCacheRef (ResourceOwner owner, CachedPlan *plan)
 
void ResourceOwnerEnlargeTupleDescs (ResourceOwner owner)
 
void ResourceOwnerRememberTupleDesc (ResourceOwner owner, TupleDesc tupdesc)
 
void ResourceOwnerForgetTupleDesc (ResourceOwner owner, TupleDesc tupdesc)
 
void ResourceOwnerEnlargeSnapshots (ResourceOwner owner)
 
void ResourceOwnerRememberSnapshot (ResourceOwner owner, Snapshot snapshot)
 
void ResourceOwnerForgetSnapshot (ResourceOwner owner, Snapshot snapshot)
 
void ResourceOwnerEnlargeFiles (ResourceOwner owner)
 
void ResourceOwnerRememberFile (ResourceOwner owner, File file)
 
void ResourceOwnerForgetFile (ResourceOwner owner, File file)
 
void ResourceOwnerEnlargeDSMs (ResourceOwner owner)
 
void ResourceOwnerRememberDSM (ResourceOwner owner, dsm_segment *)
 
void ResourceOwnerForgetDSM (ResourceOwner owner, dsm_segment *)
 
void ResourceOwnerEnlargeJIT (ResourceOwner owner)
 
void ResourceOwnerRememberJIT (ResourceOwner owner, Datum handle)
 
void ResourceOwnerForgetJIT (ResourceOwner owner, Datum handle)
 

Function Documentation

◆ ResourceOwnerEnlargeBuffers()

void ResourceOwnerEnlargeBuffers ( ResourceOwner  owner)

Definition at line 917 of file resowner.c.

References Assert, ResourceOwnerData::bufferarr, and ResourceArrayEnlarge().

Referenced by BgBufferSync(), BufferSync(), FlushDatabaseBuffers(), FlushRelationBuffers(), FlushRelationsAllBuffers(), IncrBufferRefCount(), and ReadBuffer_common().

918 {
919  /* We used to allow pinning buffers without a resowner, but no more */
920  Assert(owner != NULL);
921  ResourceArrayEnlarge(&(owner->bufferarr));
922 }
static void ResourceArrayEnlarge(ResourceArray *resarr)
Definition: resowner.c:208
ResourceArray bufferarr
Definition: resowner.c:121
#define Assert(condition)
Definition: c.h:745

◆ ResourceOwnerEnlargeCatCacheListRefs()

void ResourceOwnerEnlargeCatCacheListRefs ( ResourceOwner  owner)

Definition at line 1041 of file resowner.c.

References ResourceOwnerData::catlistrefarr, and ResourceArrayEnlarge().

Referenced by SearchCatCacheList().

1042 {
1044 }
static void ResourceArrayEnlarge(ResourceArray *resarr)
Definition: resowner.c:208
ResourceArray catlistrefarr
Definition: resowner.c:123

◆ ResourceOwnerEnlargeCatCacheRefs()

void ResourceOwnerEnlargeCatCacheRefs ( ResourceOwner  owner)

Definition at line 1006 of file resowner.c.

References ResourceOwnerData::catrefarr, and ResourceArrayEnlarge().

Referenced by SearchCatCacheInternal(), and SearchCatCacheMiss().

1007 {
1008  ResourceArrayEnlarge(&(owner->catrefarr));
1009 }
static void ResourceArrayEnlarge(ResourceArray *resarr)
Definition: resowner.c:208
ResourceArray catrefarr
Definition: resowner.c:122

◆ ResourceOwnerEnlargeDSMs()

void ResourceOwnerEnlargeDSMs ( ResourceOwner  owner)

Definition at line 1302 of file resowner.c.

References ResourceOwnerData::dsmarr, and ResourceArrayEnlarge().

Referenced by dsm_create_descriptor(), and dsm_unpin_mapping().

1303 {
1304  ResourceArrayEnlarge(&(owner->dsmarr));
1305 }
static void ResourceArrayEnlarge(ResourceArray *resarr)
Definition: resowner.c:208
ResourceArray dsmarr
Definition: resowner.c:129

◆ ResourceOwnerEnlargeFiles()

void ResourceOwnerEnlargeFiles ( ResourceOwner  owner)

Definition at line 1257 of file resowner.c.

References ResourceOwnerData::filearr, and ResourceArrayEnlarge().

Referenced by OpenTemporaryFile(), PathNameCreateTemporaryFile(), and PathNameOpenTemporaryFile().

1258 {
1259  ResourceArrayEnlarge(&(owner->filearr));
1260 }
static void ResourceArrayEnlarge(ResourceArray *resarr)
Definition: resowner.c:208
ResourceArray filearr
Definition: resowner.c:128

◆ ResourceOwnerEnlargeJIT()

void ResourceOwnerEnlargeJIT ( ResourceOwner  owner)

Definition at line 1347 of file resowner.c.

References ResourceOwnerData::jitarr, and ResourceArrayEnlarge().

Referenced by llvm_create_context().

1348 {
1349  ResourceArrayEnlarge(&(owner->jitarr));
1350 }
static void ResourceArrayEnlarge(ResourceArray *resarr)
Definition: resowner.c:208
ResourceArray jitarr
Definition: resowner.c:130

◆ ResourceOwnerEnlargePlanCacheRefs()

void ResourceOwnerEnlargePlanCacheRefs ( ResourceOwner  owner)

Definition at line 1121 of file resowner.c.

References ResourceOwnerData::planrefarr, and ResourceArrayEnlarge().

Referenced by CachedPlanAllowsSimpleValidityCheck(), CachedPlanIsSimplyValid(), and GetCachedPlan().

1122 {
1123  ResourceArrayEnlarge(&(owner->planrefarr));
1124 }
static void ResourceArrayEnlarge(ResourceArray *resarr)
Definition: resowner.c:208
ResourceArray planrefarr
Definition: resowner.c:125

◆ ResourceOwnerEnlargeRelationRefs()

void ResourceOwnerEnlargeRelationRefs ( ResourceOwner  owner)

Definition at line 1076 of file resowner.c.

References ResourceOwnerData::relrefarr, and ResourceArrayEnlarge().

Referenced by RelationIncrementReferenceCount().

1077 {
1078  ResourceArrayEnlarge(&(owner->relrefarr));
1079 }
static void ResourceArrayEnlarge(ResourceArray *resarr)
Definition: resowner.c:208
ResourceArray relrefarr
Definition: resowner.c:124

◆ ResourceOwnerEnlargeSnapshots()

void ResourceOwnerEnlargeSnapshots ( ResourceOwner  owner)

Definition at line 1211 of file resowner.c.

References ResourceArrayEnlarge(), and ResourceOwnerData::snapshotarr.

Referenced by RegisterSnapshotOnOwner().

1212 {
1213  ResourceArrayEnlarge(&(owner->snapshotarr));
1214 }
static void ResourceArrayEnlarge(ResourceArray *resarr)
Definition: resowner.c:208
ResourceArray snapshotarr
Definition: resowner.c:127

◆ ResourceOwnerEnlargeTupleDescs()

void ResourceOwnerEnlargeTupleDescs ( ResourceOwner  owner)

Definition at line 1165 of file resowner.c.

References ResourceArrayEnlarge(), and ResourceOwnerData::tupdescarr.

Referenced by IncrTupleDescRefCount().

1166 {
1167  ResourceArrayEnlarge(&(owner->tupdescarr));
1168 }
static void ResourceArrayEnlarge(ResourceArray *resarr)
Definition: resowner.c:208
ResourceArray tupdescarr
Definition: resowner.c:126

◆ ResourceOwnerForgetBuffer()

void ResourceOwnerForgetBuffer ( ResourceOwner  owner,
Buffer  buffer 
)

Definition at line 939 of file resowner.c.

References ResourceOwnerData::bufferarr, BufferGetDatum, elog, ERROR, ResourceOwnerData::name, and ResourceArrayRemove().

Referenced by ReleaseAndReadBuffer(), ReleaseBuffer(), and UnpinBuffer().

940 {
941  if (!ResourceArrayRemove(&(owner->bufferarr), BufferGetDatum(buffer)))
942  elog(ERROR, "buffer %d is not owned by resource owner %s",
943  buffer, owner->name);
944 }
ResourceArray bufferarr
Definition: resowner.c:121
const char * name
Definition: resowner.c:118
#define ERROR
Definition: elog.h:43
#define BufferGetDatum(buffer)
Definition: resowner.c:44
static bool ResourceArrayRemove(ResourceArray *resarr, Datum value)
Definition: resowner.c:301
#define elog(elevel,...)
Definition: elog.h:214

◆ ResourceOwnerForgetCatCacheListRef()

void ResourceOwnerForgetCatCacheListRef ( ResourceOwner  owner,
CatCList list 
)

Definition at line 1061 of file resowner.c.

References ResourceOwnerData::catlistrefarr, elog, ERROR, ResourceOwnerData::name, PointerGetDatum, and ResourceArrayRemove().

Referenced by ReleaseCatCacheList().

1062 {
1063  if (!ResourceArrayRemove(&(owner->catlistrefarr), PointerGetDatum(list)))
1064  elog(ERROR, "catcache list reference %p is not owned by resource owner %s",
1065  list, owner->name);
1066 }
#define PointerGetDatum(X)
Definition: postgres.h:556
const char * name
Definition: resowner.c:118
#define ERROR
Definition: elog.h:43
static bool ResourceArrayRemove(ResourceArray *resarr, Datum value)
Definition: resowner.c:301
#define elog(elevel,...)
Definition: elog.h:214
ResourceArray catlistrefarr
Definition: resowner.c:123

◆ ResourceOwnerForgetCatCacheRef()

void ResourceOwnerForgetCatCacheRef ( ResourceOwner  owner,
HeapTuple  tuple 
)

Definition at line 1026 of file resowner.c.

References ResourceOwnerData::catrefarr, elog, ERROR, ResourceOwnerData::name, PointerGetDatum, and ResourceArrayRemove().

Referenced by ReleaseCatCache().

1027 {
1028  if (!ResourceArrayRemove(&(owner->catrefarr), PointerGetDatum(tuple)))
1029  elog(ERROR, "catcache reference %p is not owned by resource owner %s",
1030  tuple, owner->name);
1031 }
ResourceArray catrefarr
Definition: resowner.c:122
#define PointerGetDatum(X)
Definition: postgres.h:556
const char * name
Definition: resowner.c:118
#define ERROR
Definition: elog.h:43
static bool ResourceArrayRemove(ResourceArray *resarr, Datum value)
Definition: resowner.c:301
#define elog(elevel,...)
Definition: elog.h:214

◆ ResourceOwnerForgetDSM()

void ResourceOwnerForgetDSM ( ResourceOwner  owner,
dsm_segment  
)

Definition at line 1322 of file resowner.c.

References dsm_segment_handle(), ResourceOwnerData::dsmarr, elog, ERROR, ResourceOwnerData::name, PointerGetDatum, and ResourceArrayRemove().

Referenced by dsm_create(), dsm_detach(), and dsm_pin_mapping().

1323 {
1324  if (!ResourceArrayRemove(&(owner->dsmarr), PointerGetDatum(seg)))
1325  elog(ERROR, "dynamic shared memory segment %u is not owned by resource owner %s",
1326  dsm_segment_handle(seg), owner->name);
1327 }
#define PointerGetDatum(X)
Definition: postgres.h:556
dsm_handle dsm_segment_handle(dsm_segment *seg)
Definition: dsm.c:1082
const char * name
Definition: resowner.c:118
#define ERROR
Definition: elog.h:43
static bool ResourceArrayRemove(ResourceArray *resarr, Datum value)
Definition: resowner.c:301
#define elog(elevel,...)
Definition: elog.h:214
ResourceArray dsmarr
Definition: resowner.c:129

◆ ResourceOwnerForgetFile()

void ResourceOwnerForgetFile ( ResourceOwner  owner,
File  file 
)

Definition at line 1277 of file resowner.c.

References elog, ERROR, ResourceOwnerData::filearr, FileGetDatum, ResourceOwnerData::name, and ResourceArrayRemove().

Referenced by FileClose().

1278 {
1279  if (!ResourceArrayRemove(&(owner->filearr), FileGetDatum(file)))
1280  elog(ERROR, "temporary file %d is not owned by resource owner %s",
1281  file, owner->name);
1282 }
const char * name
Definition: resowner.c:118
#define ERROR
Definition: elog.h:43
#define FileGetDatum(file)
Definition: resowner.c:42
static bool ResourceArrayRemove(ResourceArray *resarr, Datum value)
Definition: resowner.c:301
#define elog(elevel,...)
Definition: elog.h:214
ResourceArray filearr
Definition: resowner.c:128

◆ ResourceOwnerForgetJIT()

void ResourceOwnerForgetJIT ( ResourceOwner  owner,
Datum  handle 
)

Definition at line 1367 of file resowner.c.

References DatumGetPointer, elog, ERROR, ResourceOwnerData::jitarr, ResourceOwnerData::name, and ResourceArrayRemove().

Referenced by jit_release_context().

1368 {
1369  if (!ResourceArrayRemove(&(owner->jitarr), handle))
1370  elog(ERROR, "JIT context %p is not owned by resource owner %s",
1371  DatumGetPointer(handle), owner->name);
1372 }
const char * name
Definition: resowner.c:118
#define ERROR
Definition: elog.h:43
ResourceArray jitarr
Definition: resowner.c:130
static bool ResourceArrayRemove(ResourceArray *resarr, Datum value)
Definition: resowner.c:301
#define DatumGetPointer(X)
Definition: postgres.h:549
#define elog(elevel,...)
Definition: elog.h:214

◆ ResourceOwnerForgetLock()

void ResourceOwnerForgetLock ( ResourceOwner  owner,
LOCALLOCK locallock 
)

Definition at line 977 of file resowner.c.

References Assert, elog, ERROR, i, ResourceOwnerData::locks, MAX_RESOWNER_LOCKS, ResourceOwnerData::name, and ResourceOwnerData::nlocks.

Referenced by LockReassignOwner(), LockRelease(), LockReleaseAll(), ReleaseLockIfHeld(), and RemoveLocalLock().

978 {
979  int i;
980 
981  if (owner->nlocks > MAX_RESOWNER_LOCKS)
982  return; /* we have overflowed */
983 
984  Assert(owner->nlocks > 0);
985  for (i = owner->nlocks - 1; i >= 0; i--)
986  {
987  if (locallock == owner->locks[i])
988  {
989  owner->locks[i] = owner->locks[owner->nlocks - 1];
990  owner->nlocks--;
991  return;
992  }
993  }
994  elog(ERROR, "lock reference %p is not owned by resource owner %s",
995  locallock, owner->name);
996 }
#define MAX_RESOWNER_LOCKS
Definition: resowner.c:108
const char * name
Definition: resowner.c:118
#define ERROR
Definition: elog.h:43
#define Assert(condition)
Definition: c.h:745
LOCALLOCK * locks[MAX_RESOWNER_LOCKS]
Definition: resowner.c:134
#define elog(elevel,...)
Definition: elog.h:214
int i

◆ ResourceOwnerForgetPlanCacheRef()

void ResourceOwnerForgetPlanCacheRef ( ResourceOwner  owner,
CachedPlan plan 
)

Definition at line 1141 of file resowner.c.

References elog, ERROR, ResourceOwnerData::name, ResourceOwnerData::planrefarr, PointerGetDatum, and ResourceArrayRemove().

Referenced by ReleaseCachedPlan().

1142 {
1143  if (!ResourceArrayRemove(&(owner->planrefarr), PointerGetDatum(plan)))
1144  elog(ERROR, "plancache reference %p is not owned by resource owner %s",
1145  plan, owner->name);
1146 }
#define PointerGetDatum(X)
Definition: postgres.h:556
const char * name
Definition: resowner.c:118
#define ERROR
Definition: elog.h:43
ResourceArray planrefarr
Definition: resowner.c:125
static bool ResourceArrayRemove(ResourceArray *resarr, Datum value)
Definition: resowner.c:301
#define elog(elevel,...)
Definition: elog.h:214

◆ ResourceOwnerForgetRelationRef()

void ResourceOwnerForgetRelationRef ( ResourceOwner  owner,
Relation  rel 
)

Definition at line 1096 of file resowner.c.

References elog, ERROR, ResourceOwnerData::name, PointerGetDatum, RelationGetRelationName, ResourceOwnerData::relrefarr, and ResourceArrayRemove().

Referenced by RelationDecrementReferenceCount().

1097 {
1098  if (!ResourceArrayRemove(&(owner->relrefarr), PointerGetDatum(rel)))
1099  elog(ERROR, "relcache reference %s is not owned by resource owner %s",
1100  RelationGetRelationName(rel), owner->name);
1101 }
ResourceArray relrefarr
Definition: resowner.c:124
#define PointerGetDatum(X)
Definition: postgres.h:556
const char * name
Definition: resowner.c:118
#define ERROR
Definition: elog.h:43
#define RelationGetRelationName(relation)
Definition: rel.h:490
static bool ResourceArrayRemove(ResourceArray *resarr, Datum value)
Definition: resowner.c:301
#define elog(elevel,...)
Definition: elog.h:214

◆ ResourceOwnerForgetSnapshot()

void ResourceOwnerForgetSnapshot ( ResourceOwner  owner,
Snapshot  snapshot 
)

Definition at line 1231 of file resowner.c.

References elog, ERROR, ResourceOwnerData::name, PointerGetDatum, ResourceArrayRemove(), and ResourceOwnerData::snapshotarr.

Referenced by UnregisterSnapshotFromOwner().

1232 {
1233  if (!ResourceArrayRemove(&(owner->snapshotarr), PointerGetDatum(snapshot)))
1234  elog(ERROR, "snapshot reference %p is not owned by resource owner %s",
1235  snapshot, owner->name);
1236 }
#define PointerGetDatum(X)
Definition: postgres.h:556
ResourceArray snapshotarr
Definition: resowner.c:127
const char * name
Definition: resowner.c:118
#define ERROR
Definition: elog.h:43
static bool ResourceArrayRemove(ResourceArray *resarr, Datum value)
Definition: resowner.c:301
#define elog(elevel,...)
Definition: elog.h:214

◆ ResourceOwnerForgetTupleDesc()

void ResourceOwnerForgetTupleDesc ( ResourceOwner  owner,
TupleDesc  tupdesc 
)

Definition at line 1185 of file resowner.c.

References elog, ERROR, ResourceOwnerData::name, PointerGetDatum, ResourceArrayRemove(), and ResourceOwnerData::tupdescarr.

Referenced by DecrTupleDescRefCount().

1186 {
1187  if (!ResourceArrayRemove(&(owner->tupdescarr), PointerGetDatum(tupdesc)))
1188  elog(ERROR, "tupdesc reference %p is not owned by resource owner %s",
1189  tupdesc, owner->name);
1190 }
#define PointerGetDatum(X)
Definition: postgres.h:556
const char * name
Definition: resowner.c:118
#define ERROR
Definition: elog.h:43
ResourceArray tupdescarr
Definition: resowner.c:126
static bool ResourceArrayRemove(ResourceArray *resarr, Datum value)
Definition: resowner.c:301
#define elog(elevel,...)
Definition: elog.h:214

◆ ResourceOwnerRememberBuffer()

void ResourceOwnerRememberBuffer ( ResourceOwner  owner,
Buffer  buffer 
)

Definition at line 930 of file resowner.c.

References ResourceOwnerData::bufferarr, BufferGetDatum, and ResourceArrayAdd().

Referenced by IncrBufferRefCount(), LocalBufferAlloc(), PinBuffer(), and PinBuffer_Locked().

931 {
932  ResourceArrayAdd(&(owner->bufferarr), BufferGetDatum(buffer));
933 }
ResourceArray bufferarr
Definition: resowner.c:121
#define BufferGetDatum(buffer)
Definition: resowner.c:44
static void ResourceArrayAdd(ResourceArray *resarr, Datum value)
Definition: resowner.c:263

◆ ResourceOwnerRememberCatCacheListRef()

void ResourceOwnerRememberCatCacheListRef ( ResourceOwner  owner,
CatCList list 
)

Definition at line 1052 of file resowner.c.

References ResourceOwnerData::catlistrefarr, PointerGetDatum, and ResourceArrayAdd().

Referenced by SearchCatCacheList().

1053 {
1055 }
#define PointerGetDatum(X)
Definition: postgres.h:556
ResourceArray catlistrefarr
Definition: resowner.c:123
static void ResourceArrayAdd(ResourceArray *resarr, Datum value)
Definition: resowner.c:263

◆ ResourceOwnerRememberCatCacheRef()

void ResourceOwnerRememberCatCacheRef ( ResourceOwner  owner,
HeapTuple  tuple 
)

Definition at line 1017 of file resowner.c.

References ResourceOwnerData::catrefarr, PointerGetDatum, and ResourceArrayAdd().

Referenced by SearchCatCacheInternal(), and SearchCatCacheMiss().

1018 {
1019  ResourceArrayAdd(&(owner->catrefarr), PointerGetDatum(tuple));
1020 }
ResourceArray catrefarr
Definition: resowner.c:122
#define PointerGetDatum(X)
Definition: postgres.h:556
static void ResourceArrayAdd(ResourceArray *resarr, Datum value)
Definition: resowner.c:263

◆ ResourceOwnerRememberDSM()

void ResourceOwnerRememberDSM ( ResourceOwner  owner,
dsm_segment  
)

Definition at line 1313 of file resowner.c.

References ResourceOwnerData::dsmarr, PointerGetDatum, and ResourceArrayAdd().

Referenced by dsm_create_descriptor(), and dsm_unpin_mapping().

1314 {
1315  ResourceArrayAdd(&(owner->dsmarr), PointerGetDatum(seg));
1316 }
#define PointerGetDatum(X)
Definition: postgres.h:556
ResourceArray dsmarr
Definition: resowner.c:129
static void ResourceArrayAdd(ResourceArray *resarr, Datum value)
Definition: resowner.c:263

◆ ResourceOwnerRememberFile()

void ResourceOwnerRememberFile ( ResourceOwner  owner,
File  file 
)

Definition at line 1268 of file resowner.c.

References ResourceOwnerData::filearr, FileGetDatum, and ResourceArrayAdd().

Referenced by RegisterTemporaryFile().

1269 {
1270  ResourceArrayAdd(&(owner->filearr), FileGetDatum(file));
1271 }
#define FileGetDatum(file)
Definition: resowner.c:42
static void ResourceArrayAdd(ResourceArray *resarr, Datum value)
Definition: resowner.c:263
ResourceArray filearr
Definition: resowner.c:128

◆ ResourceOwnerRememberJIT()

void ResourceOwnerRememberJIT ( ResourceOwner  owner,
Datum  handle 
)

Definition at line 1358 of file resowner.c.

References ResourceOwnerData::jitarr, and ResourceArrayAdd().

Referenced by llvm_create_context().

1359 {
1360  ResourceArrayAdd(&(owner->jitarr), handle);
1361 }
ResourceArray jitarr
Definition: resowner.c:130
static void ResourceArrayAdd(ResourceArray *resarr, Datum value)
Definition: resowner.c:263

◆ ResourceOwnerRememberLock()

void ResourceOwnerRememberLock ( ResourceOwner  owner,
LOCALLOCK locallock 
)

Definition at line 957 of file resowner.c.

References Assert, ResourceOwnerData::locks, MAX_RESOWNER_LOCKS, and ResourceOwnerData::nlocks.

Referenced by GrantLockLocal(), and LockReassignOwner().

958 {
959  Assert(locallock != NULL);
960 
961  if (owner->nlocks > MAX_RESOWNER_LOCKS)
962  return; /* we have already overflowed */
963 
964  if (owner->nlocks < MAX_RESOWNER_LOCKS)
965  owner->locks[owner->nlocks] = locallock;
966  else
967  {
968  /* overflowed */
969  }
970  owner->nlocks++;
971 }
#define MAX_RESOWNER_LOCKS
Definition: resowner.c:108
#define Assert(condition)
Definition: c.h:745
LOCALLOCK * locks[MAX_RESOWNER_LOCKS]
Definition: resowner.c:134

◆ ResourceOwnerRememberPlanCacheRef()

void ResourceOwnerRememberPlanCacheRef ( ResourceOwner  owner,
CachedPlan plan 
)

Definition at line 1132 of file resowner.c.

References ResourceOwnerData::planrefarr, PointerGetDatum, and ResourceArrayAdd().

Referenced by CachedPlanAllowsSimpleValidityCheck(), CachedPlanIsSimplyValid(), and GetCachedPlan().

1133 {
1134  ResourceArrayAdd(&(owner->planrefarr), PointerGetDatum(plan));
1135 }
#define PointerGetDatum(X)
Definition: postgres.h:556
ResourceArray planrefarr
Definition: resowner.c:125
static void ResourceArrayAdd(ResourceArray *resarr, Datum value)
Definition: resowner.c:263

◆ ResourceOwnerRememberRelationRef()

void ResourceOwnerRememberRelationRef ( ResourceOwner  owner,
Relation  rel 
)

Definition at line 1087 of file resowner.c.

References PointerGetDatum, ResourceOwnerData::relrefarr, and ResourceArrayAdd().

Referenced by RelationIncrementReferenceCount().

1088 {
1089  ResourceArrayAdd(&(owner->relrefarr), PointerGetDatum(rel));
1090 }
ResourceArray relrefarr
Definition: resowner.c:124
#define PointerGetDatum(X)
Definition: postgres.h:556
static void ResourceArrayAdd(ResourceArray *resarr, Datum value)
Definition: resowner.c:263

◆ ResourceOwnerRememberSnapshot()

void ResourceOwnerRememberSnapshot ( ResourceOwner  owner,
Snapshot  snapshot 
)

Definition at line 1222 of file resowner.c.

References PointerGetDatum, ResourceArrayAdd(), and ResourceOwnerData::snapshotarr.

Referenced by RegisterSnapshotOnOwner().

1223 {
1224  ResourceArrayAdd(&(owner->snapshotarr), PointerGetDatum(snapshot));
1225 }
#define PointerGetDatum(X)
Definition: postgres.h:556
ResourceArray snapshotarr
Definition: resowner.c:127
static void ResourceArrayAdd(ResourceArray *resarr, Datum value)
Definition: resowner.c:263

◆ ResourceOwnerRememberTupleDesc()

void ResourceOwnerRememberTupleDesc ( ResourceOwner  owner,
TupleDesc  tupdesc 
)

Definition at line 1176 of file resowner.c.

References PointerGetDatum, ResourceArrayAdd(), and ResourceOwnerData::tupdescarr.

Referenced by IncrTupleDescRefCount().

1177 {
1178  ResourceArrayAdd(&(owner->tupdescarr), PointerGetDatum(tupdesc));
1179 }
#define PointerGetDatum(X)
Definition: postgres.h:556
ResourceArray tupdescarr
Definition: resowner.c:126
static void ResourceArrayAdd(ResourceArray *resarr, Datum value)
Definition: resowner.c:263