mirror of https://github.com/citusdata/citus.git
Deadlock detection changes, PG Commit: d137cb52cb7fd44a3f24f3c750fbf7924a4e9532
parent
9085beb819
commit
a0cf8361a4
|
@ -737,13 +737,14 @@ AddEdgesForLockWaits(WaitGraph *waitGraph, PGPROC *waitingProc, PROCStack *remai
|
||||||
int conflictMask = lockMethodTable->conflictTab[waitingProc->waitLockMode];
|
int conflictMask = lockMethodTable->conflictTab[waitingProc->waitLockMode];
|
||||||
|
|
||||||
/* iterate through the queue of processes holding the lock */
|
/* iterate through the queue of processes holding the lock */
|
||||||
SHM_QUEUE *procLocks = &waitLock->procLocks;
|
dlist_head *procLocks = &waitLock->procLocks;
|
||||||
PROCLOCK *procLock = (PROCLOCK *) SHMQueueNext(procLocks, procLocks,
|
|
||||||
offsetof(PROCLOCK, lockLink));
|
|
||||||
|
|
||||||
while (procLock != NULL)
|
dlist_iter iter;
|
||||||
|
|
||||||
|
dlist_foreach(iter, procLocks)
|
||||||
{
|
{
|
||||||
PGPROC *currentProc = procLock->tag.myProc;
|
PROCLOCK *procLock = dlist_container(PROCLOCK, lockLink, iter.cur);
|
||||||
|
PGPROC *currentProc = procLock->tag.myProc;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Skip processes from the same lock group, processes that don't conflict,
|
* Skip processes from the same lock group, processes that don't conflict,
|
||||||
|
@ -754,10 +755,7 @@ AddEdgesForLockWaits(WaitGraph *waitGraph, PGPROC *waitingProc, PROCStack *remai
|
||||||
!IsProcessWaitingForSafeOperations(currentProc))
|
!IsProcessWaitingForSafeOperations(currentProc))
|
||||||
{
|
{
|
||||||
AddWaitEdge(waitGraph, waitingProc, currentProc, remaining);
|
AddWaitEdge(waitGraph, waitingProc, currentProc, remaining);
|
||||||
}
|
}
|
||||||
|
|
||||||
procLock = (PROCLOCK *) SHMQueueNext(procLocks, &procLock->lockLink,
|
|
||||||
offsetof(PROCLOCK, lockLink));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -777,16 +775,25 @@ AddEdgesForWaitQueue(WaitGraph *waitGraph, PGPROC *waitingProc, PROCStack *remai
|
||||||
int conflictMask = lockMethodTable->conflictTab[waitingProc->waitLockMode];
|
int conflictMask = lockMethodTable->conflictTab[waitingProc->waitLockMode];
|
||||||
|
|
||||||
/* iterate through the wait queue */
|
/* iterate through the wait queue */
|
||||||
PROC_QUEUE *waitQueue = &(waitLock->waitProcs);
|
dclist_head *waitQueue = &waitLock->waitProcs;
|
||||||
int queueSize = waitQueue->size;
|
int queueSize = waitQueue->count;
|
||||||
PGPROC *currentProc = (PGPROC *) waitQueue->links.next;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Iterate through the queue from the start until we encounter waitingProc,
|
dlist_iter iter;
|
||||||
* since we only care about processes in front of waitingProc in the queue.
|
|
||||||
*/
|
dclist_foreach(iter, waitQueue)
|
||||||
while (queueSize-- > 0 && currentProc != waitingProc)
|
|
||||||
{
|
{
|
||||||
|
PGPROC *currentProc = dlist_container(PGPROC, links, iter.cur);
|
||||||
|
|
||||||
|
if (currentProc == waitingProc)
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* Iterate through the queue from the start until we encounter waitingProc,
|
||||||
|
* since we only care about processes in front of waitingProc in the queue.
|
||||||
|
*/
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
int awaitMask = LOCKBIT_ON(currentProc->waitLockMode);
|
int awaitMask = LOCKBIT_ON(currentProc->waitLockMode);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in New Issue