On Fri, May 21, 2021 at 11:26 AM Amit Kapila <amit.kapil...@gmail.com>
wrote:

> On Thu, May 20, 2021 at 5:43 PM Ashutosh Bapat
> <ashutosh.bapat....@gmail.com> wrote:
> >
> > Hi
> > LogicalIncreaseRestartDecodingForSlot() has a debug log to report a
> > new restart_lsn. But the corresponding function for catalog_xmin.
> > Here's a patch to add the same.
> >
>
> I think this can be useful. One minor comment:
> + elog(DEBUG1, "got new catalog_xmin %u at %X/%X", xmin,
> + (uint32) (current_lsn >> 32), (uint32) current_lsn);
>
> Isn't it better to use LSN_FORMAT_ARGS for current_lsn?


Thanks for reminding me about that. :).

Attached revised patch.


> Also, there
> doesn't seem to be any urgency for adding this, so you can register it
> for the next CF so that we can add this when the branch opens for
> PG-15.
>

It's there in CF. I am fine with PG-15. It will be good to patch the
back-branches to have this extra diagnostic information available.

--
Best Wishes,
Ashutosh
From edc05ab21445e859ba6f80bf2c97563c94a1e66b Mon Sep 17 00:00:00 2001
From: Ashutosh Bapat <ashutosh.ba...@2ndquadrant.com>
Date: Thu, 13 May 2021 13:40:33 +0530
Subject: [PATCH] Report new catalog_xmin candidate in
 LogicalIncreaseXminForSlot()

Similar to LogicalIncreaseRestartDecodingForSlot() add a debug message
to LogicalIncreaseXminForSlot() reporting a new catalog_xmin candidate.

We should submit this to the community.

BDR-723
---
 src/backend/replication/logical/logical.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/backend/replication/logical/logical.c b/src/backend/replication/logical/logical.c
index ffc6160e9f..a776c54c01 100644
--- a/src/backend/replication/logical/logical.c
+++ b/src/backend/replication/logical/logical.c
@@ -1573,6 +1573,8 @@ LogicalIncreaseXminForSlot(XLogRecPtr current_lsn, TransactionId xmin)
 	{
 		slot->candidate_catalog_xmin = xmin;
 		slot->candidate_xmin_lsn = current_lsn;
+		elog(DEBUG1, "got new catalog_xmin %u at %X/%X", xmin,
+			 LSN_FORMAT_ARGS(current_lsn));
 	}
 	SpinLockRelease(&slot->mutex);
 
-- 
2.25.1

Reply via email to