@@ -167,6 +167,8 @@ static void* MtmCreateSavepointContext(void);
167
167
static void MtmRestoreSavepointContext (void * ctx );
168
168
static void MtmReleaseSavepointContext (void * ctx );
169
169
static void MtmSetRemoteFunction (char const * list , void * extra );
170
+ static void * MtmSuspendTransaction (void );
171
+ static void MtmResumeTransaction (void * ctx );
170
172
171
173
// static void MtmCheckClusterLock(void);
172
174
static void MtmCheckSlots (void );
@@ -219,7 +221,9 @@ static TransactionManager MtmTM =
219
221
MtmInitializeSequence ,
220
222
MtmCreateSavepointContext ,
221
223
MtmRestoreSavepointContext ,
222
- MtmReleaseSavepointContext
224
+ MtmReleaseSavepointContext ,
225
+ MtmSuspendTransaction ,
226
+ MtmResumeTransaction
223
227
};
224
228
225
229
char const * const MtmNodeStatusMnem [] =
@@ -558,6 +562,22 @@ static void MtmReleaseSavepointContext(void* ctx)
558
562
{
559
563
}
560
564
565
+ static void * MtmSuspendTransaction (void )
566
+ {
567
+ MtmCurrentTrans * ctx = malloc (sizeof (MtmCurrentTrans ));
568
+ * ctx = MtmTx ;
569
+ MtmResetTransaction ();
570
+ MtmBeginTransaction (& MtmTx );
571
+ return ctx ;
572
+ }
573
+
574
+ static void MtmResumeTransaction (void * ctx )
575
+ {
576
+ MtmTx = * (MtmCurrentTrans * )ctx ;
577
+ MtmInsideTransaction = true;
578
+ free (ctx );
579
+ }
580
+
561
581
562
582
/*
563
583
* -------------------------------------------
@@ -966,6 +986,7 @@ MtmBeginTransaction(MtmCurrentTrans* x)
966
986
x -> isSuspended = false;
967
987
x -> isTwoPhase = false;
968
988
x -> isTransactionBlock = IsTransactionBlock ();
989
+
969
990
/* Application name can be changed using PGAPPNAME environment variable */
970
991
if (x -> isDistributed && Mtm -> status != MTM_ONLINE && strcmp (application_name , MULTIMASTER_ADMIN ) != 0
971
992
&& strcmp (application_name , MULTIMASTER_BROADCAST_SERVICE ) != 0
@@ -4717,6 +4738,7 @@ static bool MtmTwoPhaseCommit(MtmCurrentTrans* x)
4717
4738
4718
4739
if (!x -> isReplicated && x -> isDistributed && x -> containsDML ) {
4719
4740
MtmGenerateGid (x -> gid );
4741
+
4720
4742
if (!x -> isTransactionBlock ) {
4721
4743
BeginTransactionBlock (false);
4722
4744
x -> isTransactionBlock = true;
0 commit comments