@@ -4099,7 +4099,6 @@ bool MtmFilterTransaction(char* record, int size)
4099
4099
switch (event )
4100
4100
{
4101
4101
case PGLOGICAL_PREPARE :
4102
- return false;
4103
4102
case PGLOGICAL_PRECOMMIT_PREPARED :
4104
4103
case PGLOGICAL_ABORT_PREPARED :
4105
4104
gid = pq_getmsgstring (& s );
@@ -4114,7 +4113,10 @@ bool MtmFilterTransaction(char* record, int size)
4114
4113
restart_lsn = origin_node == MtmReplicationNodeId ?end_lsn :origin_lsn ;
4115
4114
if (Mtm -> nodes [origin_node - 1 ].restartLSN < restart_lsn ) {
4116
4115
MTM_LOG2 ("[restartlsn] node %d: %llx -> %llx (MtmFilterTransaction)" ,MtmReplicationNodeId ,Mtm -> nodes [MtmReplicationNodeId - 1 ].restartLSN ,restart_lsn );
4117
- Mtm -> nodes [origin_node - 1 ].restartLSN = restart_lsn ;
4116
+ if (event != PGLOGICAL_PREPARE ) {
4117
+ /* Transactions can be prepared in different order, so to avoid loosing transactions we should not update restartLsn for them */
4118
+ Mtm -> nodes [origin_node - 1 ].restartLSN = restart_lsn ;
4119
+ }
4118
4120
}else {
4119
4121
duplicate = true;
4120
4122
}