Re: Perform streaming logical transactions by background workers and parallel apply - Mailing list pgsql-hackers

From Amit Kapila
Subject Re: Perform streaming logical transactions by background workers and parallel apply
Date
Msg-id CAA4eK1JXDkog1BZaKNXxadSdXrhGyV3ZaF5E9K-jQ6C2A1T6Ww@mail.gmail.com
Whole thread Raw
In response to Re: Perform streaming logical transactions by background workers and parallel apply  (Amit Kapila <amit.kapila16@gmail.com>)
List pgsql-hackers
On Thu, Dec 15, 2022 at 6:29 PM Amit Kapila <amit.kapila16@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.



pgsql-hackers by date:

Previous
From: "Drouvot, Bertrand"
Date:
Subject: Re: Minimal logical decoding on standbys
Next
From: Niyas Sait
Date:
Subject: Re: [PATCH] Add native windows on arm64 support