44 "array length mismatch");
54 "array length mismatch");
66 #define NUM_LOCK_STATUS_COLUMNS 16
82 snprintf(vxidstr,
sizeof(vxidstr),
"%d/%u", bid, lxid);
146 TIMESTAMPTZOID, -1, 0);
173 const char *locktypename;
234 MemSet(nulls,
false,
sizeof(nulls));
240 snprintf(tnbuf,
sizeof(tnbuf),
"unknown %d",
242 locktypename = tnbuf;
334 if (instance->
pid != 0)
341 if (!granted && instance->
waitStart != 0)
373 MemSet(nulls,
false,
sizeof(nulls));
476 blocked_instance = NULL;
481 if (instance->
pid == bproc->
pid)
483 Assert(blocked_instance == NULL);
484 blocked_instance = instance;
487 Assert(blocked_instance != NULL);
498 if (instance == blocked_instance)
504 if (conflictMask & instance->
holdMask)
517 if (preceding_waiters[k] == instance->
pid)
539 Assert(narrayelems <= lockData->nlocks);
544 sizeof(
int32),
true, TYPALIGN_INT));
561 Datum *blocker_datums;
571 if (num_blockers > 0)
576 for (
i = 0;
i < num_blockers; ++
i)
580 blocker_datums = NULL;
585 sizeof(
int32),
true, TYPALIGN_INT));
606 int32 *interesting_pids;
607 int32 *blocking_pids;
608 int num_interesting_pids;
609 int num_blocking_pids;
617 elog(
ERROR,
"array must not contain nulls");
644 for (
i = 0;
i < num_blocking_pids;
i++)
645 for (
j = 0;
j < num_interesting_pids;
j++)
647 if (blocking_pids[
i] == interesting_pids[
j])
677 #define SET_LOCKTAG_INT64(tag, key64) \
678 SET_LOCKTAG_ADVISORY(tag, \
680 (uint32) ((key64) >> 32), \
683 #define SET_LOCKTAG_INT32(tag, key1, key2) \
684 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(Datum *elems, int nelems, Oid elmtype, int elmlen, bool elmbyval, char elmalign)
int ArrayGetNItems(int ndim, const int *dims)
static Datum values[MAXATTR]
#define CStringGetTextDatum(s)
uint32 LocalTransactionId
#define MemSet(start, val, len)
static void PGresult * res
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 HeapTupleGetDatum(tuple)
#define SRF_RETURN_NEXT(_funcctx, _result)
#define SRF_FIRSTCALL_INIT()
#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_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)
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)
StaticAssertDecl(lengthof(LockTagTypeNames)==(LOCKTAG_ADVISORY+1), "array length mismatch")
Datum pg_advisory_xact_lock_shared_int4(PG_FUNCTION_ARGS)
static MemoryContext MemoryContextSwitchTo(MemoryContext context)
static PgChecksumMode mode
#define TransactionIdGetDatum(X)
#define UInt32GetDatum(X)
#define ObjectIdGetDatum(X)
#define UInt16GetDatum(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)
#define TimestampTzGetDatum(X)