Skip to content

Commit f9a03d2

Browse files
committed
Do not update restartLSN for prepare transaction records
1 parent 86746e5 commit f9a03d2

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
@@ -4099,7 +4099,6 @@ bool MtmFilterTransaction(char* record, int size)
40994099
switch (event)
41004100
{
41014101
case PGLOGICAL_PREPARE:
4102-
return false;
41034102
case PGLOGICAL_PRECOMMIT_PREPARED:
41044103
case PGLOGICAL_ABORT_PREPARED:
41054104
gid = pq_getmsgstring(&s);
@@ -4114,7 +4113,10 @@ bool MtmFilterTransaction(char* record, int size)
41144113
restart_lsn = origin_node == MtmReplicationNodeId ? end_lsn : origin_lsn;
41154114
if (Mtm->nodes[origin_node-1].restartLSN < restart_lsn) {
41164115
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+
}
41184120
} else {
41194121
duplicate = true;
41204122
}

0 commit comments

Comments
 (0)