45 "array length mismatch");
55 "array length mismatch");
67 #define NUM_LOCK_STATUS_COLUMNS 16
83 snprintf(vxidstr,
sizeof(vxidstr),
"%d/%u", bid, lxid);
147 TIMESTAMPTZOID, -1, 0);
174 const char *locktypename;
239 snprintf(tnbuf,
sizeof(tnbuf),
"unknown %d",
241 locktypename = tnbuf;
356 if (instance->
pid != 0)
363 if (!granted && instance->
waitStart != 0)
496 blocked_instance = NULL;
501 if (instance->
pid == bproc->
pid)
503 Assert(blocked_instance == NULL);
504 blocked_instance = instance;
507 Assert(blocked_instance != NULL);
518 if (instance == blocked_instance)
524 if (conflictMask & instance->
holdMask)
537 if (preceding_waiters[k] == instance->
pid)
559 Assert(narrayelems <= lockData->nlocks);
578 Datum *blocker_datums;
588 if (num_blockers > 0)
593 for (
i = 0;
i < num_blockers; ++
i)
597 blocker_datums = NULL;
620 int32 *interesting_pids;
621 int32 *blocking_pids;
622 int num_interesting_pids;
623 int num_blocking_pids;
631 elog(
ERROR,
"array must not contain nulls");
658 for (
i = 0;
i < num_blocking_pids;
i++)
659 for (
j = 0;
j < num_interesting_pids;
j++)
661 if (blocking_pids[
i] == interesting_pids[
j])
691 #define SET_LOCKTAG_INT64(tag, key64) \
692 SET_LOCKTAG_ADVISORY(tag, \
694 (uint32) ((key64) >> 32), \
697 #define SET_LOCKTAG_INT32(tag, key1, key2) \
698 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)