Skip to content

Commit cca50ae

Browse files
committed
Assign CSN for commits with INVALID_CSN during recovery. That can happen due to donor node reboot (and lost map)
1 parent 05ec09b commit cca50ae

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

pglogical_apply.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -739,7 +739,7 @@ process_remote_commit(StringInfo in)
739739
Assert(!TransactionIdIsValid(MtmGetCurrentTransactionId()));
740740
csn = pq_getmsgint64(in);
741741
/*
742-
* Since our recovery method allows undershoot of csn, we can receive
742+
* Since our recovery method allows undershoot of lsn, we can receive
743743
* some already committed transactions. And in case of donor node reboot
744744
* xid<->csn mapping for them will be lost. However we must filter such
745745
* transactions in walreceiver before this code. --sk
@@ -750,7 +750,10 @@ process_remote_commit(StringInfo in)
750750
MtmResetTransaction();
751751
StartTransactionCommand();
752752
MtmBeginSession(origin_node);
753-
MtmSetCurrentTransactionCSN(csn);
753+
if (csn == INVALID_CSN && Mtm->status == MTM_RECOVERY)
754+
MtmSetCurrentTransactionCSN(MtmAssignCSN());
755+
else
756+
MtmSetCurrentTransactionCSN(csn);
754757
MtmSetCurrentTransactionGID(gid);
755758
FinishPreparedTransaction(gid, true);
756759
MTM_LOG2("Distributed transaction %s is committed", gid);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy