@@ -3727,7 +3727,6 @@ bool MtmFilterTransaction(char* record, int size)
3727
3727
switch (event )
3728
3728
{
3729
3729
case PGLOGICAL_PREPARE :
3730
- // return false;
3731
3730
case PGLOGICAL_PRECOMMIT_PREPARED :
3732
3731
case PGLOGICAL_ABORT_PREPARED :
3733
3732
gid = pq_getmsgstring (& s );
@@ -3742,7 +3741,10 @@ bool MtmFilterTransaction(char* record, int size)
3742
3741
restart_lsn = origin_node == MtmReplicationNodeId ?end_lsn :origin_lsn ;
3743
3742
if (Mtm -> nodes [origin_node - 1 ].restartLSN < restart_lsn ) {
3744
3743
MTM_LOG2 ("[restartlsn] node %d: %llx -> %llx (MtmFilterTransaction)" ,MtmReplicationNodeId ,Mtm -> nodes [MtmReplicationNodeId - 1 ].restartLSN ,restart_lsn );
3745
- Mtm -> nodes [origin_node - 1 ].restartLSN = restart_lsn ;
3744
+ if (event != PGLOGICAL_PREPARE ) {
3745
+ /* Transactions can be prepared in different order, so to avoid loosing transactions we should not update restartLsn for them */
3746
+ Mtm -> nodes [origin_node - 1 ].restartLSN = restart_lsn ;
3747
+ }
3746
3748
}else {
3747
3749
duplicate = true;
3748
3750
}