From bc5103128fb3b6583a0b2b248fd205b59a347fe5 Mon Sep 17 00:00:00 2001
From: Heikki Linnakangas <heikki.linnakangas@iki.fi>
Date: Tue, 28 Feb 2023 13:02:56 +0200
Subject: [PATCH 3/4] Remove combocid field in logical decode that was just for
 debugging.

(I don't think this is worth doing without the next patch)
---
 src/backend/access/heap/heapam.c                | 2 --
 src/backend/access/rmgrdesc/heapdesc.c          | 4 ++--
 src/backend/replication/logical/reorderbuffer.c | 7 +------
 src/backend/replication/logical/snapbuild.c     | 3 +--
 src/include/access/heapam_xlog.h                | 1 -
 src/include/replication/reorderbuffer.h         | 3 +--
 6 files changed, 5 insertions(+), 15 deletions(-)

diff --git a/src/backend/access/heap/heapam.c b/src/backend/access/heap/heapam.c
index 7eb79cee58d..f82176491a1 100644
--- a/src/backend/access/heap/heapam.c
+++ b/src/backend/access/heap/heapam.c
@@ -8515,7 +8515,6 @@ log_heap_new_cid(Relation relation, HeapTuple tup)
 		Assert(!HeapTupleHeaderXminInvalid(hdr));
 		xlrec.cmin = HeapTupleHeaderGetCmin(hdr);
 		xlrec.cmax = HeapTupleHeaderGetCmax(hdr);
-		xlrec.combocid = HeapTupleHeaderGetRawCommandId(hdr);
 	}
 	/* No combo CID, so only cmin or cmax can be set by this TX */
 	else
@@ -8540,7 +8539,6 @@ log_heap_new_cid(Relation relation, HeapTuple tup)
 			xlrec.cmin = InvalidCommandId;
 			xlrec.cmax = HeapTupleHeaderGetRawCommandId(hdr);
 		}
-		xlrec.combocid = InvalidCommandId;
 	}
 
 	/*
diff --git a/src/backend/access/rmgrdesc/heapdesc.c b/src/backend/access/rmgrdesc/heapdesc.c
index 628f7e82156..ae35f2c88dc 100644
--- a/src/backend/access/rmgrdesc/heapdesc.c
+++ b/src/backend/access/rmgrdesc/heapdesc.c
@@ -175,8 +175,8 @@ heap2_desc(StringInfo buf, XLogReaderState *record)
 						 xlrec->target_locator.relNumber,
 						 ItemPointerGetBlockNumber(&(xlrec->target_tid)),
 						 ItemPointerGetOffsetNumber(&(xlrec->target_tid)));
-		appendStringInfo(buf, "; cmin: %u, cmax: %u, combo: %u",
-						 xlrec->cmin, xlrec->cmax, xlrec->combocid);
+		appendStringInfo(buf, "; cmin: %u, cmax: %u",
+						 xlrec->cmin, xlrec->cmax);
 	}
 }
 
diff --git a/src/backend/replication/logical/reorderbuffer.c b/src/backend/replication/logical/reorderbuffer.c
index 2d17c551a80..1e7c7e55f45 100644
--- a/src/backend/replication/logical/reorderbuffer.c
+++ b/src/backend/replication/logical/reorderbuffer.c
@@ -102,7 +102,6 @@
 #include "storage/fd.h"
 #include "storage/sinval.h"
 #include "utils/builtins.h"
-#include "utils/combocid.h"
 #include "utils/memdebug.h"
 #include "utils/memutils.h"
 #include "utils/rel.h"
@@ -128,7 +127,6 @@ typedef struct ReorderBufferTupleCidEnt
 	ReorderBufferTupleCidKey key;
 	CommandId	cmin;
 	CommandId	cmax;
-	CommandId	combocid;		/* just for debugging */
 } ReorderBufferTupleCidEnt;
 
 /* Virtual file descriptor with file offset tracking */
@@ -1774,7 +1772,6 @@ ReorderBufferBuildTupleCidHash(ReorderBuffer *rb, ReorderBufferTXN *txn)
 		{
 			ent->cmin = change->data.tuplecid.cmin;
 			ent->cmax = change->data.tuplecid.cmax;
-			ent->combocid = change->data.tuplecid.combocid;
 		}
 		else
 		{
@@ -3244,7 +3241,7 @@ void
 ReorderBufferAddNewTupleCids(ReorderBuffer *rb, TransactionId xid,
 							 XLogRecPtr lsn, RelFileLocator locator,
 							 ItemPointerData tid, CommandId cmin,
-							 CommandId cmax, CommandId combocid)
+							 CommandId cmax)
 {
 	ReorderBufferChange *change = ReorderBufferGetChange(rb);
 	ReorderBufferTXN *txn;
@@ -3255,7 +3252,6 @@ ReorderBufferAddNewTupleCids(ReorderBuffer *rb, TransactionId xid,
 	change->data.tuplecid.tid = tid;
 	change->data.tuplecid.cmin = cmin;
 	change->data.tuplecid.cmax = cmax;
-	change->data.tuplecid.combocid = combocid;
 	change->lsn = lsn;
 	change->txn = txn;
 	change->action = REORDER_BUFFER_CHANGE_INTERNAL_TUPLECID;
@@ -5102,7 +5098,6 @@ ApplyLogicalMappingFile(HTAB *tuplecid_data, Oid relid, const char *fname)
 			/* update mapping */
 			new_ent->cmin = ent->cmin;
 			new_ent->cmax = ent->cmax;
-			new_ent->combocid = ent->combocid;
 		}
 	}
 
diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c
index 93755646564..a86d5b1c74d 100644
--- a/src/backend/replication/logical/snapbuild.c
+++ b/src/backend/replication/logical/snapbuild.c
@@ -829,8 +829,7 @@ SnapBuildProcessNewCid(SnapBuild *builder, TransactionId xid,
 
 	ReorderBufferAddNewTupleCids(builder->reorder, xlrec->top_xid, lsn,
 								 xlrec->target_locator, xlrec->target_tid,
-								 xlrec->cmin, xlrec->cmax,
-								 xlrec->combocid);
+								 xlrec->cmin, xlrec->cmax);
 
 	/* figure out new command id */
 	if (xlrec->cmin != InvalidCommandId &&
diff --git a/src/include/access/heapam_xlog.h b/src/include/access/heapam_xlog.h
index 8cb0d8da193..d3b475e3144 100644
--- a/src/include/access/heapam_xlog.h
+++ b/src/include/access/heapam_xlog.h
@@ -374,7 +374,6 @@ typedef struct xl_heap_new_cid
 	TransactionId top_xid;
 	CommandId	cmin;
 	CommandId	cmax;
-	CommandId	combocid;		/* just for debugging */
 
 	/*
 	 * Store the relfilelocator/ctid pair to facilitate lookups.
diff --git a/src/include/replication/reorderbuffer.h b/src/include/replication/reorderbuffer.h
index 215d1494e90..d13cef4eae2 100644
--- a/src/include/replication/reorderbuffer.h
+++ b/src/include/replication/reorderbuffer.h
@@ -158,7 +158,6 @@ typedef struct ReorderBufferChange
 			ItemPointerData tid;
 			CommandId	cmin;
 			CommandId	cmax;
-			CommandId	combocid;
 		}			tuplecid;
 
 		/* Invalidation. */
@@ -707,7 +706,7 @@ extern void ReorderBufferAddNewCommandId(ReorderBuffer *rb, TransactionId xid,
 extern void ReorderBufferAddNewTupleCids(ReorderBuffer *rb, TransactionId xid,
 										 XLogRecPtr lsn, RelFileLocator locator,
 										 ItemPointerData tid,
-										 CommandId cmin, CommandId cmax, CommandId combocid);
+										 CommandId cmin, CommandId cmax);
 extern void ReorderBufferAddInvalidations(ReorderBuffer *rb, TransactionId xid, XLogRecPtr lsn,
 										  Size nmsgs, SharedInvalidationMessage *msgs);
 extern void ReorderBufferImmediateInvalidation(ReorderBuffer *rb, uint32 ninvalidations,
-- 
2.30.2

