On Thu, Dec 15, 2022 at 6:29 PM Amit Kapila <amit.kapil...@gmail.com> wrote:
>

I have noticed that the origin information of the rollback is not
restored after restart of the server. So, the apply worker will send
the old origin information in that case. It seems we need the below
change in XactLogAbortRecord(). What do you think?

diff --git a/src/backend/access/transam/xact.c
b/src/backend/access/transam/xact.c
index 419fac5d6f..1b047133db 100644
--- a/src/backend/access/transam/xact.c
+++ b/src/backend/access/transam/xact.c
@@ -5880,11 +5880,10 @@ XactLogAbortRecord(TimestampTz abort_time,
        }

        /*
-        * Dump transaction origin information only for abort prepared. We need
-        * this during recovery to update the replication origin progress.
+        * Dump transaction origin information. We need this during recovery to
+        * update the replication origin progress.
         */
-       if ((replorigin_session_origin != InvalidRepOriginId) &&
-               TransactionIdIsValid(twophase_xid))
+       if (replorigin_session_origin != InvalidRepOriginId)
        {
                xl_xinfo.xinfo |= XACT_XINFO_HAS_ORIGIN;

@@ -5941,8 +5940,8 @@ XactLogAbortRecord(TimestampTz abort_time,
        if (xl_xinfo.xinfo & XACT_XINFO_HAS_ORIGIN)
                XLogRegisterData((char *) (&xl_origin), sizeof(xl_xact_origin));

-       if (TransactionIdIsValid(twophase_xid))
-               XLogSetRecordFlags(XLOG_INCLUDE_ORIGIN);
+       /* include the replication origin */
+       XLogSetRecordFlags(XLOG_INCLUDE_ORIGIN);


-- 
With Regards,
Amit Kapila.


Reply via email to