Skip deadlock detection on the workers

Do not run distributed deadlock detection
on the worker nodes to prevent errornous
decisions to kill the deadlocks.
pull/1595/head
Onder Kalaci 2017-08-17 19:33:39 +03:00
parent 0ddcd726c9
commit 550a5578d8
1 changed files with 20 additions and 3 deletions

View File

@ -101,12 +101,29 @@ check_distributed_deadlocks(PG_FUNCTION_ARGS)
bool
CheckForDistributedDeadlocks(void)
{
WaitGraph *waitGraph = BuildGlobalWaitGraph();
HTAB *adjacencyLists = BuildAdjacencyListsForWaitGraph(waitGraph);
WaitGraph *waitGraph = NULL;
HTAB *adjacencyLists = NULL;
HASH_SEQ_STATUS status;
TransactionNode *transactionNode = NULL;
int edgeCount = waitGraph->edgeCount;
int edgeCount = 0;
int localGroupId = GetLocalGroupId();
List *workerNodeList = ActiveReadableNodeList();
/*
* We don't need to do any distributed deadlock checking if there
* are no worker nodes. This might even be problematic for a non-mx
* worker node which has the same group id with its master (i.e., 0),
* which may erroneously decide to kill the deadlocks happening on it.
*/
if (list_length(workerNodeList) == 0)
{
return false;
}
waitGraph = BuildGlobalWaitGraph();
adjacencyLists = BuildAdjacencyListsForWaitGraph(waitGraph);
edgeCount = waitGraph->edgeCount;
/*
* We iterate on transaction nodes and search for deadlocks where the