@@ -265,8 +265,10 @@ static void MtmProcessUtility(Node *parsetree, const char *queryString,
265
265
void MtmLock (LWLockMode mode )
266
266
{
267
267
timestamp_t start , stop ;
268
- if (mode == LW_EXCLUSIVE && MtmLockCount ++ != 0 ) {
269
- return ;
268
+ if (mode == LW_EXCLUSIVE || MtmLockCount != 0 ) {
269
+ if (MtmLockCount ++ != 0 ) {
270
+ return ;
271
+ }
270
272
}
271
273
#ifdef USE_SPINLOCK
272
274
SpinLockAcquire (& Mtm -> spinlock );
@@ -984,7 +986,7 @@ Mtm2PCVoting(MtmCurrentTrans* x, MtmTransState* ts)
984
986
deadline = Max (MSEC_TO_USEC (MtmMin2PCTimeout ), elapsed * MtmMax2PCRatio /100 );
985
987
} else {
986
988
if (ts -> isPrepared ) {
987
- /* reset precommit message */
989
+ /* resend precommit message */
988
990
MtmSend2PCMessage (ts , MSG_PRECOMMIT );
989
991
} else {
990
992
if (elapsed > deadline ) {
@@ -1291,7 +1293,7 @@ void MtmBroadcastPollMessage(MtmTransState* ts)
1291
1293
1292
1294
for (i = 0 ; i < Mtm -> nAllNodes ; i ++ )
1293
1295
{
1294
- if (BIT_CHECK (ts -> participantsMask & ~Mtm -> disabledNodeMask , i ) && ! BIT_CHECK ( ts -> votedMask , i ))
1296
+ if (BIT_CHECK (ts -> participantsMask & ~Mtm -> disabledNodeMask & ~ ts -> votedMask , i ))
1295
1297
{
1296
1298
msg .node = i + 1 ;
1297
1299
MTM_LOG3 ("Send request for transaction %s to node %d" , msg .gid , msg .node );
@@ -1478,13 +1480,16 @@ static void MtmPollStatusOfPreparedTransactions(int disabledNodeId)
1478
1480
Assert (ts -> gid [0 ]);
1479
1481
if (ts -> status == TRANSACTION_STATUS_IN_PROGRESS ) {
1480
1482
elog (LOG , "Abort transaction %s because its coordinator is disabled and it is not prepared at node %d" , ts -> gid , MtmNodeId );
1483
+ //MtmUnlock();
1481
1484
MtmFinishPreparedTransaction (ts , false);
1485
+ //MtmLock(LW_EXCLUSIVE);
1482
1486
} else {
1483
1487
MTM_LOG1 ("Poll state of transaction %d (%s)" , ts -> xid , ts -> gid );
1484
1488
MtmBroadcastPollMessage (ts );
1485
1489
}
1486
1490
} else {
1487
- MTM_LOG2 ("Skip transaction %d (%s) with status %d gtid.node=%d gtid.xid=%d votedMask=%lx" , ts -> xid , ts -> gid , ts -> status , ts -> gtid .node , ts -> gtid .xid , ts -> votedMask );
1491
+ MTM_LOG2 ("Skip transaction %d (%s) with status %d gtid.node=%d gtid.xid=%d votedMask=%lx" ,
1492
+ ts -> xid , ts -> gid , ts -> status , ts -> gtid .node , ts -> gtid .xid , ts -> votedMask );
1488
1493
}
1489
1494
}
1490
1495
}
@@ -1501,9 +1506,7 @@ static void MtmDisableNode(int nodeId)
1501
1506
if (nodeId != MtmNodeId ) {
1502
1507
Mtm -> nLiveNodes -= 1 ;
1503
1508
}
1504
- MtmUnlock ();
1505
1509
MtmPollStatusOfPreparedTransactions (nodeId );
1506
- MtmLock (LW_EXCLUSIVE );
1507
1510
}
1508
1511
1509
1512
static void MtmEnableNode (int nodeId )
0 commit comments