46 "array length mismatch");
56 "array length mismatch");
68 #define NUM_LOCK_STATUS_COLUMNS 16
84 snprintf(vxidstr,
sizeof(vxidstr),
"%d/%u", bid, lxid);
148 TIMESTAMPTZOID, -1, 0);
175 const char *locktypename;
240 snprintf(tnbuf,
sizeof(tnbuf),
"unknown %d",
242 locktypename = tnbuf;
357 if (instance->
pid != 0)
364 if (!granted && instance->
waitStart != 0)
497 blocked_instance = NULL;
502 if (instance->
pid == bproc->
pid)
504 Assert(blocked_instance == NULL);
505 blocked_instance = instance;
508 Assert(blocked_instance != NULL);
519 if (instance == blocked_instance)
525 if (conflictMask & instance->
holdMask)
538 if (preceding_waiters[k] == instance->
pid)
560 Assert(narrayelems <= lockData->nlocks);
579 Datum *blocker_datums;
589 if (num_blockers > 0)
594 for (
i = 0;
i < num_blockers; ++
i)
598 blocker_datums = NULL;
621 int32 *interesting_pids;
622 int32 *blocking_pids;
623 int num_interesting_pids;
624 int num_blocking_pids;
632 elog(
ERROR,
"array must not contain nulls");
659 for (
i = 0;
i < num_blocking_pids;
i++)
660 for (
j = 0;
j < num_interesting_pids;
j++)
662 if (blocking_pids[
i] == interesting_pids[
j])
692 #define SET_LOCKTAG_INT64(tag, key64) \
693 SET_LOCKTAG_ADVISORY(tag, \
695 (uint32) ((key64) >> 32), \
698 #define SET_LOCKTAG_INT32(tag, key1, key2) \
699 SET_LOCKTAG_ADVISORY(tag, MyDatabaseId, key1, key2, 2)
#define PG_GETARG_ARRAYTYPE_P(n)
#define DatumGetArrayTypeP(X)
#define PG_RETURN_ARRAYTYPE_P(x)
bool array_contains_nulls(ArrayType *array)
ArrayType * construct_array_builtin(Datum *elems, int nelems, Oid elmtype)
int ArrayGetNItems(int ndim, const int *dims)
static Datum values[MAXATTR]
#define CStringGetTextDatum(s)
uint32 LocalTransactionId
static void PGresult * res
elog(ERROR, "%s: %s", p2, msg)
TupleDesc BlessTupleDesc(TupleDesc tupdesc)
#define DirectFunctionCall1(func, arg1)
#define PG_GETARG_INT64(n)
#define PG_GETARG_INT32(n)
#define PG_RETURN_BOOL(x)
#define SRF_IS_FIRSTCALL()
#define SRF_PERCALL_SETUP()
#define SRF_RETURN_NEXT(_funcctx, _result)
#define SRF_FIRSTCALL_INIT()
static Datum HeapTupleGetDatum(const HeapTupleData *tuple)
#define SRF_RETURN_DONE(_funcctx)
HeapTuple heap_form_tuple(TupleDesc tupleDescriptor, Datum *values, bool *isnull)
Assert(fmt[strlen(fmt) - 1] !='\n')
LockAcquireResult LockAcquire(const LOCKTAG *locktag, LOCKMODE lockmode, bool sessionLock, bool dontWait)
bool LockRelease(const LOCKTAG *locktag, LOCKMODE lockmode, bool sessionLock)
BlockedProcsData * GetBlockerStatusData(int blocked_pid)
LockData * GetLockStatusData(void)
void LockReleaseSession(LOCKMETHODID lockmethodid)
const char * GetLockmodeName(LOCKMETHODID lockmethodid, LOCKMODE mode)
LockMethod GetLockTagsMethodTable(const LOCKTAG *locktag)
@ LOCKTAG_RELATION_EXTEND
@ LOCKTAG_SPECULATIVE_TOKEN
@ LOCKTAG_APPLY_TRANSACTION
@ LOCKTAG_DATABASE_FROZEN_IDS
@ LOCKTAG_VIRTUALTRANSACTION
#define LOCKBIT_OFF(lockmode)
#define LOCKTAG_LAST_TYPE
#define LOCKBIT_ON(lockmode)
Datum pg_advisory_lock_int4(PG_FUNCTION_ARGS)
#define SET_LOCKTAG_INT64(tag, key64)
Datum pg_try_advisory_xact_lock_int4(PG_FUNCTION_ARGS)
Datum pg_advisory_unlock_int8(PG_FUNCTION_ARGS)
Datum pg_advisory_lock_shared_int4(PG_FUNCTION_ARGS)
Datum pg_safe_snapshot_blocking_pids(PG_FUNCTION_ARGS)
Datum pg_advisory_lock_int8(PG_FUNCTION_ARGS)
Datum pg_try_advisory_xact_lock_shared_int8(PG_FUNCTION_ARGS)
Datum pg_advisory_xact_lock_int8(PG_FUNCTION_ARGS)
Datum pg_try_advisory_lock_shared_int4(PG_FUNCTION_ARGS)
Datum pg_try_advisory_lock_int4(PG_FUNCTION_ARGS)
#define SET_LOCKTAG_INT32(tag, key1, key2)
#define NUM_LOCK_STATUS_COLUMNS
Datum pg_advisory_unlock_shared_int4(PG_FUNCTION_ARGS)
Datum pg_advisory_unlock_int4(PG_FUNCTION_ARGS)
static const char *const PredicateLockTagTypeNames[]
Datum pg_try_advisory_lock_shared_int8(PG_FUNCTION_ARGS)
Datum pg_lock_status(PG_FUNCTION_ARGS)
Datum pg_advisory_xact_lock_int4(PG_FUNCTION_ARGS)
StaticAssertDecl(lengthof(LockTagTypeNames)==(LOCKTAG_LAST_TYPE+1), "array length mismatch")
Datum pg_try_advisory_xact_lock_int8(PG_FUNCTION_ARGS)
Datum pg_blocking_pids(PG_FUNCTION_ARGS)
Datum pg_advisory_lock_shared_int8(PG_FUNCTION_ARGS)
Datum pg_try_advisory_xact_lock_shared_int4(PG_FUNCTION_ARGS)
static Datum VXIDGetDatum(BackendId bid, LocalTransactionId lxid)
Datum pg_advisory_xact_lock_shared_int8(PG_FUNCTION_ARGS)
Datum pg_advisory_unlock_shared_int8(PG_FUNCTION_ARGS)
Datum pg_try_advisory_lock_int8(PG_FUNCTION_ARGS)
Datum pg_advisory_unlock_all(PG_FUNCTION_ARGS)
const char *const LockTagTypeNames[]
Datum pg_isolation_test_session_is_blocked(PG_FUNCTION_ARGS)
Datum pg_advisory_xact_lock_shared_int4(PG_FUNCTION_ARGS)
static MemoryContext MemoryContextSwitchTo(MemoryContext context)
static PgChecksumMode mode
static Datum TransactionIdGetDatum(TransactionId X)
static Datum Int16GetDatum(int16 X)
static Datum UInt16GetDatum(uint16 X)
static Datum BoolGetDatum(bool X)
static Datum ObjectIdGetDatum(Oid X)
static Datum Int32GetDatum(int32 X)
static Datum UInt32GetDatum(uint32 X)
PredicateLockData * GetPredicateLockStatusData(void)
int GetSafeSnapshotBlockingPids(int blocked_pid, int *output, int output_size)
#define GET_PREDICATELOCKTARGETTAG_DB(locktag)
#define GET_PREDICATELOCKTARGETTAG_RELATION(locktag)
#define GET_PREDICATELOCKTARGETTAG_TYPE(locktag)
#define GET_PREDICATELOCKTARGETTAG_PAGE(locktag)
#define GET_PREDICATELOCKTARGETTAG_OFFSET(locktag)
MemoryContext multi_call_memory_ctx
uint8 locktag_lockmethodid
const LOCKMASK * conflictTab
PredicateLockData * predLockData
PREDICATELOCKTARGETTAG * locktags
VirtualTransactionId vxid
LocalTransactionId localTransactionId
TupleDesc CreateTemplateTupleDesc(int natts)
void TupleDescInitEntry(TupleDesc desc, AttrNumber attributeNumber, const char *attributeName, Oid oidtypeid, int32 typmod, int attdim)
static Datum TimestampTzGetDatum(TimestampTz X)