mirror of https://github.com/citusdata/citus.git
Merge pull request #1809 from citusdata/get_rid_of_false_positives
Get rid of some of the false positive distributed deadlockspull/1810/head
commit
666e37273a
|
@ -494,7 +494,11 @@ BuildLocalWaitGraph(void)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* IsProcessWaitingForSafeOperations returns true if the given PROC
|
* IsProcessWaitingForSafeOperations returns true if the given PROC
|
||||||
* waiting on relation extension lock or page locks.
|
* waiting on relation extension locks, page locks or speculative locks.
|
||||||
|
*
|
||||||
|
* The function also returns true if the waiting process is an autovacuum
|
||||||
|
* process given that autovacuum cannot contribute to any distributed
|
||||||
|
* deadlocks.
|
||||||
*
|
*
|
||||||
* In general for the purpose of distributed deadlock detection, we should
|
* In general for the purpose of distributed deadlock detection, we should
|
||||||
* skip if the process blocked on the locks that may not be part of deadlocks.
|
* skip if the process blocked on the locks that may not be part of deadlocks.
|
||||||
|
@ -509,17 +513,26 @@ IsProcessWaitingForSafeOperations(PGPROC *proc)
|
||||||
{
|
{
|
||||||
PROCLOCK *waitProcLock = NULL;
|
PROCLOCK *waitProcLock = NULL;
|
||||||
LOCK *waitLock = NULL;
|
LOCK *waitLock = NULL;
|
||||||
|
PGXACT *pgxact = NULL;
|
||||||
|
|
||||||
if (proc->waitStatus != STATUS_WAITING)
|
if (proc->waitStatus != STATUS_WAITING)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* get the transaction that the backend associated with */
|
||||||
|
pgxact = &ProcGlobal->allPgXact[proc->pgprocno];
|
||||||
|
if (pgxact->vacuumFlags & PROC_IS_AUTOVACUUM)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
waitProcLock = proc->waitProcLock;
|
waitProcLock = proc->waitProcLock;
|
||||||
waitLock = waitProcLock->tag.myLock;
|
waitLock = waitProcLock->tag.myLock;
|
||||||
|
|
||||||
return waitLock->tag.locktag_type == LOCKTAG_RELATION_EXTEND ||
|
return waitLock->tag.locktag_type == LOCKTAG_RELATION_EXTEND ||
|
||||||
waitLock->tag.locktag_type == LOCKTAG_PAGE;
|
waitLock->tag.locktag_type == LOCKTAG_PAGE ||
|
||||||
|
waitLock->tag.locktag_type == LOCKTAG_SPECULATIVE_TOKEN;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -596,8 +609,7 @@ AddEdgesForLockWaits(WaitGraph *waitGraph, PGPROC *waitingProc, PROCStack *remai
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Skip processes from the same lock group, processes that don't conflict,
|
* Skip processes from the same lock group, processes that don't conflict,
|
||||||
* and processes that are waiting on a relation extension lock or page locks,
|
* and processes that are waiting on safe operations.
|
||||||
* which will be released shortly.
|
|
||||||
*/
|
*/
|
||||||
if (!IsSameLockGroup(waitingProc, currentProc) &&
|
if (!IsSameLockGroup(waitingProc, currentProc) &&
|
||||||
IsConflictingLockMask(procLock->holdMask, conflictMask) &&
|
IsConflictingLockMask(procLock->holdMask, conflictMask) &&
|
||||||
|
@ -641,8 +653,7 @@ AddEdgesForWaitQueue(WaitGraph *waitGraph, PGPROC *waitingProc, PROCStack *remai
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Skip processes from the same lock group, processes that don't conflict,
|
* Skip processes from the same lock group, processes that don't conflict,
|
||||||
* and processes that are waiting on a relation extension lock or page locks,
|
* and processes that are waiting on safe operations.
|
||||||
* which will be released shortly.
|
|
||||||
*/
|
*/
|
||||||
if (!IsSameLockGroup(waitingProc, currentProc) &&
|
if (!IsSameLockGroup(waitingProc, currentProc) &&
|
||||||
IsConflictingLockMask(awaitMask, conflictMask) &&
|
IsConflictingLockMask(awaitMask, conflictMask) &&
|
||||||
|
|
Loading…
Reference in New Issue