PostgreSQL Source Code
git master
|
#include "postgres.h"
#include "access/htup_details.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 66 of file lockfuncs.c.
#define SET_LOCKTAG_INT32 | ( | tag, | |
key1, | |||
key2 | |||
) | SET_LOCKTAG_ADVISORY(tag, MyDatabaseId, key1, key2, 2) |
Definition at line 619 of file lockfuncs.c.
#define SET_LOCKTAG_INT64 | ( | tag, | |
key64 | |||
) |
Definition at line 613 of file lockfuncs.c.
Datum pg_advisory_lock_int4 | ( | PG_FUNCTION_ARGS | ) |
Definition at line 808 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 626 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 843 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 659 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 1000 of file lockfuncs.c.
References LockReleaseSession(), PG_RETURN_VOID, and USER_LOCKMETHOD.
Datum pg_advisory_unlock_int4 | ( | PG_FUNCTION_ARGS | ) |
Definition at line 962 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 772 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 982 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 791 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 826 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 643 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 861 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 676 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 466 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_lock_status | ( | PG_FUNCTION_ARGS | ) |
Definition at line 93 of file lockfuncs.c.
References 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, 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, VirtualTransactionId::procNumber, 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, LockInstanceData::vxid, SERIALIZABLEXACT::vxid, VXIDGetDatum(), LockInstanceData::waitLockMode, LockInstanceData::waitStart, while(), and PredicateLockData::xacts.
Datum pg_safe_snapshot_blocking_pids | ( | PG_FUNCTION_ARGS | ) |
Definition at line 573 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 880 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 694 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 921 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 733 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 901 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 714 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 942 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 753 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 74 of file lockfuncs.c.
References CStringGetTextDatum, and snprintf.
Referenced by pg_lock_status().
const char* const LockTagTypeNames[] |
Definition at line 28 of file lockfuncs.c.
Referenced by GetLockNameFromTagType(), and pg_lock_status().
|
static |
Definition at line 47 of file lockfuncs.c.
Referenced by pg_lock_status().