summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPavan Deolasee2016-07-07 11:26:20 +0000
committerPavan Deolasee2016-10-18 10:05:31 +0000
commit7f2e5c5eca5399a69dd6127fa59d83dac5123fe6 (patch)
tree0b1d6c2b53dbfa249b3333c5e7325b5c63fcd51e /src
parent332d10cecad98985eb3cca02772f8aeaad8a2177 (diff)
Never ever use an invalid XID, if we fail to connect to the GTM
The code before this commit would happily proceed further if GTM becomes dead or unreachable. This may result in random problems since rest of the code is not prepared to deal with that situation (as seen from the crash in TAP tests). It seems far safer to just throw an error in such case. TAP test and report by Pallavi Sontakke
Diffstat (limited to 'src')
-rw-r--r--src/backend/access/transam/varsup.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/backend/access/transam/varsup.c b/src/backend/access/transam/varsup.c
index a0ec908bce..a1d161d8c9 100644
--- a/src/backend/access/transam/varsup.c
+++ b/src/backend/access/transam/varsup.c
@@ -411,6 +411,15 @@ GetNewTransactionId(bool isSubXact)
xid = ShmemVariableCache->nextXid;
#endif
}
+
+#ifdef XCP
+ if (!TransactionIdIsValid(xid))
+ ereport(ERROR,
+ (errcode(ERRCODE_INTERNAL_ERROR),
+ errmsg("Could not obtain a transaction ID from GTM. The GTM"
+ " might have failed or lost connectivity")));
+#endif
+
/*
* If we are allocating the first XID of a new page of the commit log,
* zero out that commit-log page before returning. We must do this while