small refactor, CheckDeadlockForTransactionNode builds it's own array

pull/1965/head
Brian Cloutier 2018-01-18 14:14:11 -08:00 committed by Brian Cloutier
parent 457f570b77
commit 097fd15a89
1 changed files with 4 additions and 4 deletions

View File

@ -41,7 +41,7 @@ bool LogDistributedDeadlockDetection = false;
static bool CheckDeadlockForTransactionNode(TransactionNode *startingTransactionNode, static bool CheckDeadlockForTransactionNode(TransactionNode *startingTransactionNode,
TransactionNode **transactionNodeStack, int maxStackDepth,
List **deadlockPath); List **deadlockPath);
static void PrependOutgoingNodesToQueue(TransactionNode *queuedTransactionNode, static void PrependOutgoingNodesToQueue(TransactionNode *queuedTransactionNode,
int currentStackDepth, int currentStackDepth,
@ -134,7 +134,6 @@ CheckForDistributedDeadlocks(void)
{ {
bool deadlockFound = false; bool deadlockFound = false;
List *deadlockPath = NIL; List *deadlockPath = NIL;
TransactionNode *transactionNodeStack[edgeCount + 1];
/* we're only interested in finding deadlocks originating from this node */ /* we're only interested in finding deadlocks originating from this node */
if (transactionNode->transactionId.initiatorNodeIdentifier != localGroupId) if (transactionNode->transactionId.initiatorNodeIdentifier != localGroupId)
@ -145,7 +144,7 @@ CheckForDistributedDeadlocks(void)
ResetVisitedFields(adjacencyLists); ResetVisitedFields(adjacencyLists);
deadlockFound = CheckDeadlockForTransactionNode(transactionNode, deadlockFound = CheckDeadlockForTransactionNode(transactionNode,
transactionNodeStack, edgeCount,
&deadlockPath); &deadlockPath);
if (deadlockFound) if (deadlockFound)
{ {
@ -230,11 +229,12 @@ CheckForDistributedDeadlocks(void)
*/ */
static bool static bool
CheckDeadlockForTransactionNode(TransactionNode *startingTransactionNode, CheckDeadlockForTransactionNode(TransactionNode *startingTransactionNode,
TransactionNode **transactionNodeStack, int maxStackDepth,
List **deadlockPath) List **deadlockPath)
{ {
List *toBeVisitedNodes = NIL; List *toBeVisitedNodes = NIL;
int currentStackDepth = 0; int currentStackDepth = 0;
TransactionNode *transactionNodeStack[maxStackDepth];
/* /*
* We keep transactionNodeStack to keep track of the deadlock paths. At this point, * We keep transactionNodeStack to keep track of the deadlock paths. At this point,