Skip to content

Commit 9d0cc59

Browse files
committed
Add XTM implementation
1 parent 145a999 commit 9d0cc59

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

contrib/pg_xtm/pg_dtm.c

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,25 @@ dtm_global_transaction(PG_FUNCTION_ARGS)
120120
Datum
121121
dtm_get_snapshot(PG_FUNCTION_ARGS)
122122
{
123+
TransationIn xmin;
123124
DtmEnsureConnection();
124-
DtmGlobalGetSnapshot(DtmConn, GetCurrentTransactionId());
125+
DtmGlobalGetSnapshot(DtmConn, GetCurrentTransactionId(), &DtmSnapshot);
126+
/* Move it to DtmGlobalGetSnapshot? */
127+
xmin = DtmSnapshot.xmin;
128+
if (xmin != InvalidTransactionId) {
129+
xmin -= vacuum_defer_cleanup_age;
130+
if (!TransactionIdIsNormal(xmin)) {
131+
xmin = FirstNormalTransactionId;
132+
}
133+
if (RecentGlobalDataXmin > xmin) {
134+
RecentGlobalDataXmin = xmin;
135+
}
136+
if (RecentGlobalXmin > xmin) {
137+
RecentGlobalXmin = xmin;
138+
}
139+
RecentXmin = xmin;
140+
}
141+
snapshot->curcid = GetCurrentCommandId(false);
125142
DtmHasSnapshot = true;
126143
PG_RETURN_VOID();
127144
}

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