PostgreSQL Source Code
git master
|
#include "postgres.h"
#include "access/htup_details.h"
#include "access/xact.h"
#include "catalog/pg_type.h"
#include "funcapi.h"
#include "miscadmin.h"
#include "storage/predicate_internals.h"
#include "utils/array.h"
#include "utils/builtins.h"
Go to the source code of this file.
Data Structures | |
struct | PG_Lock_Status |
Macros | |
#define | NUM_LOCK_STATUS_COLUMNS 16 |
#define | SET_LOCKTAG_INT64(tag, key64) |
#define | SET_LOCKTAG_INT32(tag, key1, key2) SET_LOCKTAG_ADVISORY(tag, MyDatabaseId, key1, key2, 2) |
Variables | |
const char *const | LockTagTypeNames [] |
static const char *const | PredicateLockTagTypeNames [] |
#define NUM_LOCK_STATUS_COLUMNS 16 |
Definition at line 68 of file lockfuncs.c.
#define SET_LOCKTAG_INT32 | ( | tag, | |
key1, | |||
key2 | |||
) | SET_LOCKTAG_ADVISORY(tag, MyDatabaseId, key1, key2, 2) |
Definition at line 698 of file lockfuncs.c.
#define SET_LOCKTAG_INT64 | ( | tag, | |
key64 | |||
) |
Definition at line 692 of file lockfuncs.c.
Datum pg_advisory_lock_int4 | ( | PG_FUNCTION_ARGS | ) |
Definition at line 887 of file lockfuncs.c.
References ExclusiveLock, LockAcquire(), PG_GETARG_INT32, PG_RETURN_VOID, and SET_LOCKTAG_INT32.
Datum pg_advisory_lock_int8 | ( | PG_FUNCTION_ARGS | ) |
Definition at line 705 of file lockfuncs.c.
References ExclusiveLock, sort-test::key, LockAcquire(), PG_GETARG_INT64, PG_RETURN_VOID, and SET_LOCKTAG_INT64.
Referenced by delay_execution_planner().
Datum pg_advisory_lock_shared_int4 | ( | PG_FUNCTION_ARGS | ) |
Definition at line 922 of file lockfuncs.c.
References LockAcquire(), PG_GETARG_INT32, PG_RETURN_VOID, SET_LOCKTAG_INT32, and ShareLock.
Datum pg_advisory_lock_shared_int8 | ( | PG_FUNCTION_ARGS | ) |
Definition at line 738 of file lockfuncs.c.
References sort-test::key, LockAcquire(), PG_GETARG_INT64, PG_RETURN_VOID, SET_LOCKTAG_INT64, and ShareLock.
Datum pg_advisory_unlock_all | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1079 of file lockfuncs.c.
References LockReleaseSession(), PG_RETURN_VOID, and USER_LOCKMETHOD.
Datum pg_advisory_unlock_int4 | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1041 of file lockfuncs.c.
References ExclusiveLock, LockRelease(), PG_GETARG_INT32, PG_RETURN_BOOL, res, and SET_LOCKTAG_INT32.
Datum pg_advisory_unlock_int8 | ( | PG_FUNCTION_ARGS | ) |
Definition at line 851 of file lockfuncs.c.
References ExclusiveLock, sort-test::key, LockRelease(), PG_GETARG_INT64, PG_RETURN_BOOL, res, and SET_LOCKTAG_INT64.
Referenced by delay_execution_planner().
Datum pg_advisory_unlock_shared_int4 | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1061 of file lockfuncs.c.
References LockRelease(), PG_GETARG_INT32, PG_RETURN_BOOL, res, SET_LOCKTAG_INT32, and ShareLock.
Datum pg_advisory_unlock_shared_int8 | ( | PG_FUNCTION_ARGS | ) |
Definition at line 870 of file lockfuncs.c.
References sort-test::key, LockRelease(), PG_GETARG_INT64, PG_RETURN_BOOL, res, SET_LOCKTAG_INT64, and ShareLock.
Datum pg_advisory_xact_lock_int4 | ( | PG_FUNCTION_ARGS | ) |
Definition at line 905 of file lockfuncs.c.
References ExclusiveLock, LockAcquire(), PG_GETARG_INT32, PG_RETURN_VOID, and SET_LOCKTAG_INT32.
Datum pg_advisory_xact_lock_int8 | ( | PG_FUNCTION_ARGS | ) |
Definition at line 722 of file lockfuncs.c.
References ExclusiveLock, sort-test::key, LockAcquire(), PG_GETARG_INT64, PG_RETURN_VOID, and SET_LOCKTAG_INT64.
Datum pg_advisory_xact_lock_shared_int4 | ( | PG_FUNCTION_ARGS | ) |
Definition at line 940 of file lockfuncs.c.
References LockAcquire(), PG_GETARG_INT32, PG_RETURN_VOID, SET_LOCKTAG_INT32, and ShareLock.
Datum pg_advisory_xact_lock_shared_int8 | ( | PG_FUNCTION_ARGS | ) |
Definition at line 755 of file lockfuncs.c.
References sort-test::key, LockAcquire(), PG_GETARG_INT64, PG_RETURN_VOID, SET_LOCKTAG_INT64, and ShareLock.
Datum pg_blocking_pids | ( | PG_FUNCTION_ARGS | ) |
Definition at line 467 of file lockfuncs.c.
References Assert(), LockMethodData::conflictTab, construct_array_builtin(), BlockedProcData::first_lock, BlockedProcData::first_waiter, GetBlockerStatusData(), GetLockTagsMethodTable(), LockInstanceData::holdMask, i, Int32GetDatum(), j, LockInstanceData::leaderPid, LOCKBIT_ON, BlockedProcsData::locks, LockInstanceData::locktag, BlockedProcsData::nlocks, NoLock, BlockedProcsData::nprocs, BlockedProcData::num_locks, BlockedProcData::num_waiters, palloc(), PG_GETARG_INT32, PG_RETURN_ARRAYTYPE_P, LockInstanceData::pid, BlockedProcData::pid, BlockedProcsData::procs, BlockedProcsData::waiter_pids, and LockInstanceData::waitLockMode.
Referenced by pg_isolation_test_session_is_blocked().
Datum pg_isolation_test_session_is_blocked | ( | PG_FUNCTION_ARGS | ) |
Definition at line 616 of file lockfuncs.c.
References ARR_DATA_PTR, ARR_DIMS, ARR_ELEMTYPE, ARR_NDIM, array_contains_nulls(), ArrayGetNItems(), Assert(), DatumGetArrayTypeP, DirectFunctionCall1, elog(), ERROR, GetSafeSnapshotBlockingPids(), i, j, pg_blocking_pids(), PG_GETARG_ARRAYTYPE_P, PG_GETARG_INT32, and PG_RETURN_BOOL.
Datum pg_lock_status | ( | PG_FUNCTION_ARGS | ) |
Definition at line 94 of file lockfuncs.c.
References LockInstanceData::backend, VirtualTransactionId::backendId, BlessTupleDesc(), BoolGetDatum(), CreateTemplateTupleDesc(), CStringGetTextDatum, PG_Lock_Status::currIdx, LockInstanceData::fastpath, GET_PREDICATELOCKTARGETTAG_DB, GET_PREDICATELOCKTARGETTAG_OFFSET, GET_PREDICATELOCKTARGETTAG_PAGE, GET_PREDICATELOCKTARGETTAG_RELATION, GET_PREDICATELOCKTARGETTAG_TYPE, GetLockmodeName(), GetLockStatusData(), GetPredicateLockStatusData(), heap_form_tuple(), HeapTupleGetDatum(), LockInstanceData::holdMask, Int16GetDatum(), Int32GetDatum(), VirtualTransactionId::localTransactionId, LOCKBIT_OFF, LOCKBIT_ON, PG_Lock_Status::lockData, LockData::locks, LockInstanceData::locktag, LOCKTAG_ADVISORY, LOCKTAG_APPLY_TRANSACTION, LOCKTAG_DATABASE_FROZEN_IDS, LOCKTAG::locktag_field1, LOCKTAG::locktag_field2, LOCKTAG::locktag_field3, LOCKTAG::locktag_field4, LOCKTAG_LAST_TYPE, LOCKTAG::locktag_lockmethodid, LOCKTAG_OBJECT, LOCKTAG_PAGE, LOCKTAG_RELATION, LOCKTAG_RELATION_EXTEND, LOCKTAG_SPECULATIVE_TOKEN, LOCKTAG_TRANSACTION, LOCKTAG_TUPLE, LOCKTAG::locktag_type, LOCKTAG_USERLOCK, LOCKTAG_VIRTUALTRANSACTION, PredicateLockData::locktags, LockTagTypeNames, LockInstanceData::lxid, MAX_LOCKMODES, MemoryContextSwitchTo(), mode, FuncCallContext::multi_call_memory_ctx, LockData::nelements, PredicateLockData::nelements, NoLock, NUM_LOCK_STATUS_COLUMNS, ObjectIdGetDatum(), palloc(), LockInstanceData::pid, SERIALIZABLEXACT::pid, PredicateLockTagTypeNames, PG_Lock_Status::predLockData, PG_Lock_Status::predLockIdx, PREDLOCKTAG_PAGE, PREDLOCKTAG_TUPLE, snprintf, SRF_FIRSTCALL_INIT, SRF_IS_FIRSTCALL, SRF_PERCALL_SETUP, SRF_RETURN_DONE, SRF_RETURN_NEXT, TimestampTzGetDatum(), TransactionIdGetDatum(), FuncCallContext::tuple_desc, TupleDescInitEntry(), UInt16GetDatum(), UInt32GetDatum(), FuncCallContext::user_fctx, values, SERIALIZABLEXACT::vxid, VXIDGetDatum(), LockInstanceData::waitLockMode, LockInstanceData::waitStart, while(), and PredicateLockData::xacts.
Datum pg_safe_snapshot_blocking_pids | ( | PG_FUNCTION_ARGS | ) |
Definition at line 574 of file lockfuncs.c.
References construct_array_builtin(), GetSafeSnapshotBlockingPids(), i, Int32GetDatum(), MaxBackends, palloc(), PG_GETARG_INT32, and PG_RETURN_ARRAYTYPE_P.
Datum pg_try_advisory_lock_int4 | ( | PG_FUNCTION_ARGS | ) |
Definition at line 959 of file lockfuncs.c.
References ExclusiveLock, LockAcquire(), LOCKACQUIRE_NOT_AVAIL, PG_GETARG_INT32, PG_RETURN_BOOL, res, and SET_LOCKTAG_INT32.
Datum pg_try_advisory_lock_int8 | ( | PG_FUNCTION_ARGS | ) |
Definition at line 773 of file lockfuncs.c.
References ExclusiveLock, sort-test::key, LockAcquire(), LOCKACQUIRE_NOT_AVAIL, PG_GETARG_INT64, PG_RETURN_BOOL, res, and SET_LOCKTAG_INT64.
Datum pg_try_advisory_lock_shared_int4 | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1000 of file lockfuncs.c.
References LockAcquire(), LOCKACQUIRE_NOT_AVAIL, PG_GETARG_INT32, PG_RETURN_BOOL, res, SET_LOCKTAG_INT32, and ShareLock.
Datum pg_try_advisory_lock_shared_int8 | ( | PG_FUNCTION_ARGS | ) |
Definition at line 812 of file lockfuncs.c.
References sort-test::key, LockAcquire(), LOCKACQUIRE_NOT_AVAIL, PG_GETARG_INT64, PG_RETURN_BOOL, res, SET_LOCKTAG_INT64, and ShareLock.
Datum pg_try_advisory_xact_lock_int4 | ( | PG_FUNCTION_ARGS | ) |
Definition at line 980 of file lockfuncs.c.
References ExclusiveLock, LockAcquire(), LOCKACQUIRE_NOT_AVAIL, PG_GETARG_INT32, PG_RETURN_BOOL, res, and SET_LOCKTAG_INT32.
Datum pg_try_advisory_xact_lock_int8 | ( | PG_FUNCTION_ARGS | ) |
Definition at line 793 of file lockfuncs.c.
References ExclusiveLock, sort-test::key, LockAcquire(), LOCKACQUIRE_NOT_AVAIL, PG_GETARG_INT64, PG_RETURN_BOOL, res, and SET_LOCKTAG_INT64.
Datum pg_try_advisory_xact_lock_shared_int4 | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1021 of file lockfuncs.c.
References LockAcquire(), LOCKACQUIRE_NOT_AVAIL, PG_GETARG_INT32, PG_RETURN_BOOL, res, SET_LOCKTAG_INT32, and ShareLock.
Datum pg_try_advisory_xact_lock_shared_int8 | ( | PG_FUNCTION_ARGS | ) |
Definition at line 832 of file lockfuncs.c.
References sort-test::key, LockAcquire(), LOCKACQUIRE_NOT_AVAIL, PG_GETARG_INT64, PG_RETURN_BOOL, res, SET_LOCKTAG_INT64, and ShareLock.
StaticAssertDecl | ( | lengthof(LockTagTypeNames) | = =(LOCKTAG_LAST_TYPE+1) , |
"array length mismatch" | |||
) |
StaticAssertDecl | ( | lengthof(PredicateLockTagTypeNames) | = =(PREDLOCKTAG_TUPLE+1) , |
"array length mismatch" | |||
) |
|
static |
Definition at line 76 of file lockfuncs.c.
References CStringGetTextDatum, and snprintf.
Referenced by pg_lock_status().
const char* const LockTagTypeNames[] |
Definition at line 30 of file lockfuncs.c.
Referenced by GetLockNameFromTagType(), and pg_lock_status().
|
static |
Definition at line 49 of file lockfuncs.c.
Referenced by pg_lock_status().