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
|
||||
* 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
|
||||
* 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;
|
||||
LOCK *waitLock = NULL;
|
||||
PGXACT *pgxact = NULL;
|
||||
|
||||
if (proc->waitStatus != STATUS_WAITING)
|
||||
{
|
||||
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;
|
||||
waitLock = waitProcLock->tag.myLock;
|
||||
|
||||
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,
|
||||
* and processes that are waiting on a relation extension lock or page locks,
|
||||
* which will be released shortly.
|
||||
* and processes that are waiting on safe operations.
|
||||
*/
|
||||
if (!IsSameLockGroup(waitingProc, currentProc) &&
|
||||
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,
|
||||
* and processes that are waiting on a relation extension lock or page locks,
|
||||
* which will be released shortly.
|
||||
* and processes that are waiting on safe operations.
|
||||
*/
|
||||
if (!IsSameLockGroup(waitingProc, currentProc) &&
|
||||
IsConflictingLockMask(awaitMask, conflictMask) &&
|
||||
|
|
Loading…
Reference in New Issue