mirror of https://github.com/citusdata/citus.git
small refactor, CheckDeadlockForTransactionNode builds it's own array
parent
457f570b77
commit
097fd15a89
|
@ -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,
|
||||||
|
|
Loading…
Reference in New Issue