@@ -278,13 +278,13 @@ bool MtmXidInMVCCSnapshot(TransactionId xid, Snapshot snapshot)
278278 {
279279if (ts -> csn > dtmTx .snapshot ) {
280280MTM_TUPLE_TRACE ("%d: tuple with xid=%d(csn=%ld) is invisibile in snapshot %ld\n" ,
281- getpid () ,xid ,ts -> csn ,dtmTx .snapshot );
281+ MyProcPid ,xid ,ts -> csn ,dtmTx .snapshot );
282282MtmUnlock ();
283283return true;
284284 }
285285if (ts -> status == TRANSACTION_STATUS_UNKNOWN )
286286 {
287- MTM_TRACE ("%d: wait for in-doubt transaction %u in snapshot %lu\n" ,getpid () ,xid ,dtmTx .snapshot );
287+ MTM_TRACE ("%d: wait for in-doubt transaction %u in snapshot %lu\n" ,MyProcPid ,xid ,dtmTx .snapshot );
288288MtmUnlock ();
289289#if TRACE_SLEEP_TIME
290290 {
@@ -316,14 +316,14 @@ bool MtmXidInMVCCSnapshot(TransactionId xid, Snapshot snapshot)
316316 {
317317bool invisible = ts -> status != TRANSACTION_STATUS_COMMITTED ;
318318MTM_TUPLE_TRACE ("%d: tuple with xid=%d(csn= %ld) is %s in snapshot %ld\n" ,
319- getpid () ,xid ,ts -> csn ,invisible ?"rollbacked" :"committed" ,dtmTx .snapshot );
319+ MyProcPid ,xid ,ts -> csn ,invisible ?"rollbacked" :"committed" ,dtmTx .snapshot );
320320MtmUnlock ();
321321return invisible ;
322322 }
323323 }
324324else
325325 {
326- MTM_TUPLE_TRACE ("%d: visibility check is skept for transaction %u in snapshot %lu\n" ,getpid () ,xid ,dtmTx .snapshot );
326+ MTM_TUPLE_TRACE ("%d: visibility check is skept for transaction %u in snapshot %lu\n" ,MyProcPid ,xid ,dtmTx .snapshot );
327327break ;
328328 }
329329 }
@@ -493,7 +493,7 @@ MtmXactCallback(XactEvent event, void *arg)
493493static bool
494494MtmIsUserTransaction ()
495495{
496- return IsNormalProcessingMode ()&& dtm -> status == MTM_ONLINE && MtmDoReplication && !am_walsender && !IsBackgroundWorker && !IsAutoVacuumWorkerProcess ();
496+ return IsNormalProcessingMode ()&& MtmDoReplication && !am_walsender && !IsBackgroundWorker && !IsAutoVacuumWorkerProcess ();
497497}
498498
499499static void
@@ -504,6 +504,10 @@ MtmBeginTransaction(MtmCurrentTrans* x)
504504x -> xid = GetCurrentTransactionIdIfAny ();
505505x -> isReplicated = false;
506506x -> isDistributed = MtmIsUserTransaction ();
507+ if (x -> isDistributed && dtm -> status != MTM_ONLINE ) {
508+ MtmUnlock ();
509+ elog (ERROR ,"Multimaster node is offline" );
510+ }
507511x -> containsDML = false;
508512x -> isPrepared = false;
509513x -> snapshot = MtmAssignCSN ();
@@ -614,7 +618,7 @@ static void MtmPrecommitTransaction(MtmCurrentTrans* x)
614618
615619MtmUnlock ();
616620
617- MTM_TRACE ("%d: MtmPrepareTransaction prepare commit of %d CSN=%ld\n" ,getpid () ,x -> xid ,ts -> csn );
621+ MTM_TRACE ("%d: MtmPrepareTransaction prepare commit of %d CSN=%ld\n" ,MyProcPid ,x -> xid ,ts -> csn );
618622}
619623
620624static void
@@ -728,14 +732,14 @@ MtmCommitTransaction(TransactionId xid, int nsubxids, TransactionId *subxids)
728732ts = hash_search (xid2state ,& xid ,HASH_FIND ,NULL );
729733Assert (ts != NULL );/* should be created by MtmPrepareTransaction */
730734
731- MTM_TRACE ("%d: MtmCommitTransaction begin commit of %d CSN=%ld\n" ,getpid () ,xid ,ts -> csn );
735+ MTM_TRACE ("%d: MtmCommitTransaction begin commit of %d CSN=%ld\n" ,MyProcPid ,xid ,ts -> csn );
732736MtmAddSubtransactions (ts ,subxids ,nsubxids );
733737
734738MtmVoteForTransaction (ts );
735739
736740MtmUnlock ();
737741
738- MTM_TRACE ("%d: MtmCommitTransaction %d status=%d\n" ,getpid () ,xid ,ts -> status );
742+ MTM_TRACE ("%d: MtmCommitTransaction %d status=%d\n" ,MyProcPid ,xid ,ts -> status );
739743
740744return ts -> status != TRANSACTION_STATUS_ABORTED ;
741745}
@@ -768,7 +772,7 @@ MtmFinishTransaction(TransactionId xid, int nsubxids, TransactionId *subxids, Xi
768772MtmSendNotificationMessage (ts );
769773}
770774MtmUnlock ();
771- MTM_TRACE ("%d: MtmFinishTransaction %d CSN=%ld, status=%d\n" ,getpid () ,xid ,ts -> csn ,status );
775+ MTM_TRACE ("%d: MtmFinishTransaction %d CSN=%ld, status=%d\n" ,MyProcPid ,xid ,ts -> csn ,status );
772776}
773777}
774778
@@ -777,7 +781,7 @@ MtmFinishTransaction(TransactionId xid, int nsubxids, TransactionId *subxids, Xi
777781static void
778782MtmSetTransactionStatus (TransactionId xid ,int nsubxids ,TransactionId * subxids ,XidStatus status ,XLogRecPtr lsn )
779783{
780- MTM_TRACE ("%d: MtmSetTransactionStatus %u(%u) = %u, isDistributed=%d\n" ,getpid () ,xid ,dtmTx .xid ,status ,dtmTx .isDistributed );
784+ MTM_TRACE ("%d: MtmSetTransactionStatus %u(%u) = %u, isDistributed=%d\n" ,MyProcPid ,xid ,dtmTx .xid ,status ,dtmTx .isDistributed );
781785if (xid == dtmTx .xid && dtmTx .isDistributed && !dtmTx .isPrepared )
782786{
783787if (status == TRANSACTION_STATUS_ABORTED || !dtmTx .containsDML || dtm -> status == MTM_RECOVERY )
@@ -1100,7 +1104,7 @@ void MtmReceiverStarted(int nodeId)
11001104{
11011105SpinLockAcquire (& dtm -> spinlock );
11021106if (!BIT_CHECK (dtm -> pglogicalNodeMask ,nodeId - 1 )) {
1103- dtm -> pglogicalNodeMask |= (int64 )1 << (nodeId - 1 );
1107+ dtm -> pglogicalNodeMask |= (nodemask_t )1 << (nodeId - 1 );
11041108if (++ dtm -> nReceivers == dtm -> nNodes - 1 ) {
11051109elog (WARNING ,"All receivers are started, switch to normal mode" );
11061110Assert (dtm -> status == MTM_CONNECTED );
@@ -1478,14 +1482,14 @@ MtmVoteForTransaction(MtmTransState* ts)
14781482MtmSendNotificationMessage (ts );
14791483}
14801484}
1481- MTM_TRACE ("%d: Node %d waiting latch...\n" ,getpid () ,MtmNodeId );
1485+ MTM_TRACE ("%d: Node %d waiting latch...\n" ,MyProcPid ,MtmNodeId );
14821486while (!ts -> done ) {
14831487MtmUnlock ();
14841488WaitLatch (& MyProc -> procLatch ,WL_LATCH_SET ,-1 );
14851489ResetLatch (& MyProc -> procLatch );
14861490MtmLock (LW_SHARED );
14871491}
1488- MTM_TRACE ("%d: Node %d receives response...\n" ,getpid () ,MtmNodeId );
1492+ MTM_TRACE ("%d: Node %d receives response...\n" ,MyProcPid ,MtmNodeId );
14891493}
14901494
14911495HTAB * MtmCreateHash (void )