Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 7d66929

Browse files
committed
Do not update restartLSN for prepare transaction records
1 parent 9acf024 commit 7d66929

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

contrib/mmts/multimaster.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3727,7 +3727,6 @@ bool MtmFilterTransaction(char* record, int size)
37273727
switch (event)
37283728
{
37293729
case PGLOGICAL_PREPARE:
3730-
// return false;
37313730
case PGLOGICAL_PRECOMMIT_PREPARED:
37323731
case PGLOGICAL_ABORT_PREPARED:
37333732
gid = pq_getmsgstring(&s);
@@ -3742,7 +3741,10 @@ bool MtmFilterTransaction(char* record, int size)
37423741
restart_lsn = origin_node == MtmReplicationNodeId ? end_lsn : origin_lsn;
37433742
if (Mtm->nodes[origin_node-1].restartLSN < restart_lsn) {
37443743
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+
}
37463748
} else {
37473749
duplicate = true;
37483750
}

0 commit comments

Comments
 (0)