@@ -1146,6 +1146,7 @@ MtmLogAbortLogicalMessage(int nodeId, char const* gid)
1146
1146
strcpy (msg .gid , gid );
1147
1147
msg .origin_node = nodeId ;
1148
1148
msg .origin_lsn = replorigin_session_origin_lsn ;
1149
+ MTM_LOG2 ("[TRACE] MtmLogAbortLogicalMessage(%d, %s)" , nodeId , gid );
1149
1150
XLogFlush (LogLogicalMessage ("A" , (char * )& msg , sizeof msg , false));
1150
1151
}
1151
1152
@@ -1234,6 +1235,7 @@ MtmEndTransaction(MtmCurrentTrans* x, bool commit)
1234
1235
MtmTransactionListAppend (ts );
1235
1236
if (* x -> gid ) {
1236
1237
replorigin_session_origin_lsn = InvalidXLogRecPtr ;
1238
+ MTM_TXTRACE (x , "MtmEndTransaction/MtmLogAbortLogicalMessage" );
1237
1239
MtmLogAbortLogicalMessage (MtmNodeId , x -> gid );
1238
1240
}
1239
1241
}
@@ -2888,7 +2890,9 @@ void MtmRollbackPreparedTransaction(int nodeId, char const* gid)
2888
2890
CommitTransactionCommand ();
2889
2891
MtmEndSession (nodeId , true);
2890
2892
} else if (status == TRANSACTION_STATUS_IN_PROGRESS ) {
2893
+ MtmBeginSession (nodeId );
2891
2894
MtmLogAbortLogicalMessage (nodeId , gid );
2895
+ MtmEndSession (nodeId , true);
2892
2896
}
2893
2897
}
2894
2898
@@ -3055,6 +3059,7 @@ MtmReplicationStartupHook(struct PGLogicalStartupHookArgs* args)
3055
3059
sscanf (strVal (elem -> arg ), "%lx" , & recoveredLSN );
3056
3060
MTM_LOG1 ("Recovered position of node %d is %lx" , MtmReplicationNodeId , recoveredLSN );
3057
3061
if (Mtm -> nodes [MtmReplicationNodeId - 1 ].restartLSN < recoveredLSN ) {
3062
+ MTM_LOG2 ("[restartlsn] node %d: %lx -> %lx (MtmReplicationStartupHook)" , MtmReplicationNodeId , Mtm -> nodes [MtmReplicationNodeId - 1 ].restartLSN , recoveredLSN );
3058
3063
Mtm -> nodes [MtmReplicationNodeId - 1 ].restartLSN = recoveredLSN ;
3059
3064
}
3060
3065
} else {
@@ -3220,18 +3225,20 @@ bool MtmFilterTransaction(char* record, int size)
3220
3225
}
3221
3226
restart_lsn = origin_node == MtmReplicationNodeId ? end_lsn : origin_lsn ;
3222
3227
if (Mtm -> nodes [origin_node - 1 ].restartLSN < restart_lsn ) {
3228
+ MTM_LOG2 ("[restartlsn] node %d: %lx -> %lx (MtmFilterTransaction)" , MtmReplicationNodeId , Mtm -> nodes [MtmReplicationNodeId - 1 ].restartLSN , restart_lsn );
3223
3229
Mtm -> nodes [origin_node - 1 ].restartLSN = restart_lsn ;
3224
3230
} else {
3225
3231
duplicate = true;
3226
3232
}
3227
3233
3228
3234
if (duplicate ) {
3229
- MTM_LOG1 ("Ignore transaction %s from node %d lsn %lx, flags=%x, origin node %d, original lsn =%lx, current lsn =%lx" ,
3230
- gid , replication_node , end_lsn , flags , origin_node , origin_lsn , restart_lsn );
3235
+ MTM_LOG1 ("Ignore transaction %s from node %d flags=%x, our restartLSN for node: %lx,restart_lsn = ( origin node %d == MtmReplicationNodeId %d) ? end_lsn =%lx, origin_lsn =%lx" ,
3236
+ gid , replication_node , flags , Mtm -> nodes [ origin_node - 1 ]. restartLSN , origin_node , MtmReplicationNodeId , end_lsn , origin_lsn );
3231
3237
} else {
3232
3238
MTM_LOG2 ("Apply transaction %s from node %d lsn %lx, flags=%x, origin node %d, original lsn=%lx, current lsn=%lx" ,
3233
3239
gid , replication_node , end_lsn , flags , origin_node , origin_lsn , restart_lsn );
3234
3240
}
3241
+
3235
3242
return duplicate ;
3236
3243
}
3237
3244
@@ -4137,16 +4144,16 @@ static void MtmProcessUtility(Node *parsetree, const char *queryString,
4137
4144
4138
4145
case T_VacuumStmt :
4139
4146
skipCommand = true;
4140
- if (context == PROCESS_UTILITY_TOPLEVEL ) {
4141
- MtmProcessDDLCommand (queryString , false, true);
4142
- MtmTx .isDistributed = false;
4143
- } else if (MtmApplyContext != NULL ) {
4144
- MemoryContext oldContext = MemoryContextSwitchTo (MtmApplyContext );
4145
- Assert (oldContext != MtmApplyContext );
4146
- MtmVacuumStmt = (VacuumStmt * )copyObject (parsetree );
4147
- MemoryContextSwitchTo (oldContext );
4148
- return ;
4149
- }
4147
+ // if (context == PROCESS_UTILITY_TOPLEVEL) {
4148
+ // MtmProcessDDLCommand(queryString, false, true);
4149
+ // MtmTx.isDistributed = false;
4150
+ // } else if (MtmApplyContext != NULL) {
4151
+ // MemoryContext oldContext = MemoryContextSwitchTo(MtmApplyContext);
4152
+ // Assert(oldContext != MtmApplyContext);
4153
+ // MtmVacuumStmt = (VacuumStmt*)copyObject(parsetree);
4154
+ // MemoryContextSwitchTo(oldContext);
4155
+ // return;
4156
+ // }
4150
4157
break ;
4151
4158
4152
4159
case T_CreateDomainStmt :
@@ -4241,7 +4248,7 @@ static void MtmProcessUtility(Node *parsetree, const char *queryString,
4241
4248
if (indexStmt -> concurrent )
4242
4249
{
4243
4250
if (context == PROCESS_UTILITY_TOPLEVEL ) {
4244
- MtmProcessDDLCommand (queryString , false, true);
4251
+ // MtmProcessDDLCommand(queryString, false, true);
4245
4252
MtmTx .isDistributed = false;
4246
4253
skipCommand = true;
4247
4254
/*
@@ -4268,7 +4275,7 @@ static void MtmProcessUtility(Node *parsetree, const char *queryString,
4268
4275
if (stmt -> removeType == OBJECT_INDEX && stmt -> concurrent )
4269
4276
{
4270
4277
if (context == PROCESS_UTILITY_TOPLEVEL ) {
4271
- MtmProcessDDLCommand (queryString , false, true);
4278
+ // MtmProcessDDLCommand(queryString, false, true);
4272
4279
MtmTx .isDistributed = false;
4273
4280
skipCommand = true;
4274
4281
} else if (MtmApplyContext != NULL ) {
0 commit comments