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