@@ -97,6 +97,7 @@ typedef enum
97
97
#define MTM_MAP_SIZE 1003
98
98
#define MIN_WAIT_TIMEOUT 1000
99
99
#define MAX_WAIT_TIMEOUT 100000
100
+ #define MAX_WAIT_LOOPS 100
100
101
#define STATUS_POLL_DELAY USECS_PER_SEC
101
102
102
103
void _PG_init (void );
@@ -424,8 +425,9 @@ bool MtmXidInMVCCSnapshot(TransactionId xid, Snapshot snapshot)
424
425
static timestamp_t maxSleepTime ;
425
426
#endif
426
427
timestamp_t delay = MIN_WAIT_TIMEOUT ;
428
+ int i ;
427
429
Assert (xid != InvalidTransactionId );
428
-
430
+
429
431
if (!MtmUseDtm ) {
430
432
return PgXidInMVCCSnapshot (xid , snapshot );
431
433
}
@@ -436,7 +438,8 @@ bool MtmXidInMVCCSnapshot(TransactionId xid, Snapshot snapshot)
436
438
firstReportTime = MtmGetCurrentTime ();
437
439
}
438
440
#endif
439
- while (true)
441
+
442
+ for (i = 0 ; i < MAX_WAIT_LOOPS ; i ++ )
440
443
{
441
444
MtmTransState * ts = (MtmTransState * )hash_search (MtmXid2State , & xid , HASH_FIND , NULL );
442
445
if (ts != NULL && ts -> status != TRANSACTION_STATUS_IN_PROGRESS )
@@ -489,11 +492,13 @@ bool MtmXidInMVCCSnapshot(TransactionId xid, Snapshot snapshot)
489
492
else
490
493
{
491
494
MTM_LOG4 ("%d: visibility check is skept for transaction %u in snapshot %lu" , MyProcPid , xid , MtmTx .snapshot );
492
- break ;
495
+ MtmUnlock ();
496
+ return PgXidInMVCCSnapshot (xid , snapshot );
493
497
}
494
498
}
495
499
MtmUnlock ();
496
- return PgXidInMVCCSnapshot (xid , snapshot );
500
+ elog (ERROR , "Failed to get status of XID %d" , xid );
501
+ return true;
497
502
}
498
503
499
504
@@ -1205,7 +1210,7 @@ static void MtmEnableNode(int nodeId)
1205
1210
1206
1211
void MtmRecoveryCompleted (void )
1207
1212
{
1208
- MTM_LOG1 ("Recovery of node %d is completed, disabled mask=%lx, reconnect mask=%ld , live nodes=%d" ,
1213
+ MTM_LOG1 ("Recovery of node %d is completed, disabled mask=%lx, reconnect mask=%lx , live nodes=%d" ,
1209
1214
MtmNodeId , Mtm -> disabledNodeMask , Mtm -> reconnectMask , Mtm -> nLiveNodes );
1210
1215
MtmLock (LW_EXCLUSIVE );
1211
1216
Mtm -> recoverySlot = 0 ;
0 commit comments