summaryrefslogtreecommitdiff
path: root/src/include/access/twophase.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/include/access/twophase.h')
-rw-r--r--src/include/access/twophase.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/include/access/twophase.h b/src/include/access/twophase.h
index b2b7848fad2..d9837deefe0 100644
--- a/src/include/access/twophase.h
+++ b/src/include/access/twophase.h
@@ -24,6 +24,8 @@
*/
typedef struct GlobalTransactionData *GlobalTransaction;
+extern GlobalTransaction MyLockedGxact;
+
/* GUC variable */
extern int max_prepared_xacts;
@@ -36,6 +38,17 @@ extern void PostPrepare_Twophase(void);
extern PGPROC *TwoPhaseGetDummyProc(TransactionId xid);
extern BackendId TwoPhaseGetDummyBackendId(TransactionId xid);
+/*
+ * IsGXactActive
+ * Return true if there is a Global transaction entry currently
+ * locked by us.
+ */
+static inline bool
+IsGXactActive(void)
+{
+ return MyLockedGxact ? true : false;
+}
+
extern GlobalTransaction MarkAsPreparing(TransactionId xid, const char *gid,
TimestampTz prepared_at,
Oid owner, Oid databaseid);