Skip to content

Commit fe853ca

Browse files
committed
Add DtmdHost and DtmdPort variables
1 parent d6d7bba commit fe853ca

File tree

4 files changed

+43
-3
lines changed

4 files changed

+43
-3
lines changed

contrib/pg_dtm/libdtm.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ typedef struct DTMConnData
2424

2525
typedef unsigned long long xid_t;
2626

27+
int DtmdPort;
28+
char* DtmdHost;
29+
30+
2731
// Returns true if the write was successful.
2832
static bool dtm_write_char(DTMConn dtm, char c)
2933
{
@@ -237,7 +241,7 @@ static DTMConn GetConnection()
237241
if (dtm == NULL)
238242
{
239243
// FIXME: add API for setting the host and port for dtm connection
240-
dtm = DtmConnect("127.0.0.1", 5431);
244+
dtm = DtmConnect(DtmdHost, DtmdPort);
241245
if (dtm == NULL) {
242246
elog(ERROR, "Failed to connect to DTMD");
243247
}

contrib/pg_dtm/libdtm.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88

99
#define INVALID_XID 0
1010

11+
extern int DtmdPort;
12+
extern char* DtmdHost;
13+
1114
void DtmInitSnapshot(Snapshot snapshot);
1215

1316
// Starts a new global transaction. Returns the

contrib/pg_dtm/pg_dtm.c

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -713,6 +713,33 @@ _PG_init(void)
713713
NULL
714714
);
715715

716+
DefineCustomIntVariable(
717+
"dtm.dtmd_port",
718+
"DTMD port",
719+
NULL,
720+
&DtmdPort,
721+
5431,
722+
1,
723+
INT_MAX,
724+
PGC_BACKEND,
725+
0,
726+
NULL,
727+
NULL,
728+
NULL
729+
);
730+
731+
DefineCustomStringVariable(
732+
"dtm.dtmd_host",
733+
"DTMD host name",
734+
NULL,
735+
&DtmdHost,
736+
"localhost",
737+
PGC_BACKEND,
738+
0,
739+
NULL,
740+
NULL,
741+
NULL);
742+
716743
/*
717744
* Install hooks.
718745
*/

src/backend/utils/time/tqual.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1464,6 +1464,12 @@ HeapTupleIsSurelyDead(HeapTuple htup, TransactionId OldestXmin)
14641464
return TransactionIdPrecedes(HeapTupleHeaderGetRawXmax(tuple), OldestXmin);
14651465
}
14661466

1467+
bool
1468+
XidInMVCCSnapshot(TransactionId xid, Snapshot snapshot)
1469+
{
1470+
return TM->IsInSnapshot(xid, snapshot);
1471+
}
1472+
14671473
/*
14681474
* XidInMVCCSnapshot
14691475
* Is the given XID still-in-progress according to the snapshot?
@@ -1474,8 +1480,8 @@ HeapTupleIsSurelyDead(HeapTuple htup, TransactionId OldestXmin)
14741480
* TransactionIdIsCurrentTransactionId first, except for known-committed
14751481
* XIDs which could not be ours anyway.
14761482
*/
1477-
static bool
1478-
XidInMVCCSnapshot(TransactionId xid, Snapshot snapshot)
1483+
bool
1484+
PgXidInMVCCSnapshot(TransactionId xid, Snapshot snapshot)
14791485
{
14801486
uint32 i;
14811487

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy