196 "MAX_BACKENDS_BITS too big for * 4");
243 elog(
FATAL,
"deadlock seems to have disappeared");
264 for (
int j = 0;
j < nProcs;
j++)
348 elog(
FATAL,
"inconsistent results during deadlock check");
578 for (
lm = 1;
lm <= numLockModes;
lm++)
651 for (
i = 0;
i < queue_size;
i++)
928 for (
j = queue_size; --
j >= 0;)
957 for (k = queue_size; --k >= 0;)
997 last = queue_size - 1;
998 for (
i = queue_size - 1;
i >= 0;)
1006 for (
j = last;
j >= 0;
j--)
1029 for (
c = 0;
c <= last; ++
c)
1051#ifdef DEBUG_DEADLOCK
1058 printf(
"%s lock %p queue ", info, lock);
1107 _(
"Process %d waits for %s on %s; blocked by process %d."),
1126 _(
"Process %d: %s"),
1135 errmsg(
"deadlock detected"),
1138 errhint(
"See server log for query details.")));
const char * pgstat_get_backend_current_activity(int pid, bool checkUser)
#define Assert(condition)
#define MemSet(start, val, len)
#define StaticAssertStmt(condition, errmessage)
static bool TopoSort(LOCK *lock, EDGE *constraints, int nConstraints, PGPROC **ordering)
static int TestConfiguration(PGPROC *startProc)
static WAIT_ORDER * waitOrders
static bool FindLockCycleRecurseMember(PGPROC *checkProc, PGPROC *checkProcLeader, int depth, EDGE *softEdges, int *nSoftEdges)
static bool FindLockCycle(PGPROC *checkProc, EDGE *softEdges, int *nSoftEdges)
static int maxPossibleConstraints
static bool DeadLockCheckRecurse(PGPROC *proc)
PGPROC * GetBlockingAutoVacuumPgproc(void)
static EDGE * possibleConstraints
static PGPROC ** waitOrderProcs
void RememberSimpleDeadLock(PGPROC *proc1, LOCKMODE lockmode, LOCK *lock, PGPROC *proc2)
static PGPROC ** visitedProcs
static bool ExpandConstraints(EDGE *constraints, int nConstraints)
static int * beforeConstraints
static int nDeadlockDetails
void DeadLockReport(void)
static int * afterConstraints
static DEADLOCK_INFO * deadlockDetails
static int maxCurConstraints
void InitDeadLockChecking(void)
static int nCurConstraints
DeadLockState DeadLockCheck(PGPROC *proc)
static PGPROC * blocking_autovacuum_proc
static EDGE * curConstraints
static int nPossibleConstraints
static bool FindLockCycleRecurse(PGPROC *checkProc, int depth, EDGE *softEdges, int *nSoftEdges)
static PGPROC ** topoProcs
int errdetail_internal(const char *fmt,...)
int errhint(const char *fmt,...)
int errcode(int sqlerrcode)
int errmsg(const char *fmt,...)
int errdetail_log(const char *fmt,...)
#define ereport(elevel,...)
#define dlist_foreach(iter, lhead)
static void dclist_push_tail(dclist_head *head, dlist_node *node)
static uint32 dclist_count(const dclist_head *head)
static void dclist_init(dclist_head *head)
#define dlist_container(type, membername, ptr)
#define dclist_foreach(iter, lhead)
void DescribeLockTag(StringInfo buf, const LOCKTAG *tag)
const char * GetLockmodeName(LOCKMETHODID lockmethodid, LOCKMODE mode)
LockMethod GetLocksMethodTable(const LOCK *lock)
#define LOCK_LOCKTAG(lock)
@ LOCKTAG_RELATION_EXTEND
@ DS_BLOCKED_BY_AUTOVACUUM
#define LOCKBIT_ON(lockmode)
MemoryContext TopMemoryContext
static MemoryContext MemoryContextSwitchTo(MemoryContext context)
#define ERRCODE_T_R_DEADLOCK_DETECTED
void pgstat_report_deadlock(void)
#define PROC_IS_AUTOVACUUM
#define MAX_BACKENDS_BITS
void ProcLockWakeup(LockMethod lockMethodTable, LOCK *lock)
void resetStringInfo(StringInfo str)
void appendStringInfo(StringInfo str, const char *fmt,...)
void appendBinaryStringInfo(StringInfo str, const void *data, int datalen)
void appendStringInfoChar(StringInfo str, char ch)
void initStringInfo(StringInfo str)
uint8 locktag_lockmethodid
static struct link * links