Skip to content

Commit acab04b

Browse files
committed
Update DTM API
1 parent 256f931 commit acab04b

File tree

6 files changed

+40
-1162
lines changed

6 files changed

+40
-1162
lines changed

contrib/pg_xtm/libdtm.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ void DtmDisconnect(DTMConn dtm) {
121121

122122
// Asks DTM for a fresh snapshot. Returns a snapshot on success, or NULL
123123
// otherwise. Please free the snapshot memory yourself after use.
124-
Snapshot DtmGlobalGetSnapshot(DTMConn dtm, TransactionId xid, Snapshot s) {
124+
Snapshot DtmGlobalGetSnapshot(DTMConn dtm, NodeId nodeid, TransactionId xid, Snapshot s) {
125125
bool ok;
126126
int i;
127127
xid_t number;
@@ -173,6 +173,7 @@ Snapshot DtmGlobalGetSnapshot(DTMConn dtm, TransactionId xid, Snapshot s) {
173173
return NULL;
174174
}
175175

176+
#if 0
176177
// Starts a transaction. Returns the 'gxid' on success, or INVALID_GXID otherwise.
177178
xid_t DtmGlobalBegin(DTMConn dtm) {
178179
bool ok;
@@ -195,7 +196,12 @@ xid_t DtmGlobalBegin(DTMConn dtm) {
195196

196197
return gxid;
197198
}
199+
#endif
198200

201+
void DtmGlobalSetTransStatus(DTMConn dtm, NodeId nodeid, TransactionId xid, XidStatus status)
202+
{
203+
}
204+
#if 0
199205
// Marks a given transaction as 'committed'. Returns 'true' on success,
200206
// 'false' otherwise.
201207
bool DtmGlobalCommit(DTMConn dtm, xid_t gxid) {
@@ -232,10 +238,11 @@ void DtmGlobalRollback(DTMConn dtm, xid_t gxid) {
232238
return;
233239
}
234240
}
241+
#endif
235242

236243
// Gets the status of the transaction identified by 'gxid'. Returns the status
237244
// on success, or -1 otherwise.
238-
XidStatus DtmGlobalGetTransStatus(DTMConn dtm, TransactionId gxid) {
245+
XidStatus DtmGlobalGetTransStatus(DTMConn dtm, NodeId nodeid, TransactionId gxid) {
239246
bool result;
240247
char statuschar;
241248

contrib/pg_xtm/libdtm.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#define COMMIT_YES 1
1111
#define COMMIT_NO 2
1212

13+
typedef int NodeId;
1314
typedef unsigned long long xid_t;
1415

1516
typedef struct DTMConnData *DTMConn;
@@ -24,16 +25,17 @@ void DtmDisconnect(DTMConn dtm);
2425

2526
typedef struct {
2627
TransactionId* xids;
27-
int nXids;
28+
NodeId* nodes;
29+
int nNodes;
2830
} GlobalTransactionId;
2931

3032
/* create entry for new global transaction */
3133
void DtmGlobalStartTransaction(DTMConn dtm, GlobalTransactionId* gitd);
3234

33-
Snapshot DtmGlobalGetSnapshot(DTMConn dtm, TransactionId xid, Snapshot snapshot);
35+
Snapshot DtmGlobalGetSnapshot(DTMConn dtm, NodeId nodeid, TransactionId xid, Snapshot snapshot);
3436

35-
void DtmGlobalSetTransStatus(DTMConn dtm, TransactionId xid, XidStatus status); /* commit transaction only once all participants are committed, before it do not change CLOG */
37+
void DtmGlobalSetTransStatus(DTMConn dtm, NodeId nodeid, TransactionId xid, XidStatus status); /* commit transaction only once all participants are committed, before it do not change CLOG */
3638

37-
XidStatus DtmGlobalGetTransStatus(DTMConn dtm, TransactionId xid);
39+
XidStatus DtmGlobalGetTransStatus(DTMConn dtm, NodeId nodeid, TransactionId xid);
3840

3941
#endif

contrib/pg_xtm/pg_dtm--1.0.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
-- complain if script is sourced in psql, rather than via CREATE EXTENSION
22
\echo Use "CREATE EXTENSION pg_dtm" to load this file. \quit
33

4-
CREATE FUNCTION dtm_global_transaction(xids integer[]) RETURNS void
4+
CREATE FUNCTION dtm_global_transaction(nodes integer[], xids integer[]) RETURNS void
55
AS 'MODULE_PATHNAME','dtm_global_transaction'
66
LANGUAGE C;
77

0 commit comments

Comments
 (0)