summaryrefslogtreecommitdiff
path: root/src/backend/pgxc
diff options
context:
space:
mode:
authorPavan Deolasee2016-09-30 10:17:36 +0000
committerPavan Deolasee2016-10-18 10:07:48 +0000
commit0d4e41c26386e31ab58c97a024bafa1384e67b17 (patch)
tree5e5bcf858af8e4f3f36b624b12ac876183d6318c /src/backend/pgxc
parentec9b369eabb8575ade8abf7588ba5a7538b530a2 (diff)
Allow COMMIT/ROLLBACK PREPARED xact to succeed on the local coordinator even if
the GTM no longer has state information for the transaction when xc_maintenance_mode is active. Information on the GTM is important for explicit prepared transactions because GTM tracks the participants nodes in that case and the COMMIT/ROLLBACK PREPARED commands can then to forwarded to those participants. So when xc_maintenance_mode is active, we only cleanup prepared transaction on the local node (or remote when used with EXECUTE DIRECT). So it seems ok not to guarantee the GTM to have the state information.
Diffstat (limited to 'src/backend/pgxc')
-rw-r--r--src/backend/pgxc/pool/execRemote.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/backend/pgxc/pool/execRemote.c b/src/backend/pgxc/pool/execRemote.c
index bce09736eb..31568660f0 100644
--- a/src/backend/pgxc/pool/execRemote.c
+++ b/src/backend/pgxc/pool/execRemote.c
@@ -4242,8 +4242,16 @@ FinishRemotePreparedTransaction(char *prepareGID, bool commit)
* single call, it doesn't look nicer and create confusion. We should
* probably split them into two parts. This is used only for explicit 2PC
* which should not be very common in XC
+ *
+ * In xc_maintenance_mode mode, we don't fail if the GTM does not have
+ * knowledge about the prepared transaction. That may happen for various
+ * reasons such that an earlier attempt cleaned up it from GTM or GTM was
+ * restarted in between. The xc_maintenance_mode is a kludge to come out of
+ * such situations. So it seems alright to not be too strict about the
+ * state
*/
- if (GetGIDDataGTM(prepareGID, &gxid, &prepare_gxid, &nodestring) < 0)
+ if ((GetGIDDataGTM(prepareGID, &gxid, &prepare_gxid, &nodestring) < 0) &&
+ !xc_maintenance_mode)
ereport(ERROR,
(errcode(ERRCODE_INTERNAL_ERROR),
errmsg("prepared transaction with identifier \"%s\" does not exist",