Re: Make pg_waldump report replication origin ID, LSN, and timestamp. - Mailing list pgsql-hackers

From Michael Paquier
Subject Re: Make pg_waldump report replication origin ID, LSN, and timestamp.
Date
Msg-id Ya3FN1Va88oGFAMG@paquier.xyz
Whole thread Raw
In response to Make pg_waldump report replication origin ID, LSN, and timestamp.  (Masahiko Sawada <sawada.mshk@gmail.com>)
Responses Re: Make pg_waldump report replication origin ID, LSN, and timestamp.  (Masahiko Sawada <sawada.mshk@gmail.com>)
List pgsql-hackers
On Mon, Dec 06, 2021 at 04:35:07PM +0900, Masahiko Sawada wrote:
> I've attached a patch to add replication origin information to
> xact_desc_prepare().

Yeah.

+   if (origin_id != InvalidRepOriginId)
+       appendStringInfo(buf, "; origin: node %u, lsn %X/%X, at %s",
+                        origin_id,
+                        LSN_FORMAT_ARGS(parsed.origin_lsn),
+                        timestamptz_to_str(parsed.origin_timestamp));

Shouldn't you check for parsed.origin_lsn instead?  The replication
origin is stored there as far as I read EndPrepare().

Commit records check after XACT_XINFO_HAS_ORIGIN, but
xact_desc_abort() may include this information for ROLLBACK PREPARED
transactions so we could use the same logic as xact_desc_commit() for
the abort case, no?
--
Michael

Attachment

pgsql-hackers by date:

Previous
From: Masahiko Sawada
Date:
Subject: Make pg_waldump report replication origin ID, LSN, and timestamp.
Next
From: Fujii Masao
Date:
Subject: Re: Shouldn't postgres_fdw report warning when it gives up getting result from foreign server?