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