From cd4a4373a1c07d03e47303288bdb92f52ec58d4b Mon Sep 17 00:00:00 2001
From: Zsolt Parragi <zsolt.parragi@percona.com>
Date: Tue, 17 Mar 2026 18:14:35 +0000
Subject: [PATCH 4/4] Remove trivial SizeOfXXX macros that are just
 sizeof(type)

Now that WAL record structs have explicit padding, the SizeOfXXX macros
that previously used offsetof() to skip trailing padding are plain
sizeof() aliases.  Replace all usages with direct sizeof() calls for
clarity, as sizeof(type) is self-documenting at the call site.

Macros using offsetof() (for flexible array members), MAXALIGN, or
arithmetic are kept as they carry additional semantics.
---
 src/backend/access/brin/brin.c           |  2 +-
 src/backend/access/brin/brin_pageops.c   |  6 ++---
 src/backend/access/brin/brin_revmap.c    |  4 ++--
 src/backend/access/gist/gistxlog.c       |  4 ++--
 src/backend/access/hash/hash.c           |  4 ++--
 src/backend/access/hash/hashinsert.c     |  2 +-
 src/backend/access/hash/hashovfl.c       |  6 ++---
 src/backend/access/hash/hashpage.c       |  8 +++----
 src/backend/access/heap/heapam.c         | 30 ++++++++++++------------
 src/backend/access/heap/heapam_xlog.c    | 18 +++++++-------
 src/backend/access/heap/pruneheap.c      |  2 +-
 src/backend/access/nbtree/nbtdedup.c     |  2 +-
 src/backend/access/nbtree/nbtinsert.c    |  6 ++---
 src/backend/access/nbtree/nbtpage.c      | 18 +++++++-------
 src/backend/access/nbtree/nbtxlog.c      |  4 ++--
 src/backend/access/rmgrdesc/heapdesc.c   |  2 +-
 src/backend/access/rmgrdesc/nbtdesc.c    |  4 ++--
 src/backend/access/rmgrdesc/xactdesc.c   |  2 +-
 src/backend/access/transam/commit_ts.c   |  2 +-
 src/backend/access/transam/multixact.c   |  4 ++--
 src/backend/access/transam/xact.c        |  2 +-
 src/backend/access/transam/xloginsert.c  |  4 ++--
 src/backend/replication/logical/decode.c | 26 ++++++++++----------
 src/include/access/brin_xlog.h           |  6 -----
 src/include/access/commit_ts.h           |  1 -
 src/include/access/gistxlog.h            |  2 --
 src/include/access/hash_xlog.h           | 10 --------
 src/include/access/heapam_xlog.h         | 11 ---------
 src/include/access/multixact.h           |  1 -
 src/include/access/nbtxlog.h             | 10 --------
 src/include/access/xact.h                |  1 -
 src/include/access/xlogrecord.h          |  3 +--
 32 files changed, 82 insertions(+), 125 deletions(-)

diff --git a/src/backend/access/brin/brin.c b/src/backend/access/brin/brin.c
index 8ef44a0075b..e4cf698b649 100644
--- a/src/backend/access/brin/brin.c
+++ b/src/backend/access/brin/brin.c
@@ -1143,7 +1143,7 @@ brinbuild(Relation heap, Relation index, IndexInfo *indexInfo)
 		xlrec.pagesPerRange = BrinGetPagesPerRange(index);
 
 		XLogBeginInsert();
-		XLogRegisterData(&xlrec, SizeOfBrinCreateIdx);
+		XLogRegisterData(&xlrec, sizeof(xl_brin_createidx));
 		XLogRegisterBuffer(0, meta, REGBUF_WILL_INIT | REGBUF_STANDARD);
 
 		recptr = XLogInsert(RM_BRIN_ID, XLOG_BRIN_CREATE_INDEX);
diff --git a/src/backend/access/brin/brin_pageops.c b/src/backend/access/brin/brin_pageops.c
index a1e8bd0e225..4f0160250ff 100644
--- a/src/backend/access/brin/brin_pageops.c
+++ b/src/backend/access/brin/brin_pageops.c
@@ -190,7 +190,7 @@ brin_doupdate(Relation idxrel, BlockNumber pagesPerRange,
 			xlrec.offnum = oldoff;
 
 			XLogBeginInsert();
-			XLogRegisterData(&xlrec, SizeOfBrinSamepageUpdate);
+			XLogRegisterData(&xlrec, sizeof(xl_brin_samepage_update));
 
 			XLogRegisterBuffer(0, oldbuf, REGBUF_STANDARD);
 			XLogRegisterBufData(0, newtup, newsz);
@@ -281,7 +281,7 @@ brin_doupdate(Relation idxrel, BlockNumber pagesPerRange,
 			XLogBeginInsert();
 
 			/* new page */
-			XLogRegisterData(&xlrec, SizeOfBrinUpdate);
+			XLogRegisterData(&xlrec, sizeof(xl_brin_update));
 
 			XLogRegisterBuffer(0, newbuf, REGBUF_STANDARD | (extended ? REGBUF_WILL_INIT : 0));
 			XLogRegisterBufData(0, newtup, newsz);
@@ -433,7 +433,7 @@ brin_doinsert(Relation idxrel, BlockNumber pagesPerRange,
 		xlrec.offnum = off;
 
 		XLogBeginInsert();
-		XLogRegisterData(&xlrec, SizeOfBrinInsert);
+		XLogRegisterData(&xlrec, sizeof(xl_brin_insert));
 
 		XLogRegisterBuffer(0, *buffer, REGBUF_STANDARD | (extended ? REGBUF_WILL_INIT : 0));
 		XLogRegisterBufData(0, tup, itemsz);
diff --git a/src/backend/access/brin/brin_revmap.c b/src/backend/access/brin/brin_revmap.c
index 57ac044497a..ee013bdd167 100644
--- a/src/backend/access/brin/brin_revmap.c
+++ b/src/backend/access/brin/brin_revmap.c
@@ -416,7 +416,7 @@ brinRevmapDesummarizeRange(Relation idxrel, BlockNumber heapBlk)
 		xlrec.regOffset = regOffset;
 
 		XLogBeginInsert();
-		XLogRegisterData(&xlrec, SizeOfBrinDesummarize);
+		XLogRegisterData(&xlrec, sizeof(xl_brin_desummarize));
 		XLogRegisterBuffer(0, revmapBuf, 0);
 		XLogRegisterBuffer(1, regBuf, REGBUF_STANDARD);
 		recptr = XLogInsert(RM_BRIN_ID, XLOG_BRIN_DESUMMARIZE);
@@ -627,7 +627,7 @@ revmap_physical_extend(BrinRevmap *revmap)
 		xlrec.targetBlk = mapBlk;
 
 		XLogBeginInsert();
-		XLogRegisterData(&xlrec, SizeOfBrinRevmapExtend);
+		XLogRegisterData(&xlrec, sizeof(xl_brin_revmap_extend));
 		XLogRegisterBuffer(0, revmap->rm_metaBuf, REGBUF_STANDARD);
 
 		XLogRegisterBuffer(1, buf, REGBUF_WILL_INIT);
diff --git a/src/backend/access/gist/gistxlog.c b/src/backend/access/gist/gistxlog.c
index b93e831b829..194a7f8ab34 100644
--- a/src/backend/access/gist/gistxlog.c
+++ b/src/backend/access/gist/gistxlog.c
@@ -557,7 +557,7 @@ gistXLogPageDelete(Buffer buffer, FullTransactionId xid,
 	xlrec.downlinkOffset = downlinkOffset;
 
 	XLogBeginInsert();
-	XLogRegisterData(&xlrec, SizeOfGistxlogPageDelete);
+	XLogRegisterData(&xlrec, sizeof(gistxlogPageDelete));
 
 	XLogRegisterBuffer(0, buffer, REGBUF_STANDARD);
 	XLogRegisterBuffer(1, parentBuffer, REGBUF_STANDARD);
@@ -607,7 +607,7 @@ gistXLogPageReuse(Relation rel, Relation heaprel,
 	xlrec_reuse.snapshotConflictHorizon = deleteXid;
 
 	XLogBeginInsert();
-	XLogRegisterData(&xlrec_reuse, SizeOfGistxlogPageReuse);
+	XLogRegisterData(&xlrec_reuse, sizeof(gistxlogPageReuse));
 
 	XLogInsert(RM_GIST_ID, XLOG_GIST_PAGE_REUSE);
 }
diff --git a/src/backend/access/hash/hash.c b/src/backend/access/hash/hash.c
index f565cfc77a8..d4e3b4c54a3 100644
--- a/src/backend/access/hash/hash.c
+++ b/src/backend/access/hash/hash.c
@@ -619,7 +619,7 @@ loop_top:
 		xlrec.ntuples = metap->hashm_ntuples;
 
 		XLogBeginInsert();
-		XLogRegisterData(&xlrec, SizeOfHashUpdateMetaPage);
+		XLogRegisterData(&xlrec, sizeof(xl_hash_update_meta_page));
 
 		XLogRegisterBuffer(0, metabuf, REGBUF_STANDARD);
 
@@ -826,7 +826,7 @@ hashbucketcleanup(Relation rel, Bucket cur_bucket, Buffer bucket_buf,
 				xlrec.is_primary_bucket_page = (buf == bucket_buf);
 
 				XLogBeginInsert();
-				XLogRegisterData(&xlrec, SizeOfHashDelete);
+				XLogRegisterData(&xlrec, sizeof(xl_hash_delete));
 
 				/*
 				 * bucket buffer was not changed, but still needs to be
diff --git a/src/backend/access/hash/hashinsert.c b/src/backend/access/hash/hashinsert.c
index 5ba623393a8..37d6e3a86e4 100644
--- a/src/backend/access/hash/hashinsert.c
+++ b/src/backend/access/hash/hashinsert.c
@@ -221,7 +221,7 @@ restart_insert:
 		xlrec.offnum = itup_off;
 
 		XLogBeginInsert();
-		XLogRegisterData(&xlrec, SizeOfHashInsert);
+		XLogRegisterData(&xlrec, sizeof(xl_hash_insert));
 
 		XLogRegisterBuffer(1, metabuf, REGBUF_STANDARD);
 
diff --git a/src/backend/access/hash/hashovfl.c b/src/backend/access/hash/hashovfl.c
index 69e90ffac5b..89936095eff 100644
--- a/src/backend/access/hash/hashovfl.c
+++ b/src/backend/access/hash/hashovfl.c
@@ -388,7 +388,7 @@ found:
 		xlrec.bmsize = metap->hashm_bmsize;
 
 		XLogBeginInsert();
-		XLogRegisterData(&xlrec, SizeOfHashAddOvflPage);
+		XLogRegisterData(&xlrec, sizeof(xl_hash_add_ovfl_page));
 
 		XLogRegisterBuffer(0, ovflbuf, REGBUF_WILL_INIT);
 		XLogRegisterBufData(0, &pageopaque->hasho_bucket, sizeof(Bucket));
@@ -656,7 +656,7 @@ _hash_freeovflpage(Relation rel, Buffer bucketbuf, Buffer ovflbuf,
 		xlrec.is_prev_bucket_same_wrt = (wbuf == prevbuf);
 
 		XLogBeginInsert();
-		XLogRegisterData(&xlrec, SizeOfHashSqueezePage);
+		XLogRegisterData(&xlrec, sizeof(xl_hash_squeeze_page));
 
 		/*
 		 * bucket buffer was not changed, but still needs to be registered to
@@ -993,7 +993,7 @@ readpage:
 						xlrec.is_prim_bucket_same_wrt = (wbuf == bucket_buf);
 
 						XLogBeginInsert();
-						XLogRegisterData(&xlrec, SizeOfHashMovePageContents);
+						XLogRegisterData(&xlrec, sizeof(xl_hash_move_page_contents));
 
 						/*
 						 * bucket buffer was not changed, but still needs to
diff --git a/src/backend/access/hash/hashpage.c b/src/backend/access/hash/hashpage.c
index 61a0badbfaa..4e766d256f7 100644
--- a/src/backend/access/hash/hashpage.c
+++ b/src/backend/access/hash/hashpage.c
@@ -394,7 +394,7 @@ _hash_init(Relation rel, double num_tuples, ForkNumber forkNum)
 		xlrec.ffactor = metap->hashm_ffactor;
 
 		XLogBeginInsert();
-		XLogRegisterData(&xlrec, SizeOfHashInitMetaPage);
+		XLogRegisterData(&xlrec, sizeof(xl_hash_init_meta_page));
 		XLogRegisterBuffer(0, metabuf, REGBUF_WILL_INIT | REGBUF_STANDARD);
 
 		recptr = XLogInsert(RM_HASH_ID, XLOG_HASH_INIT_META_PAGE);
@@ -468,7 +468,7 @@ _hash_init(Relation rel, double num_tuples, ForkNumber forkNum)
 		xlrec.bmsize = metap->hashm_bmsize;
 
 		XLogBeginInsert();
-		XLogRegisterData(&xlrec, SizeOfHashInitBitmapPage);
+		XLogRegisterData(&xlrec, sizeof(xl_hash_init_bitmap_page));
 		XLogRegisterBuffer(0, bitmapbuf, REGBUF_WILL_INIT);
 
 		/*
@@ -930,7 +930,7 @@ restart_expand:
 								sizeof(uint32));
 		}
 
-		XLogRegisterData(&xlrec, SizeOfHashSplitAllocPage);
+		XLogRegisterData(&xlrec, sizeof(xl_hash_split_allocate_page));
 
 		recptr = XLogInsert(RM_HASH_ID, XLOG_HASH_SPLIT_ALLOCATE_PAGE);
 
@@ -1304,7 +1304,7 @@ _hash_splitbucket(Relation rel,
 
 		XLogBeginInsert();
 
-		XLogRegisterData(&xlrec, SizeOfHashSplitComplete);
+		XLogRegisterData(&xlrec, sizeof(xl_hash_split_complete));
 
 		XLogRegisterBuffer(0, bucket_obuf, REGBUF_STANDARD);
 		XLogRegisterBuffer(1, bucket_nbuf, REGBUF_STANDARD);
diff --git a/src/backend/access/heap/heapam.c b/src/backend/access/heap/heapam.c
index c8b1ef7d372..4d43b33daea 100644
--- a/src/backend/access/heap/heapam.c
+++ b/src/backend/access/heap/heapam.c
@@ -2268,7 +2268,7 @@ heap_insert(Relation relation, HeapTuple tup, CommandId cid,
 		}
 
 		XLogBeginInsert();
-		XLogRegisterData(&xlrec, SizeOfHeapInsert);
+		XLogRegisterData(&xlrec, sizeof(xl_heap_insert));
 
 		xlhdr.t_infomask2 = heaptup->t_data->t_infomask2;
 		xlhdr.t_infomask = heaptup->t_data->t_infomask;
@@ -2280,7 +2280,7 @@ heap_insert(Relation relation, HeapTuple tup, CommandId cid,
 		 * xl_heap_header in the xlog.
 		 */
 		XLogRegisterBuffer(0, buffer, REGBUF_STANDARD | bufflags);
-		XLogRegisterBufData(0, &xlhdr, SizeOfHeapHeader);
+		XLogRegisterBufData(0, &xlhdr, sizeof(xl_heap_header));
 		/* PG73FORMAT: write bitmap [+ padding] [+ oid] + data */
 		XLogRegisterBufData(0,
 							(char *) heaptup->t_data + SizeofHeapTupleHeader,
@@ -2655,7 +2655,7 @@ heap_multi_insert(Relation relation, TupleTableSlot **slots, int ntuples,
 					xlrec->offsets[i] = ItemPointerGetOffsetNumber(&heaptup->t_self);
 				/* xl_multi_insert_tuple needs two-byte alignment. */
 				tuphdr = (xl_multi_insert_tuple *) SHORTALIGN(scratchptr);
-				scratchptr = ((char *) tuphdr) + SizeOfMultiInsertTuple;
+				scratchptr = ((char *) tuphdr) + sizeof(xl_multi_insert_tuple);
 
 				tuphdr->t_infomask2 = heaptup->t_data->t_infomask2;
 				tuphdr->t_infomask = heaptup->t_data->t_infomask;
@@ -3179,7 +3179,7 @@ l1:
 		}
 
 		XLogBeginInsert();
-		XLogRegisterData(&xlrec, SizeOfHeapDelete);
+		XLogRegisterData(&xlrec, sizeof(xl_heap_delete));
 
 		XLogRegisterBuffer(0, buffer, REGBUF_STANDARD);
 
@@ -3192,7 +3192,7 @@ l1:
 			xlhdr.t_infomask = old_key_tuple->t_data->t_infomask;
 			xlhdr.t_hoff = old_key_tuple->t_data->t_hoff;
 
-			XLogRegisterData(&xlhdr, SizeOfHeapHeader);
+			XLogRegisterData(&xlhdr, sizeof(xl_heap_header));
 			XLogRegisterData((char *) old_key_tuple->t_data
 							 + SizeofHeapTupleHeader,
 							 old_key_tuple->t_len
@@ -3960,7 +3960,7 @@ l2:
 												  oldtup.t_data->t_infomask2);
 			xlrec.flags =
 				cleared_all_frozen ? XLH_LOCK_ALL_FROZEN_CLEARED : 0;
-			XLogRegisterData(&xlrec, SizeOfHeapLock);
+			XLogRegisterData(&xlrec, sizeof(xl_heap_lock));
 			recptr = XLogInsert(RM_HEAP_ID, XLOG_HEAP_LOCK);
 			PageSetLSN(page, recptr);
 		}
@@ -5294,7 +5294,7 @@ failed:
 		xlrec.infobits_set = compute_infobits(new_infomask,
 											  tuple->t_data->t_infomask2);
 		xlrec.flags = cleared_all_frozen ? XLH_LOCK_ALL_FROZEN_CLEARED : 0;
-		XLogRegisterData(&xlrec, SizeOfHeapLock);
+		XLogRegisterData(&xlrec, sizeof(xl_heap_lock));
 
 		/* we don't decode row locks atm, so no need to log the origin */
 
@@ -6047,7 +6047,7 @@ l4:
 			xlrec.flags =
 				cleared_all_frozen ? XLH_LOCK_ALL_FROZEN_CLEARED : 0;
 
-			XLogRegisterData(&xlrec, SizeOfHeapLockUpdated);
+			XLogRegisterData(&xlrec, sizeof(xl_heap_lock_updated));
 
 			recptr = XLogInsert(RM_HEAP2_ID, XLOG_HEAP2_LOCK_UPDATED);
 
@@ -6211,7 +6211,7 @@ heap_finish_speculative(Relation relation, const ItemPointerData *tid)
 		/* We want the same filtering on this as on a plain insert */
 		XLogSetRecordFlags(XLOG_INCLUDE_ORIGIN);
 
-		XLogRegisterData(&xlrec, SizeOfHeapConfirm);
+		XLogRegisterData(&xlrec, sizeof(xl_heap_confirm));
 		XLogRegisterBuffer(0, buffer, REGBUF_STANDARD);
 
 		recptr = XLogInsert(RM_HEAP_ID, XLOG_HEAP_CONFIRM);
@@ -6356,7 +6356,7 @@ heap_abort_speculative(Relation relation, const ItemPointerData *tid)
 		xlrec.xmax = xid;
 
 		XLogBeginInsert();
-		XLogRegisterData(&xlrec, SizeOfHeapDelete);
+		XLogRegisterData(&xlrec, sizeof(xl_heap_delete));
 		XLogRegisterBuffer(0, buffer, REGBUF_STANDARD);
 
 		/* No replica identity & replication origin logged */
@@ -8896,7 +8896,7 @@ log_heap_visible(Relation rel, Buffer heap_buffer, Buffer vm_buffer,
 	if (RelationIsAccessibleInLogicalDecoding(rel))
 		xlrec.flags |= VISIBILITYMAP_XLOG_CATALOG_REL;
 	XLogBeginInsert();
-	XLogRegisterData(&xlrec, SizeOfHeapVisible);
+	XLogRegisterData(&xlrec, sizeof(xl_heap_visible));
 
 	XLogRegisterBuffer(0, vm_buffer, 0);
 
@@ -9047,7 +9047,7 @@ log_heap_update(Relation reln, Buffer oldbuf,
 	if (oldbuf != newbuf)
 		XLogRegisterBuffer(1, oldbuf, REGBUF_STANDARD);
 
-	XLogRegisterData(&xlrec, SizeOfHeapUpdate);
+	XLogRegisterData(&xlrec, sizeof(xl_heap_update));
 
 	/*
 	 * Prepare WAL data for the new tuple.
@@ -9080,7 +9080,7 @@ log_heap_update(Relation reln, Buffer oldbuf,
 	 *
 	 * The 'data' doesn't include the common prefix or suffix.
 	 */
-	XLogRegisterBufData(0, &xlhdr, SizeOfHeapHeader);
+	XLogRegisterBufData(0, &xlhdr, sizeof(xl_heap_header));
 	if (prefixlen == 0)
 	{
 		XLogRegisterBufData(0,
@@ -9115,7 +9115,7 @@ log_heap_update(Relation reln, Buffer oldbuf,
 		xlhdr_idx.t_infomask = old_key_tuple->t_data->t_infomask;
 		xlhdr_idx.t_hoff = old_key_tuple->t_data->t_hoff;
 
-		XLogRegisterData(&xlhdr_idx, SizeOfHeapHeader);
+		XLogRegisterData(&xlhdr_idx, sizeof(xl_heap_header));
 
 		/* PG73FORMAT: write bitmap [+ padding] [+ oid] + data */
 		XLogRegisterData((char *) old_key_tuple->t_data + SizeofHeapTupleHeader,
@@ -9195,7 +9195,7 @@ log_heap_new_cid(Relation relation, HeapTuple tup)
 	 * called us certainly did, but that's WAL-logged separately.
 	 */
 	XLogBeginInsert();
-	XLogRegisterData(&xlrec, SizeOfHeapNewCid);
+	XLogRegisterData(&xlrec, sizeof(xl_heap_new_cid));
 
 	/* will be looked at irrespective of origin */
 
diff --git a/src/backend/access/heap/heapam_xlog.c b/src/backend/access/heap/heapam_xlog.c
index 46fc689302d..ec901460191 100644
--- a/src/backend/access/heap/heapam_xlog.c
+++ b/src/backend/access/heap/heapam_xlog.c
@@ -40,8 +40,8 @@ heap_xlog_prune_freeze(XLogReaderState *record)
 	Size		freespace = 0;
 
 	XLogRecGetBlockTag(record, 0, &rlocator, NULL, &blkno);
-	memcpy(&xlrec, maindataptr, SizeOfHeapPrune);
-	maindataptr += SizeOfHeapPrune;
+	memcpy(&xlrec, maindataptr, sizeof(xl_heap_prune));
+	maindataptr += sizeof(xl_heap_prune);
 
 	/*
 	 * We will take an ordinary exclusive lock or a cleanup lock depending on
@@ -559,10 +559,10 @@ heap_xlog_insert(XLogReaderState *record)
 
 		data = XLogRecGetBlockData(record, 0, &datalen);
 
-		newlen = datalen - SizeOfHeapHeader;
-		Assert(datalen > SizeOfHeapHeader && newlen <= MaxHeapTupleSize);
-		memcpy(&xlhdr, data, SizeOfHeapHeader);
-		data += SizeOfHeapHeader;
+		newlen = datalen - sizeof(xl_heap_header);
+		Assert(datalen > sizeof(xl_heap_header) && newlen <= MaxHeapTupleSize);
+		memcpy(&xlhdr, data, sizeof(xl_heap_header));
+		data += sizeof(xl_heap_header);
 
 		htup = &tbuf.hdr;
 		MemSet(htup, 0, SizeofHeapTupleHeader);
@@ -697,7 +697,7 @@ heap_xlog_multi_insert(XLogReaderState *record)
 				elog(PANIC, "invalid max offset number");
 
 			xlhdr = (xl_multi_insert_tuple *) SHORTALIGN(tupdata);
-			tupdata = ((char *) xlhdr) + SizeOfMultiInsertTuple;
+			tupdata = ((char *) xlhdr) + sizeof(xl_multi_insert_tuple);
 
 			newlen = xlhdr->datalen;
 			Assert(newlen <= MaxHeapTupleSize);
@@ -978,8 +978,8 @@ heap_xlog_update(XLogReaderState *record, bool hot_update)
 			recdata += sizeof(uint16);
 		}
 
-		memcpy(&xlhdr, recdata, SizeOfHeapHeader);
-		recdata += SizeOfHeapHeader;
+		memcpy(&xlhdr, recdata, sizeof(xl_heap_header));
+		recdata += sizeof(xl_heap_header);
 
 		tuplen = recdata_end - recdata;
 		Assert(tuplen <= MaxHeapTupleSize);
diff --git a/src/backend/access/heap/pruneheap.c b/src/backend/access/heap/pruneheap.c
index d609b63ef97..962ab79f62c 100644
--- a/src/backend/access/heap/pruneheap.c
+++ b/src/backend/access/heap/pruneheap.c
@@ -2291,7 +2291,7 @@ log_heap_prune_and_freeze(Relation relation, Buffer buffer,
 		Assert(nredirected == 0 && ndead == 0);
 		/* also, any items in 'unused' must've been LP_DEAD previously */
 	}
-	XLogRegisterData(&xlrec, SizeOfHeapPrune);
+	XLogRegisterData(&xlrec, sizeof(xl_heap_prune));
 	if (TransactionIdIsValid(conflict_xid))
 		XLogRegisterData(&conflict_xid, sizeof(TransactionId));
 
diff --git a/src/backend/access/nbtree/nbtdedup.c b/src/backend/access/nbtree/nbtdedup.c
index e20590a5547..6a5b15e6ee2 100644
--- a/src/backend/access/nbtree/nbtdedup.c
+++ b/src/backend/access/nbtree/nbtdedup.c
@@ -252,7 +252,7 @@ _bt_dedup_pass(Relation rel, Buffer buf, IndexTuple newitem, Size newitemsz,
 
 		XLogBeginInsert();
 		XLogRegisterBuffer(0, buf, REGBUF_STANDARD);
-		XLogRegisterData(&xlrec_dedup, SizeOfBtreeDedup);
+		XLogRegisterData(&xlrec_dedup, sizeof(xl_btree_dedup));
 
 		/*
 		 * The intervals array is not in the buffer, but pretend that it is.
diff --git a/src/backend/access/nbtree/nbtinsert.c b/src/backend/access/nbtree/nbtinsert.c
index 71a62b06692..fd2c374cd6d 100644
--- a/src/backend/access/nbtree/nbtinsert.c
+++ b/src/backend/access/nbtree/nbtinsert.c
@@ -1328,7 +1328,7 @@ _bt_insertonpg(Relation rel,
 			xlrec.offnum = newitemoff;
 
 			XLogBeginInsert();
-			XLogRegisterData(&xlrec, SizeOfBtreeInsert);
+			XLogRegisterData(&xlrec, sizeof(xl_btree_insert));
 
 			if (isleaf && postingoff == 0)
 			{
@@ -1994,7 +1994,7 @@ _bt_split(Relation rel, Relation heaprel, BTScanInsert itup_key, Buffer buf,
 			xlrec.postingoff = postingoff;
 
 		XLogBeginInsert();
-		XLogRegisterData(&xlrec, SizeOfBtreeSplit);
+		XLogRegisterData(&xlrec, sizeof(xl_btree_split));
 
 		XLogRegisterBuffer(0, buf, REGBUF_STANDARD);
 		XLogRegisterBuffer(1, rbuf, REGBUF_WILL_INIT);
@@ -2578,7 +2578,7 @@ _bt_newlevel(Relation rel, Relation heaprel, Buffer lbuf, Buffer rbuf)
 		xlrec.level = metad->btm_level;
 
 		XLogBeginInsert();
-		XLogRegisterData(&xlrec, SizeOfBtreeNewroot);
+		XLogRegisterData(&xlrec, sizeof(xl_btree_newroot));
 
 		XLogRegisterBuffer(0, rootbuf, REGBUF_WILL_INIT);
 		XLogRegisterBuffer(1, lbuf, REGBUF_STANDARD);
diff --git a/src/backend/access/nbtree/nbtpage.c b/src/backend/access/nbtree/nbtpage.c
index 80f9ec2c846..40d55834633 100644
--- a/src/backend/access/nbtree/nbtpage.c
+++ b/src/backend/access/nbtree/nbtpage.c
@@ -494,7 +494,7 @@ _bt_getroot(Relation rel, Relation heaprel, int access)
 			xlrec.rootblk = rootblkno;
 			xlrec.level = 0;
 
-			XLogRegisterData(&xlrec, SizeOfBtreeNewroot);
+			XLogRegisterData(&xlrec, sizeof(xl_btree_newroot));
 
 			recptr = XLogInsert(RM_BTREE_ID, XLOG_BTREE_NEWROOT);
 
@@ -949,7 +949,7 @@ _bt_allocbuf(Relation rel, Relation heaprel)
 						RelationIsAccessibleInLogicalDecoding(heaprel);
 
 					XLogBeginInsert();
-					XLogRegisterData(&xlrec_reuse, SizeOfBtreeReusePage);
+					XLogRegisterData(&xlrec_reuse, sizeof(xl_btree_reuse_page));
 
 					XLogInsert(RM_BTREE_ID, XLOG_BTREE_REUSE_PAGE);
 				}
@@ -1234,7 +1234,7 @@ _bt_delitems_vacuum(Relation rel, Buffer buf,
 
 		XLogBeginInsert();
 		XLogRegisterBuffer(0, buf, REGBUF_STANDARD);
-		XLogRegisterData(&xlrec_vacuum, SizeOfBtreeVacuum);
+		XLogRegisterData(&xlrec_vacuum, sizeof(xl_btree_vacuum));
 
 		if (ndeletable > 0)
 			XLogRegisterBufData(0, deletable,
@@ -1352,7 +1352,7 @@ _bt_delitems_delete(Relation rel, Buffer buf,
 
 		XLogBeginInsert();
 		XLogRegisterBuffer(0, buf, REGBUF_STANDARD);
-		XLogRegisterData(&xlrec_delete, SizeOfBtreeDelete);
+		XLogRegisterData(&xlrec_delete, sizeof(xl_btree_delete));
 
 		if (ndeletable > 0)
 			XLogRegisterBufData(0, deletable,
@@ -1420,7 +1420,7 @@ _bt_delitems_update(BTVacuumPosting *updatable, int nupdatable,
 		_bt_update_posting(vacposting);
 
 		/* Keep track of size of xl_btree_update for updatedbuf in passing */
-		itemsz = SizeOfBtreeUpdate + vacposting->ndeletedtids * sizeof(uint16);
+		itemsz = sizeof(xl_btree_update) + vacposting->ndeletedtids * sizeof(uint16);
 		buflen += itemsz;
 
 		/* Build updatedoffsets buffer in passing */
@@ -1443,8 +1443,8 @@ _bt_delitems_update(BTVacuumPosting *updatable, int nupdatable,
 
 			update.ndeletedtids = vacposting->ndeletedtids;
 			memcpy(updatedbuf + offset, &update.ndeletedtids,
-				   SizeOfBtreeUpdate);
-			offset += SizeOfBtreeUpdate;
+				   sizeof(xl_btree_update));
+			offset += sizeof(xl_btree_update);
 
 			itemsz = update.ndeletedtids * sizeof(uint16);
 			memcpy(updatedbuf + offset, vacposting->deletetids, itemsz);
@@ -2271,7 +2271,7 @@ _bt_mark_page_halfdead(Relation rel, Relation heaprel, Buffer leafbuf,
 		xlrec.leftblk = opaque->btpo_prev;
 		xlrec.rightblk = opaque->btpo_next;
 
-		XLogRegisterData(&xlrec, SizeOfBtreeMarkPageHalfDead);
+		XLogRegisterData(&xlrec, sizeof(xl_btree_mark_page_halfdead));
 
 		recptr = XLogInsert(RM_BTREE_ID, XLOG_BTREE_MARK_PAGE_HALFDEAD);
 
@@ -2698,7 +2698,7 @@ _bt_unlink_halfdead_page(Relation rel, Buffer leafbuf, BlockNumber scanblkno,
 		xlrec.leafrightsib = leafrightsib;
 		xlrec.leaftopparent = leaftopparent;
 
-		XLogRegisterData(&xlrec, SizeOfBtreeUnlinkPage);
+		XLogRegisterData(&xlrec, sizeof(xl_btree_unlink_page));
 
 		if (BufferIsValid(metabuf))
 		{
diff --git a/src/backend/access/nbtree/nbtxlog.c b/src/backend/access/nbtree/nbtxlog.c
index dff7d286fc8..62221d424bd 100644
--- a/src/backend/access/nbtree/nbtxlog.c
+++ b/src/backend/access/nbtree/nbtxlog.c
@@ -562,7 +562,7 @@ btree_xlog_updates(Page page, OffsetNumber *updatedoffsets,
 		vacposting->itup = origtuple;
 		vacposting->ndeletedtids = updates->ndeletedtids;
 		memcpy(vacposting->deletetids,
-			   (char *) updates + SizeOfBtreeUpdate,
+			   (char *) updates + sizeof(xl_btree_update),
 			   updates->ndeletedtids * sizeof(uint16));
 
 		_bt_update_posting(vacposting);
@@ -577,7 +577,7 @@ btree_xlog_updates(Page page, OffsetNumber *updatedoffsets,
 
 		/* advance to next xl_btree_update from array */
 		updates = (xl_btree_update *)
-			((char *) updates + SizeOfBtreeUpdate +
+			((char *) updates + sizeof(xl_btree_update) +
 			 updates->ndeletedtids * sizeof(uint16));
 	}
 }
diff --git a/src/backend/access/rmgrdesc/heapdesc.c b/src/backend/access/rmgrdesc/heapdesc.c
index 02ae91653c1..e8fbf609d3a 100644
--- a/src/backend/access/rmgrdesc/heapdesc.c
+++ b/src/backend/access/rmgrdesc/heapdesc.c
@@ -278,7 +278,7 @@ heap2_desc(StringInfo buf, XLogReaderState *record)
 		{
 			TransactionId conflict_xid;
 
-			memcpy(&conflict_xid, rec + SizeOfHeapPrune, sizeof(TransactionId));
+			memcpy(&conflict_xid, rec + sizeof(xl_heap_prune), sizeof(TransactionId));
 
 			appendStringInfo(buf, "snapshotConflictHorizon: %u",
 							 conflict_xid);
diff --git a/src/backend/access/rmgrdesc/nbtdesc.c b/src/backend/access/rmgrdesc/nbtdesc.c
index 1d08f9957bd..00799a5f430 100644
--- a/src/backend/access/rmgrdesc/nbtdesc.c
+++ b/src/backend/access/rmgrdesc/nbtdesc.c
@@ -236,7 +236,7 @@ delvacuum_desc(StringInfo buf, char *block_data,
 		{
 			uint16	   *ptid;
 
-			ptid = (uint16 *) ((char *) updates + SizeOfBtreeUpdate) + p;
+			ptid = (uint16 *) ((char *) updates + sizeof(xl_btree_update)) + p;
 			appendStringInfo(buf, "%u", *ptid);
 
 			if (p < updates->ndeletedtids - 1)
@@ -247,7 +247,7 @@ delvacuum_desc(StringInfo buf, char *block_data,
 			appendStringInfoString(buf, ", ");
 
 		updates = (xl_btree_update *)
-			((char *) updates + SizeOfBtreeUpdate +
+			((char *) updates + sizeof(xl_btree_update) +
 			 updates->ndeletedtids * sizeof(uint16));
 	}
 	appendStringInfoChar(buf, ']');
diff --git a/src/backend/access/rmgrdesc/xactdesc.c b/src/backend/access/rmgrdesc/xactdesc.c
index 5e9b08b1dac..0681e557257 100644
--- a/src/backend/access/rmgrdesc/xactdesc.c
+++ b/src/backend/access/rmgrdesc/xactdesc.c
@@ -140,7 +140,7 @@ ParseCommitRecord(uint8 info, xl_xact_commit *xlrec, xl_xact_parsed_commit *pars
 void
 ParseAbortRecord(uint8 info, xl_xact_abort *xlrec, xl_xact_parsed_abort *parsed)
 {
-	char	   *data = ((char *) xlrec) + MinSizeOfXactAbort;
+	char	   *data = ((char *) xlrec) + sizeof(xl_xact_abort);
 
 	memset(parsed, 0, sizeof(*parsed));
 
diff --git a/src/backend/access/transam/commit_ts.c b/src/backend/access/transam/commit_ts.c
index 55349042ed7..aaed461c9d5 100644
--- a/src/backend/access/transam/commit_ts.c
+++ b/src/backend/access/transam/commit_ts.c
@@ -972,7 +972,7 @@ WriteTruncateXlogRec(int64 pageno, TransactionId oldestXid)
 	xlrec.oldestXid = oldestXid;
 
 	XLogBeginInsert();
-	XLogRegisterData(&xlrec, SizeOfCommitTsTruncate);
+	XLogRegisterData(&xlrec, sizeof(xl_commit_ts_truncate));
 	(void) XLogInsert(RM_COMMIT_TS_ID, COMMIT_TS_TRUNCATE);
 }
 
diff --git a/src/backend/access/transam/multixact.c b/src/backend/access/transam/multixact.c
index a005bbed209..f6577650056 100644
--- a/src/backend/access/transam/multixact.c
+++ b/src/backend/access/transam/multixact.c
@@ -2803,7 +2803,7 @@ WriteMTruncateXlogRec(Oid oldestMultiDB,
 	xlrec.oldestOffset = oldestOffset;
 
 	XLogBeginInsert();
-	XLogRegisterData(&xlrec, SizeOfMultiXactTruncate);
+	XLogRegisterData(&xlrec, sizeof(xl_multixact_truncate));
 	recptr = XLogInsert(RM_MULTIXACT_ID, XLOG_MULTIXACT_TRUNCATE_ID);
 	XLogFlush(recptr);
 }
@@ -2868,7 +2868,7 @@ multixact_redo(XLogReaderState *record)
 		int64		pageno;
 
 		memcpy(&xlrec, XLogRecGetData(record),
-			   SizeOfMultiXactTruncate);
+			   sizeof(xl_multixact_truncate));
 
 		elog(DEBUG1, "replaying multixact truncation: "
 			 "oldestMulti %u (offsets segment %" PRIx64 "), "
diff --git a/src/backend/access/transam/xact.c b/src/backend/access/transam/xact.c
index df72a2566e6..97500b82ddd 100644
--- a/src/backend/access/transam/xact.c
+++ b/src/backend/access/transam/xact.c
@@ -6096,7 +6096,7 @@ XactLogAbortRecord(TimestampTz abort_time,
 
 	XLogBeginInsert();
 
-	XLogRegisterData(&xlrec, MinSizeOfXactAbort);
+	XLogRegisterData(&xlrec, sizeof(xl_xact_abort));
 
 	if (xl_xinfo.xinfo != 0)
 		XLogRegisterData(&xl_xinfo, sizeof(xl_xinfo));
diff --git a/src/backend/access/transam/xloginsert.c b/src/backend/access/transam/xloginsert.c
index d1b6fbea81c..3c857b24bd9 100644
--- a/src/backend/access/transam/xloginsert.c
+++ b/src/backend/access/transam/xloginsert.c
@@ -838,8 +838,8 @@ XLogRecordAssemble(RmgrId rmid, uint8 info,
 		prev_regbuf = regbuf;
 
 		/* Ok, copy the header to the scratch buffer */
-		memcpy(scratch, &bkpb, SizeOfXLogRecordBlockHeader);
-		scratch += SizeOfXLogRecordBlockHeader;
+		memcpy(scratch, &bkpb, sizeof(XLogRecordBlockHeader));
+		scratch += sizeof(XLogRecordBlockHeader);
 		if (include_image)
 		{
 			memcpy(scratch, &bimg, SizeOfXLogRecordBlockImageHeader);
diff --git a/src/backend/replication/logical/decode.c b/src/backend/replication/logical/decode.c
index 867cf9d0158..c2a7c1594b1 100644
--- a/src/backend/replication/logical/decode.c
+++ b/src/backend/replication/logical/decode.c
@@ -923,7 +923,7 @@ DecodeInsert(LogicalDecodingContext *ctx, XLogRecordBuffer *buf)
 	memcpy(&change->data.tp.rlocator, &target_locator, sizeof(RelFileLocator));
 
 	tupledata = XLogRecGetBlockData(r, 0, &datalen);
-	tuplelen = datalen - SizeOfHeapHeader;
+	tuplelen = datalen - sizeof(xl_heap_header);
 
 	change->data.tp.newtuple =
 		ReorderBufferAllocTupleBuf(ctx->reorder, tuplelen);
@@ -975,7 +975,7 @@ DecodeUpdate(LogicalDecodingContext *ctx, XLogRecordBuffer *buf)
 
 		data = XLogRecGetBlockData(r, 0, &datalen);
 
-		tuplelen = datalen - SizeOfHeapHeader;
+		tuplelen = datalen - sizeof(xl_heap_header);
 
 		change->data.tp.newtuple =
 			ReorderBufferAllocTupleBuf(ctx->reorder, tuplelen);
@@ -989,9 +989,9 @@ DecodeUpdate(LogicalDecodingContext *ctx, XLogRecordBuffer *buf)
 		Size		tuplelen;
 
 		/* caution, remaining data in record is not aligned */
-		data = XLogRecGetData(r) + SizeOfHeapUpdate;
-		datalen = XLogRecGetDataLen(r) - SizeOfHeapUpdate;
-		tuplelen = datalen - SizeOfHeapHeader;
+		data = XLogRecGetData(r) + sizeof(xl_heap_update);
+		datalen = XLogRecGetDataLen(r) - sizeof(xl_heap_update);
+		tuplelen = datalen - sizeof(xl_heap_header);
 
 		change->data.tp.oldtuple =
 			ReorderBufferAllocTupleBuf(ctx->reorder, tuplelen);
@@ -1043,15 +1043,15 @@ DecodeDelete(LogicalDecodingContext *ctx, XLogRecordBuffer *buf)
 	/* old primary key stored */
 	if (xlrec->flags & XLH_DELETE_CONTAINS_OLD)
 	{
-		Size		datalen = XLogRecGetDataLen(r) - SizeOfHeapDelete;
-		Size		tuplelen = datalen - SizeOfHeapHeader;
+		Size		datalen = XLogRecGetDataLen(r) - sizeof(xl_heap_delete);
+		Size		tuplelen = datalen - sizeof(xl_heap_header);
 
-		Assert(XLogRecGetDataLen(r) > (SizeOfHeapDelete + SizeOfHeapHeader));
+		Assert(XLogRecGetDataLen(r) > (sizeof(xl_heap_delete) + sizeof(xl_heap_header)));
 
 		change->data.tp.oldtuple =
 			ReorderBufferAllocTupleBuf(ctx->reorder, tuplelen);
 
-		DecodeXLogTuple((char *) xlrec + SizeOfHeapDelete,
+		DecodeXLogTuple((char *) xlrec + sizeof(xl_heap_delete),
 						datalen, change->data.tp.oldtuple);
 	}
 
@@ -1154,7 +1154,7 @@ DecodeMultiInsert(LogicalDecodingContext *ctx, XLogRecordBuffer *buf)
 		memcpy(&change->data.tp.rlocator, &rlocator, sizeof(RelFileLocator));
 
 		xlhdr = (xl_multi_insert_tuple *) SHORTALIGN(data);
-		data = ((char *) xlhdr) + SizeOfMultiInsertTuple;
+		data = ((char *) xlhdr) + sizeof(xl_multi_insert_tuple);
 		datalen = xlhdr->datalen;
 
 		change->data.tp.newtuple =
@@ -1246,7 +1246,7 @@ static void
 DecodeXLogTuple(char *data, Size len, HeapTuple tuple)
 {
 	xl_heap_header xlhdr = {0};
-	int			datalen = len - SizeOfHeapHeader;
+	int			datalen = len - sizeof(xl_heap_header);
 	HeapTupleHeader header;
 
 	Assert(datalen >= 0);
@@ -1261,12 +1261,12 @@ DecodeXLogTuple(char *data, Size len, HeapTuple tuple)
 	tuple->t_tableOid = InvalidOid;
 
 	/* data is not stored aligned, copy to aligned storage */
-	memcpy(&xlhdr, data, SizeOfHeapHeader);
+	memcpy(&xlhdr, data, sizeof(xl_heap_header));
 
 	memset(header, 0, SizeofHeapTupleHeader);
 
 	memcpy(((char *) tuple->t_data) + SizeofHeapTupleHeader,
-		   data + SizeOfHeapHeader,
+		   data + sizeof(xl_heap_header),
 		   datalen);
 
 	header->t_infomask = xlhdr.t_infomask;
diff --git a/src/include/access/brin_xlog.h b/src/include/access/brin_xlog.h
index b22137970d3..56c22be801a 100644
--- a/src/include/access/brin_xlog.h
+++ b/src/include/access/brin_xlog.h
@@ -53,7 +53,6 @@ typedef struct PG_NO_PADDING xl_brin_createidx
 	uint16		version;
 	pg_padding_2(pg_pad);
 } xl_brin_createidx;
-#define SizeOfBrinCreateIdx (sizeof(xl_brin_createidx))
 
 /*
  * This is what we need to know about a BRIN tuple insert
@@ -73,7 +72,6 @@ typedef struct PG_NO_PADDING xl_brin_insert
 	pg_padding_2(pg_pad);
 } xl_brin_insert;
 
-#define SizeOfBrinInsert	(sizeof(xl_brin_insert))
 
 /*
  * A cross-page update is the same as an insert, but also stores information
@@ -95,7 +93,6 @@ typedef struct PG_NO_PADDING xl_brin_update
 	xl_brin_insert insert;
 } xl_brin_update;
 
-#define SizeOfBrinUpdate	(sizeof(xl_brin_update))
 
 /*
  * This is what we need to know about a BRIN tuple samepage update
@@ -107,7 +104,6 @@ typedef struct PG_NO_PADDING xl_brin_samepage_update
 	OffsetNumber offnum;
 } xl_brin_samepage_update;
 
-#define SizeOfBrinSamepageUpdate	(sizeof(xl_brin_samepage_update))
 
 /*
  * This is what we need to know about a revmap extension
@@ -124,7 +120,6 @@ typedef struct PG_NO_PADDING xl_brin_revmap_extend
 	BlockNumber targetBlk;
 } xl_brin_revmap_extend;
 
-#define SizeOfBrinRevmapExtend	(sizeof(xl_brin_revmap_extend))
 
 /*
  * This is what we need to know about a range de-summarization
@@ -142,7 +137,6 @@ typedef struct PG_NO_PADDING xl_brin_desummarize
 	pg_padding_2(pg_pad);
 } xl_brin_desummarize;
 
-#define SizeOfBrinDesummarize	(sizeof(xl_brin_desummarize))
 
 
 extern void brin_redo(XLogReaderState *record);
diff --git a/src/include/access/commit_ts.h b/src/include/access/commit_ts.h
index 92e50b0c806..bd4358f8a5f 100644
--- a/src/include/access/commit_ts.h
+++ b/src/include/access/commit_ts.h
@@ -53,7 +53,6 @@ typedef struct PG_NO_PADDING xl_commit_ts_truncate
 	pg_padding_4(pg_pad);
 } xl_commit_ts_truncate;
 
-#define SizeOfCommitTsTruncate	(sizeof(xl_commit_ts_truncate))
 
 extern void commit_ts_redo(XLogReaderState *record);
 extern void commit_ts_desc(StringInfo buf, XLogReaderState *record);
diff --git a/src/include/access/gistxlog.h b/src/include/access/gistxlog.h
index f19d4e8dfe6..81af9dfb6cb 100644
--- a/src/include/access/gistxlog.h
+++ b/src/include/access/gistxlog.h
@@ -97,7 +97,6 @@ typedef struct PG_NO_PADDING gistxlogPageDelete
 	pg_padding_4(pg_pad2);
 } gistxlogPageDelete;
 
-#define SizeOfGistxlogPageDelete	(sizeof(gistxlogPageDelete))
 
 
 /*
@@ -115,7 +114,6 @@ typedef struct PG_NO_PADDING gistxlogPageReuse
 	pg_padding_4(pg_pad4);
 } gistxlogPageReuse;
 
-#define SizeOfGistxlogPageReuse	(sizeof(gistxlogPageReuse))
 
 extern void gist_redo(XLogReaderState *record);
 extern void gist_desc(StringInfo buf, XLogReaderState *record);
diff --git a/src/include/access/hash_xlog.h b/src/include/access/hash_xlog.h
index bb6b9d0fe11..665fbbeb80a 100644
--- a/src/include/access/hash_xlog.h
+++ b/src/include/access/hash_xlog.h
@@ -64,7 +64,6 @@ typedef struct PG_NO_PADDING xl_hash_insert
 	OffsetNumber offnum;
 } xl_hash_insert;
 
-#define SizeOfHashInsert	(sizeof(xl_hash_insert))
 
 /*
  * This is what we need to know about addition of overflow page.
@@ -84,7 +83,6 @@ typedef struct PG_NO_PADDING xl_hash_add_ovfl_page
 	pg_padding_1(pg_pad);
 } xl_hash_add_ovfl_page;
 
-#define SizeOfHashAddOvflPage	(sizeof(xl_hash_add_ovfl_page))
 
 /*
  * This is what we need to know about allocating a page for split.
@@ -105,7 +103,6 @@ typedef struct PG_NO_PADDING xl_hash_split_allocate_page
 	pg_padding_2(pg_pad2);
 } xl_hash_split_allocate_page;
 
-#define SizeOfHashSplitAllocPage	(sizeof(xl_hash_split_allocate_page))
 
 /*
  * This is what we need to know about completing the split operation.
@@ -121,7 +118,6 @@ typedef struct PG_NO_PADDING xl_hash_split_complete
 	uint16		new_bucket_flag;
 } xl_hash_split_complete;
 
-#define SizeOfHashSplitComplete	(sizeof(xl_hash_split_complete))
 
 /*
  * This is what we need to know about move page contents required during
@@ -142,7 +138,6 @@ typedef struct PG_NO_PADDING xl_hash_move_page_contents
 	pg_padding_1(pg_pad);
 } xl_hash_move_page_contents;
 
-#define SizeOfHashMovePageContents	(sizeof(xl_hash_move_page_contents))
 
 /*
  * This is what we need to know about the squeeze page operation.
@@ -171,7 +166,6 @@ typedef struct PG_NO_PADDING xl_hash_squeeze_page
 											 * page */
 } xl_hash_squeeze_page;
 
-#define SizeOfHashSqueezePage	(sizeof(xl_hash_squeeze_page))
 
 /*
  * This is what we need to know about the deletion of index tuples from a page.
@@ -189,7 +183,6 @@ typedef struct PG_NO_PADDING xl_hash_delete
 										 * primary bucket page */
 } xl_hash_delete;
 
-#define SizeOfHashDelete	(sizeof(xl_hash_delete))
 
 /*
  * This is what we need for metapage update operation.
@@ -203,7 +196,6 @@ typedef struct PG_NO_PADDING xl_hash_update_meta_page
 	double		ntuples;
 } xl_hash_update_meta_page;
 
-#define SizeOfHashUpdateMetaPage	(sizeof(xl_hash_update_meta_page))
 
 /*
  * This is what we need to initialize metapage.
@@ -220,7 +212,6 @@ typedef struct PG_NO_PADDING xl_hash_init_meta_page
 	pg_padding_2(pg_pad);
 } xl_hash_init_meta_page;
 
-#define SizeOfHashInitMetaPage	(sizeof(xl_hash_init_meta_page))
 
 /*
  * This is what we need to initialize bitmap page.
@@ -235,7 +226,6 @@ typedef struct PG_NO_PADDING xl_hash_init_bitmap_page
 	uint16		bmsize;
 } xl_hash_init_bitmap_page;
 
-#define SizeOfHashInitBitmapPage	(sizeof(xl_hash_init_bitmap_page))
 
 /*
  * This is what we need for index tuple deletion and to
diff --git a/src/include/access/heapam_xlog.h b/src/include/access/heapam_xlog.h
index 74a3803ad14..ad8316fda2b 100644
--- a/src/include/access/heapam_xlog.h
+++ b/src/include/access/heapam_xlog.h
@@ -118,7 +118,6 @@ typedef struct PG_NO_PADDING xl_heap_delete
 	uint8		flags;
 } xl_heap_delete;
 
-#define SizeOfHeapDelete	sizeof(xl_heap_delete)
 
 /*
  * xl_heap_truncate flag values, 8 bits are available.
@@ -157,7 +156,6 @@ typedef struct PG_NO_PADDING xl_heap_header
 	pg_padding_1(pg_pad);
 } xl_heap_header;
 
-#define SizeOfHeapHeader	sizeof(xl_heap_header)
 
 /* This is what we need to know about insert */
 typedef struct PG_NO_PADDING xl_heap_insert
@@ -169,7 +167,6 @@ typedef struct PG_NO_PADDING xl_heap_insert
 	/* xl_heap_header & TUPLE DATA in backup block 0 */
 } xl_heap_insert;
 
-#define SizeOfHeapInsert	sizeof(xl_heap_insert)
 
 /*
  * This is what we need to know about a multi-insert.
@@ -202,7 +199,6 @@ typedef struct PG_NO_PADDING xl_multi_insert_tuple
 	/* TUPLE DATA FOLLOWS AT END OF STRUCT */
 } xl_multi_insert_tuple;
 
-#define SizeOfMultiInsertTuple	sizeof(xl_multi_insert_tuple)
 
 /*
  * This is what we need to know about update|hot_update
@@ -237,7 +233,6 @@ typedef struct PG_NO_PADDING xl_heap_update
 	 */
 } xl_heap_update;
 
-#define SizeOfHeapUpdate	sizeof(xl_heap_update)
 
 /*
  * These structures and flags encode VACUUM pruning and freezing and on-access
@@ -299,7 +294,6 @@ typedef struct PG_NO_PADDING xl_heap_prune
 	 */
 } xl_heap_prune;
 
-#define SizeOfHeapPrune sizeof(xl_heap_prune)
 
 /* to handle recovery conflict during logical decoding on standby */
 #define		XLHP_IS_CATALOG_REL			(1 << 1)
@@ -418,7 +412,6 @@ typedef struct PG_NO_PADDING xl_heap_lock
 	uint8		flags;			/* XLH_LOCK_* flag bits */
 } xl_heap_lock;
 
-#define SizeOfHeapLock	sizeof(xl_heap_lock)
 
 /* This is what we need to know about locking an updated version of a row */
 typedef struct PG_NO_PADDING xl_heap_lock_updated
@@ -429,7 +422,6 @@ typedef struct PG_NO_PADDING xl_heap_lock_updated
 	uint8		flags;
 } xl_heap_lock_updated;
 
-#define SizeOfHeapLockUpdated	sizeof(xl_heap_lock_updated)
 
 /* This is what we need to know about confirmation of speculative insertion */
 typedef struct PG_NO_PADDING xl_heap_confirm
@@ -437,7 +429,6 @@ typedef struct PG_NO_PADDING xl_heap_confirm
 	OffsetNumber offnum;		/* confirmed tuple's offset on page */
 } xl_heap_confirm;
 
-#define SizeOfHeapConfirm	sizeof(xl_heap_confirm)
 
 /* This is what we need to know about in-place update */
 typedef struct PG_NO_PADDING xl_heap_inplace
@@ -469,7 +460,6 @@ typedef struct PG_NO_PADDING xl_heap_visible
 	pg_padding_2(pg_pad2);
 } xl_heap_visible;
 
-#define SizeOfHeapVisible sizeof(xl_heap_visible)
 
 typedef struct PG_NO_PADDING xl_heap_new_cid
 {
@@ -490,7 +480,6 @@ typedef struct PG_NO_PADDING xl_heap_new_cid
 	pg_padding_2(pg_pad);
 } xl_heap_new_cid;
 
-#define SizeOfHeapNewCid sizeof(xl_heap_new_cid)
 
 /* logical rewrite xlog record header */
 typedef struct PG_NO_PADDING xl_heap_rewrite_mapping
diff --git a/src/include/access/multixact.h b/src/include/access/multixact.h
index 3fe4501d27f..06aa4632760 100644
--- a/src/include/access/multixact.h
+++ b/src/include/access/multixact.h
@@ -92,7 +92,6 @@ typedef struct PG_NO_PADDING xl_multixact_truncate
 	MultiXactOffset oldestOffset;
 } xl_multixact_truncate;
 
-#define SizeOfMultiXactTruncate (sizeof(xl_multixact_truncate))
 
 
 extern MultiXactId MultiXactIdCreate(TransactionId xid1,
diff --git a/src/include/access/nbtxlog.h b/src/include/access/nbtxlog.h
index 8918d675dce..1a6cfd3dfbf 100644
--- a/src/include/access/nbtxlog.h
+++ b/src/include/access/nbtxlog.h
@@ -86,7 +86,6 @@ typedef struct PG_NO_PADDING xl_btree_insert
 	/* NEW TUPLE ALWAYS FOLLOWS AT THE END */
 } xl_btree_insert;
 
-#define SizeOfBtreeInsert	sizeof(xl_btree_insert)
 
 /*
  * On insert with split, we save all the items going into the right sibling
@@ -161,7 +160,6 @@ typedef struct PG_NO_PADDING xl_btree_split
 	pg_padding_2(pg_pad);
 } xl_btree_split;
 
-#define SizeOfBtreeSplit	sizeof(xl_btree_split)
 
 /*
  * When page is deduplicated, consecutive groups of tuples with equal keys are
@@ -177,7 +175,6 @@ typedef struct PG_NO_PADDING xl_btree_dedup
 	/* DEDUPLICATION INTERVALS FOLLOW */
 } xl_btree_dedup;
 
-#define SizeOfBtreeDedup	sizeof(xl_btree_dedup)
 
 /*
  * This is what we need to know about page reuse within btree.  This record
@@ -198,7 +195,6 @@ typedef struct PG_NO_PADDING xl_btree_reuse_page
 	pg_padding_4(pg_pad4);
 } xl_btree_reuse_page;
 
-#define SizeOfBtreeReusePage	sizeof(xl_btree_reuse_page)
 
 /*
  * xl_btree_vacuum and xl_btree_delete records describe deletion of index
@@ -240,7 +236,6 @@ typedef struct PG_NO_PADDING xl_btree_vacuum
 	 */
 } xl_btree_vacuum;
 
-#define SizeOfBtreeVacuum	sizeof(xl_btree_vacuum)
 
 typedef struct PG_NO_PADDING xl_btree_delete
 {
@@ -261,7 +256,6 @@ typedef struct PG_NO_PADDING xl_btree_delete
 	 */
 } xl_btree_delete;
 
-#define SizeOfBtreeDelete	sizeof(xl_btree_delete)
 
 /*
  * The offsets that appear in xl_btree_update metadata are offsets into the
@@ -276,7 +270,6 @@ typedef struct PG_NO_PADDING xl_btree_update
 	/* POSTING LIST uint16 OFFSETS TO A DELETED TID FOLLOW */
 } xl_btree_update;
 
-#define SizeOfBtreeUpdate	sizeof(xl_btree_update)
 
 /*
  * This is what we need to know about marking an empty subtree for deletion.
@@ -300,7 +293,6 @@ typedef struct PG_NO_PADDING xl_btree_mark_page_halfdead
 	BlockNumber topparent;		/* topmost internal page in the subtree */
 } xl_btree_mark_page_halfdead;
 
-#define SizeOfBtreeMarkPageHalfDead sizeof(xl_btree_mark_page_halfdead)
 
 /*
  * This is what we need to know about deletion of a btree page.  Note that we
@@ -339,7 +331,6 @@ typedef struct PG_NO_PADDING xl_btree_unlink_page
 	/* xl_btree_metadata FOLLOWS IF XLOG_BTREE_UNLINK_PAGE_META */
 } xl_btree_unlink_page;
 
-#define SizeOfBtreeUnlinkPage	sizeof(xl_btree_unlink_page)
 
 /*
  * New root log record.  There are zero tuples if this is to establish an
@@ -358,7 +349,6 @@ typedef struct PG_NO_PADDING xl_btree_newroot
 	uint32		level;			/* its tree level */
 } xl_btree_newroot;
 
-#define SizeOfBtreeNewroot	sizeof(xl_btree_newroot)
 
 
 /*
diff --git a/src/include/access/xact.h b/src/include/access/xact.h
index d9617b235bd..082e3760cfc 100644
--- a/src/include/access/xact.h
+++ b/src/include/access/xact.h
@@ -348,7 +348,6 @@ typedef struct PG_NO_PADDING xl_xact_abort
 	/* twophase_gid follows if XINFO_HAS_GID. As a null-terminated string. */
 	/* xl_xact_origin follows if XINFO_HAS_ORIGIN, stored unaligned! */
 } xl_xact_abort;
-#define MinSizeOfXactAbort sizeof(xl_xact_abort)
 
 typedef struct xl_xact_prepare
 {
diff --git a/src/include/access/xlogrecord.h b/src/include/access/xlogrecord.h
index 8c74998607d..3da0e3a4078 100644
--- a/src/include/access/xlogrecord.h
+++ b/src/include/access/xlogrecord.h
@@ -112,7 +112,6 @@ typedef struct PG_NO_PADDING XLogRecordBlockHeader
 	/* BlockNumber follows */
 } XLogRecordBlockHeader;
 
-#define SizeOfXLogRecordBlockHeader (sizeof(XLogRecordBlockHeader))
 
 /*
  * Additional header information when a full-page image is included
@@ -184,7 +183,7 @@ typedef struct PG_NO_PADDING XLogRecordBlockCompressHeader
  * temporary buffer for constructing the header.
  */
 #define MaxSizeOfXLogRecordBlockHeader \
-	(SizeOfXLogRecordBlockHeader + \
+	(sizeof(XLogRecordBlockHeader) + \
 	 SizeOfXLogRecordBlockImageHeader + \
 	 SizeOfXLogRecordBlockCompressHeader + \
 	 sizeof(RelFileLocator) + \
-- 
2.43.0

