@@ -139,6 +139,8 @@ HTAB* MtmXid2State;
139139static HTAB * MtmGid2State ;
140140static HTAB * MtmLocalTables ;
141141
142+ static bool MtmIsRecoverySession ;
143+
142144static MtmCurrentTrans MtmTx ;
143145
144146static TransactionManager MtmTM = {
@@ -1022,7 +1024,15 @@ static int64 MtmGetSlotLag(int nodeId)
10221024 */
10231025bool MtmIsRecoveredNode (int nodeId )
10241026{
1025- return BIT_CHECK (Mtm -> disabledNodeMask ,nodeId - 1 );
1027+ if (BIT_CHECK (Mtm -> disabledNodeMask ,nodeId - 1 )) {
1028+ if (!MtmIsRecoverySession ) {
1029+ elog (ERROR ,"Node %d is marked as disabled but is not in recovery mode" ,nodeId );
1030+ }
1031+ return true;
1032+ }else {
1033+ MtmIsRecoverySession = false;/* recovery is completed */
1034+ return false;
1035+ }
10261036}
10271037
10281038
@@ -1871,17 +1881,17 @@ static void
18711881MtmReplicationStartupHook (struct PGLogicalStartupHookArgs * args )
18721882{
18731883ListCell * param ;
1874- bool isRecoverySession = false;
1884+ MtmIsRecoverySession = false;
18751885foreach (param ,args -> in_params )
18761886{
18771887DefElem * elem = lfirst (param );
18781888if (strcmp ("mtm_replication_mode" ,elem -> defname )== 0 ) {
1879- isRecoverySession = elem -> arg != NULL && strVal (elem -> arg )!= NULL && strcmp (strVal (elem -> arg ),"recovery" )== 0 ;
1889+ MtmIsRecoverySession = elem -> arg != NULL && strVal (elem -> arg )!= NULL && strcmp (strVal (elem -> arg ),"recovery" )== 0 ;
18801890break ;
18811891}
18821892}
18831893MtmLock (LW_EXCLUSIVE );
1884- if (isRecoverySession ) {
1894+ if (MtmIsRecoverySession ) {
18851895elog (WARNING ,"%d: Node %d start recovery of node %d" ,MyProcPid ,MtmNodeId ,MtmReplicationNodeId );
18861896if (!BIT_CHECK (Mtm -> disabledNodeMask ,MtmReplicationNodeId - 1 )) {
18871897BIT_SET (Mtm -> disabledNodeMask ,MtmReplicationNodeId - 1 );