@@ -1351,7 +1351,7 @@ MtmBuildConnectivityMatrix(nodemask_t* matrix, bool nowait)
1351
1351
*/
1352
1352
bool MtmRefreshClusterStatus (bool nowait )
1353
1353
{
1354
- nodemask_t mask , clique , disabled ;
1354
+ nodemask_t mask , clique , disabled , enabled ;
1355
1355
nodemask_t matrix [MAX_NODES ];
1356
1356
MtmTransState * ts ;
1357
1357
int clique_size ;
@@ -1385,29 +1385,34 @@ bool MtmRefreshClusterStatus(bool nowait)
1385
1385
MtmDisableNode (i + 1 );
1386
1386
}
1387
1387
}
1388
- mask = clique & Mtm -> disabledNodeMask ; /* new enabled nodes mask */
1388
+
1389
+ enabled = clique & Mtm -> disabledNodeMask ; /* new enabled nodes mask */
1390
+
1391
+ mask = enabled ;
1389
1392
for (i = 0 ; mask != 0 ; i ++ , mask >>= 1 ) {
1390
1393
if (mask & 1 ) {
1391
1394
MtmEnableNode (i + 1 );
1392
1395
}
1393
1396
}
1394
- MtmCheckQuorum ();
1395
- /* Interrupt voting for active transaction and abort them */
1396
- for (ts = Mtm -> transListHead ; ts != NULL ; ts = ts -> next ) {
1397
- MTM_LOG3 ("Active transaction gid='%s', coordinator=%d, xid=%d, status=%d, gtid.xid=%d" ,
1398
- ts -> gid , ts -> gtid .node , ts -> xid , ts -> status , ts -> gtid .xid );
1399
- if (MtmIsCoordinator (ts )) {
1400
- if (!ts -> votingCompleted && ts -> status != TRANSACTION_STATUS_ABORTED ) {
1401
- MtmAbortTransaction (ts );
1402
- MtmWakeUpBackend (ts );
1403
- }
1404
- } else if (TransactionIdIsValid (ts -> gtid .xid ) && BIT_CHECK (disabled , ts -> gtid .node - 1 )) { // coordinator of transaction is on disabled node
1405
- if (ts -> gid [0 ]) {
1406
- if (ts -> status == TRANSACTION_STATUS_UNKNOWN || ts -> status == TRANSACTION_STATUS_IN_PROGRESS ) {
1407
- MTM_LOG1 ("%d: Abort trasaction %s because its coordinator is at disabled node %d" , MyProcPid , ts -> gid , ts -> gtid .node );
1397
+ if (disabled |enabled ) {
1398
+ MtmCheckQuorum ();
1399
+ /* Interrupt voting for active transaction and abort them */
1400
+ for (ts = Mtm -> transListHead ; ts != NULL ; ts = ts -> next ) {
1401
+ MTM_LOG3 ("Active transaction gid='%s', coordinator=%d, xid=%d, status=%d, gtid.xid=%d" ,
1402
+ ts -> gid , ts -> gtid .node , ts -> xid , ts -> status , ts -> gtid .xid );
1403
+ if (MtmIsCoordinator (ts )) {
1404
+ if (!ts -> votingCompleted && ts -> status != TRANSACTION_STATUS_ABORTED ) {
1408
1405
MtmAbortTransaction (ts );
1409
- MtmTx .status = TRANSACTION_STATUS_ABORTED ; /* prevent recursive invocation of MtmAbortPreparedTransaction */
1410
- FinishPreparedTransaction (ts -> gid , false);
1406
+ MtmWakeUpBackend (ts );
1407
+ }
1408
+ } else if (TransactionIdIsValid (ts -> gtid .xid ) && BIT_CHECK (disabled , ts -> gtid .node - 1 )) { // coordinator of transaction is on disabled node
1409
+ if (ts -> gid [0 ]) {
1410
+ if (ts -> status == TRANSACTION_STATUS_UNKNOWN || ts -> status == TRANSACTION_STATUS_IN_PROGRESS ) {
1411
+ MTM_LOG1 ("%d: Abort trasaction %s because its coordinator is at disabled node %d" , MyProcPid , ts -> gid , ts -> gtid .node );
1412
+ MtmAbortTransaction (ts );
1413
+ MtmTx .status = TRANSACTION_STATUS_ABORTED ; /* prevent recursive invocation of MtmAbortPreparedTransaction */
1414
+ FinishPreparedTransaction (ts -> gid , false);
1415
+ }
1411
1416
}
1412
1417
}
1413
1418
}
@@ -3288,6 +3293,7 @@ MtmDetectGlobalDeadLock(PGPROC* proc)
3288
3293
ByteBuffer buf ;
3289
3294
PGXACT * pgxact = & ProcGlobal -> allPgXact [proc -> pgprocno ];
3290
3295
bool hasDeadlock = false;
3296
+
3291
3297
if (TransactionIdIsValid (pgxact -> xid )) {
3292
3298
MtmGraph graph ;
3293
3299
GlobalTransactionId gtid ;
0 commit comments