44 "array length mismatch");
54 "array length mismatch");
66 #define NUM_LOCK_STATUS_COLUMNS 15 82 snprintf(vxidstr,
sizeof(vxidstr),
"%d/%u", bid, lxid);
171 const char *locktypename;
231 MemSet(values, 0,
sizeof(values));
232 MemSet(nulls,
false,
sizeof(nulls));
238 snprintf(tnbuf,
sizeof(tnbuf),
"unknown %d",
240 locktypename = tnbuf;
332 if (instance->
pid != 0)
366 MemSet(values, 0,
sizeof(values));
367 MemSet(nulls,
false,
sizeof(nulls));
456 for (i = 0; i < lockData->
nprocs; i++)
469 blocked_instance = NULL;
474 if (instance->
pid == bproc->
pid)
476 Assert(blocked_instance == NULL);
477 blocked_instance = instance;
480 Assert(blocked_instance != NULL);
491 if (instance == blocked_instance)
497 if (conflictMask & instance->
holdMask)
510 if (preceding_waiters[k] == instance->
pid)
532 Assert(narrayelems <= lockData->nlocks);
537 sizeof(
int32),
true, TYPALIGN_INT));
554 Datum *blocker_datums;
564 if (num_blockers > 0)
569 for (i = 0; i < num_blockers; ++
i)
573 blocker_datums = NULL;
578 sizeof(
int32),
true, TYPALIGN_INT));
599 int32 *interesting_pids;
600 int32 *blocking_pids;
601 int num_interesting_pids;
602 int num_blocking_pids;
610 elog(
ERROR,
"array must not contain nulls");
637 for (i = 0; i < num_blocking_pids; i++)
638 for (j = 0; j < num_interesting_pids; j++)
640 if (blocking_pids[i] == interesting_pids[j])
670 #define SET_LOCKTAG_INT64(tag, key64) \ 671 SET_LOCKTAG_ADVISORY(tag, \ 673 (uint32) ((key64) >> 32), \ 676 #define SET_LOCKTAG_INT32(tag, key1, key2) \ 677 SET_LOCKTAG_ADVISORY(tag, MyDatabaseId, key1, key2, 2) #define GET_PREDICATELOCKTARGETTAG_RELATION(locktag)
#define GET_PREDICATELOCKTARGETTAG_PAGE(locktag)
static PgChecksumMode mode
#define PG_GETARG_INT32(n)
Datum pg_try_advisory_xact_lock_shared_int8(PG_FUNCTION_ARGS)
LockAcquireResult LockAcquire(const LOCKTAG *locktag, LOCKMODE lockmode, bool sessionLock, bool dontWait)
const char * GetLockmodeName(LOCKMETHODID lockmethodid, LOCKMODE mode)
StaticAssertDecl(lengthof(LockTagTypeNames)==(LOCKTAG_ADVISORY+1), "array length mismatch")
TupleDesc CreateTemplateTupleDesc(int natts)
BlockedProcsData * GetBlockerStatusData(int blocked_pid)
Datum pg_isolation_test_session_is_blocked(PG_FUNCTION_ARGS)
#define SET_LOCKTAG_INT32(tag, key1, key2)
#define SRF_IS_FIRSTCALL()
int ArrayGetNItems(int ndim, const int *dims)
Datum pg_try_advisory_xact_lock_int4(PG_FUNCTION_ARGS)
static MemoryContext MemoryContextSwitchTo(MemoryContext context)
Datum pg_advisory_lock_shared_int4(PG_FUNCTION_ARGS)
ArrayType * construct_array(Datum *elems, int nelems, Oid elmtype, int elmlen, bool elmbyval, char elmalign)
const LOCKMASK * conflictTab
#define MemSet(start, val, len)
HeapTuple heap_form_tuple(TupleDesc tupleDescriptor, Datum *values, bool *isnull)
#define DirectFunctionCall1(func, arg1)
LocalTransactionId localTransactionId
#define NUM_LOCK_STATUS_COLUMNS
#define SRF_PERCALL_SETUP()
PredicateLockData * GetPredicateLockStatusData(void)
#define SRF_RETURN_NEXT(_funcctx, _result)
#define LOCKBIT_OFF(lockmode)
#define PG_GETARG_ARRAYTYPE_P(n)
#define GET_PREDICATELOCKTARGETTAG_OFFSET(locktag)
#define ObjectIdGetDatum(X)
Datum pg_blocking_pids(PG_FUNCTION_ARGS)
Datum pg_advisory_lock_int4(PG_FUNCTION_ARGS)
Datum pg_try_advisory_lock_int8(PG_FUNCTION_ARGS)
TupleDesc BlessTupleDesc(TupleDesc tupdesc)
Datum pg_try_advisory_xact_lock_int8(PG_FUNCTION_ARGS)
LockData * GetLockStatusData(void)
VirtualTransactionId vxid
#define GET_PREDICATELOCKTARGETTAG_TYPE(locktag)
Datum pg_try_advisory_lock_shared_int4(PG_FUNCTION_ARGS)
#define GET_PREDICATELOCKTARGETTAG_DB(locktag)
#define UInt32GetDatum(X)
uint32 LocalTransactionId
Datum pg_advisory_xact_lock_shared_int4(PG_FUNCTION_ARGS)
void TupleDescInitEntry(TupleDesc desc, AttrNumber attributeNumber, const char *attributeName, Oid oidtypeid, int32 typmod, int attdim)
Datum pg_advisory_lock_shared_int8(PG_FUNCTION_ARGS)
#define PG_RETURN_ARRAYTYPE_P(x)
Datum pg_advisory_unlock_all(PG_FUNCTION_ARGS)
PREDICATELOCKTARGETTAG * locktags
static const char *const PredicateLockTagTypeNames[]
#define TransactionIdGetDatum(X)
Datum pg_try_advisory_lock_int4(PG_FUNCTION_ARGS)
Datum pg_safe_snapshot_blocking_pids(PG_FUNCTION_ARGS)
Datum pg_try_advisory_lock_shared_int8(PG_FUNCTION_ARGS)
#define PG_RETURN_BOOL(x)
LockMethod GetLockTagsMethodTable(const LOCKTAG *locktag)
#define LOCKTAG_LAST_TYPE
#define Assert(condition)
Datum pg_advisory_unlock_int8(PG_FUNCTION_ARGS)
MemoryContext multi_call_memory_ctx
void LockReleaseSession(LOCKMETHODID lockmethodid)
#define HeapTupleGetDatum(tuple)
Datum pg_advisory_xact_lock_shared_int8(PG_FUNCTION_ARGS)
uint8 locktag_lockmethodid
#define LOCKBIT_ON(lockmode)
static Datum values[MAXATTR]
PredicateLockData * predLockData
Datum pg_advisory_unlock_shared_int8(PG_FUNCTION_ARGS)
Datum pg_lock_status(PG_FUNCTION_ARGS)
bool LockRelease(const LOCKTAG *locktag, LOCKMODE lockmode, bool sessionLock)
int GetSafeSnapshotBlockingPids(int blocked_pid, int *output, int output_size)
#define CStringGetTextDatum(s)
const char *const LockTagTypeNames[]
Datum pg_advisory_xact_lock_int4(PG_FUNCTION_ARGS)
Datum pg_advisory_unlock_shared_int4(PG_FUNCTION_ARGS)
Datum pg_advisory_xact_lock_int8(PG_FUNCTION_ARGS)
#define SET_LOCKTAG_INT64(tag, key64)
bool array_contains_nulls(ArrayType *array)
#define PG_GETARG_INT64(n)
#define UInt16GetDatum(X)
static Datum VXIDGetDatum(BackendId bid, LocalTransactionId lxid)
Datum pg_advisory_lock_int8(PG_FUNCTION_ARGS)
Datum pg_advisory_unlock_int4(PG_FUNCTION_ARGS)
Datum pg_try_advisory_xact_lock_shared_int4(PG_FUNCTION_ARGS)
#define SRF_RETURN_DONE(_funcctx)
#define DatumGetArrayTypeP(X)
#define SRF_FIRSTCALL_INIT()