From 28134ca74917a72d0c1c8b3cd640a9b50264524b Mon Sep 17 00:00:00 2001
From: Masahiko Sawada <sawada.mshk@gmail.com>
Date: Wed, 20 Jul 2022 17:25:11 +0900
Subject: [PATCH v3] Improve description of XLOG_RUNNING_XACTS.

Previously, the description of XLOG_RUNNING_XACTS showed only
top-transaction XIDs and whether subtransactions are overflowed.
This commit improves it to show individual subtransaction XIDs.

This impacts the format of pg_waldump or anything using these
description routines, so no backpatch is done.

Author: Masahiko Sawada <sawada.mshk@gmail.com>
Reviewd by: Fujii Masao <masao.fujii@oss.nttdata.com>
Reviewd by: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Reviewd by: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>
Discussion: https://postgr.es/m/CAD21AoAqvaE+XEeXHHPdAGQPcCoGXxuoeutq_nWhUSQvTt5+tA@mail.gmail.com
---
 src/backend/access/rmgrdesc/standbydesc.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/backend/access/rmgrdesc/standbydesc.c b/src/backend/access/rmgrdesc/standbydesc.c
index 2dba39e349..4789df886a 100644
--- a/src/backend/access/rmgrdesc/standbydesc.c
+++ b/src/backend/access/rmgrdesc/standbydesc.c
@@ -33,7 +33,14 @@ standby_desc_running_xacts(StringInfo buf, xl_running_xacts *xlrec)
 	}
 
 	if (xlrec->subxid_overflow)
-		appendStringInfoString(buf, "; subxid ovf");
+		appendStringInfoString(buf, "; subxid overflowed");
+
+	if (xlrec->subxcnt > 0)
+	{
+		appendStringInfo(buf, "; %d subxacts:", xlrec->subxcnt);
+		for (i = 0; i < xlrec->subxcnt; i++)
+			appendStringInfo(buf, " %u", xlrec->xids[xlrec->xcnt + i]);
+	}
 }
 
 void
-- 
2.32.1 (Apple Git-133)

