Skip to content

Commit d63b397

Browse files
committed
Integrate deadlock detection in DTMD
1 parent b26ac71 commit d63b397

File tree

1 file changed

+39
-0
lines changed
  • contrib/pg_dtm/dtmd/include

1 file changed

+39
-0
lines changed

contrib/pg_dtm/dtmd/include/ddd.h

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#ifndef DDD_H
2+
3+
#include <stdbool.h>
4+
#include "transaction.h"
5+
6+
typedef struct Instance {
7+
struct Edge* edges; /* local subgraph */
8+
} Instance;
9+
10+
typedef struct Edge {
11+
L2List node; /* node of list of outgoing eedges */
12+
struct Edge* next; /* list of edges of local subgraph */
13+
struct Vertex* dst;
14+
struct Vertex* src;
15+
} Edge;
16+
17+
typedef struct Vertex
18+
{
19+
L2List outgoingEdges;
20+
struct Vertex* next;
21+
xid_t xid;
22+
int nIncomingEdges;
23+
int visited;
24+
} Vertex;
25+
26+
typedef struct Graph
27+
{
28+
Vertex* hashtable[MAX_TRANSACTIONS];
29+
Edge* freeEdges;
30+
Vertex* freeVertexes;
31+
int marker;
32+
} Graph;
33+
34+
35+
extern void initGraph(Graph* graph);
36+
extern void addSubgraph(Instance* instance, Graph* graph, xid_t* xids, int n_xids);
37+
extern bool findLoop(Graph* graph, xid_t root);
38+
39+
#endif

0 commit comments

Comments
 (0)