v4-0011-pgindent.patch

text/x-patch

Filename: v4-0011-pgindent.patch
Type: text/x-patch
Part: 10
Message: Re: Compress ReorderBuffer spill files using LZ4

Patch

Format: format-patch
Series: patch v4-0011
Subject: pgindent
File+
src/backend/replication/logical/reorderbuffer.c 5 6
src/backend/replication/logical/reorderbuffer_compression.c 147 138
src/backend/replication/logical/worker.c 2 2
src/include/replication/reorderbuffer_compression.h 7 5
src/tools/pgindent/typedefs.list 5 0
From db7367f9fe2bf1072793fedbb749422e4977b5e0 Mon Sep 17 00:00:00 2001
From: Tomas Vondra <tomas@vondra.me>
Date: Tue, 17 Sep 2024 17:23:26 +0200
Subject: [PATCH v4 11/11] pgindent

---
 .../replication/logical/reorderbuffer.c       |  11 +-
 .../logical/reorderbuffer_compression.c       | 285 +++++++++---------
 src/backend/replication/logical/worker.c      |   4 +-
 .../replication/reorderbuffer_compression.h   |  12 +-
 src/tools/pgindent/typedefs.list              |   5 +
 5 files changed, 166 insertions(+), 151 deletions(-)

diff --git a/src/backend/replication/logical/reorderbuffer.c b/src/backend/replication/logical/reorderbuffer.c
index 6545c310f7f..1b6ddecb83e 100644
--- a/src/backend/replication/logical/reorderbuffer.c
+++ b/src/backend/replication/logical/reorderbuffer.c
@@ -257,7 +257,7 @@ static Size ReorderBufferSerializeChange(ReorderBuffer *rb, ReorderBufferTXN *tx
 static Size ReorderBufferRestoreChanges(ReorderBuffer *rb, ReorderBufferTXN *txn,
 										TXNEntryFile *file, XLogSegNo *segno);
 static bool ReorderBufferReadOndiskChange(ReorderBuffer *rb, ReorderBufferTXN *txn,
-								   TXNEntryFile *file, XLogSegNo *segno);
+										  TXNEntryFile *file, XLogSegNo *segno);
 static void ReorderBufferRestoreChange(ReorderBuffer *rb, ReorderBufferTXN *txn,
 									   char *data);
 static void ReorderBufferRestoreCleanup(ReorderBuffer *rb, ReorderBufferTXN *txn);
@@ -3833,7 +3833,7 @@ ReorderBufferSerializeChange(ReorderBuffer *rb, ReorderBufferTXN *txn,
 	ReorderBufferSerializeReserve(rb, sz);
 
 	disk_hdr = (ReorderBufferDiskHeader *) rb->outbuf;
-	memcpy((char *)rb->outbuf + sizeof(ReorderBufferDiskHeader), change, sizeof(ReorderBufferChange));
+	memcpy((char *) rb->outbuf + sizeof(ReorderBufferDiskHeader), change, sizeof(ReorderBufferChange));
 
 	switch (change->action)
 	{
@@ -4345,9 +4345,8 @@ ReorderBufferRestoreChanges(ReorderBuffer *rb, ReorderBufferTXN *txn,
 		}
 
 		/*
-		 * Read the full change from disk.
-		 * If ReorderBufferReadOndiskChange returns false, then we are at the
-		 * eof, so, move the next segment.
+		 * Read the full change from disk. If ReorderBufferReadOndiskChange
+		 * returns false, then we are at the eof, so, move the next segment.
 		 */
 		if (!ReorderBufferReadOndiskChange(rb, txn, file, segno))
 		{
@@ -4375,7 +4374,7 @@ ReorderBufferReadOndiskChange(ReorderBuffer *rb, ReorderBufferTXN *txn,
 {
 	int			readBytes;
 	ReorderBufferDiskHeader *disk_hdr;
-	char	   *header;			/* disk header buffer*/
+	char	   *header;			/* disk header buffer */
 	char	   *data;			/* data buffer */
 
 	/*
diff --git a/src/backend/replication/logical/reorderbuffer_compression.c b/src/backend/replication/logical/reorderbuffer_compression.c
index 707f35cff7c..6d19c60b601 100644
--- a/src/backend/replication/logical/reorderbuffer_compression.c
+++ b/src/backend/replication/logical/reorderbuffer_compression.c
@@ -158,9 +158,9 @@ lz4_StreamingCompressData(MemoryContext context, char *src, Size src_size,
 #else
 	LZ4StreamingCompressorState *cstate;
 	int			lz4_cmp_size = 0;	/* compressed size */
-	char	   *buf;				/* buffer used for compression */
-	Size		buf_size;			/* buffer size */
-	char	   *lz4_in_bufPtr;		/* input ring buffer pointer */
+	char	   *buf;			/* buffer used for compression */
+	Size		buf_size;		/* buffer size */
+	char	   *lz4_in_bufPtr;	/* input ring buffer pointer */
 
 	cstate = (LZ4StreamingCompressorState *) compressor_state;
 
@@ -204,14 +204,14 @@ lz4_StreamingCompressData(MemoryContext context, char *src, Size src_size,
  * Data compression using LZ4 API.
  */
 static void
-lz4_CompressData(char *src, Size src_size, char **dst,  Size *dst_size)
+lz4_CompressData(char *src, Size src_size, char **dst, Size *dst_size)
 {
 #ifndef USE_LZ4
 	NO_LZ4_SUPPORT();
 #else
 	int			lz4_cmp_size = 0;	/* compressed size */
-	char	   *buf;				/* buffer used for compression */
-	Size		buf_size;			/* buffer size */
+	char	   *buf;			/* buffer used for compression */
+	Size		buf_size;		/* buffer size */
 
 	buf_size = LZ4_COMPRESSBOUND(src_size);
 	buf = (char *) palloc0(buf_size);
@@ -243,8 +243,8 @@ lz4_StreamingDecompressData(MemoryContext context, char *src, Size src_size,
 	NO_LZ4_SUPPORT();
 #else
 	LZ4StreamingCompressorState *cstate;
-	char	   *lz4_out_bufPtr;		/* output ring buffer pointer */
-	int			lz4_dec_size;		/* decompressed data size */
+	char	   *lz4_out_bufPtr; /* output ring buffer pointer */
+	int			lz4_dec_size;	/* decompressed data size */
 
 	cstate = (LZ4StreamingCompressorState *) compressor_state;
 
@@ -273,8 +273,8 @@ lz4_StreamingDecompressData(MemoryContext context, char *src, Size src_size,
 				 errmsg_internal("compressed LZ4 data is corrupted")));
 	else if (lz4_dec_size != dst_size)
 		ereport(ERROR,
-			(errcode(ERRCODE_DATA_CORRUPTED),
-			 errmsg_internal("decompressed LZ4 data size differs from original size")));
+				(errcode(ERRCODE_DATA_CORRUPTED),
+				 errmsg_internal("decompressed LZ4 data size differs from original size")));
 
 	/* Move the output ring buffer offset */
 	cstate->lz4_out_buf_offset += lz4_dec_size;
@@ -334,8 +334,8 @@ zstd_NewCompressorState(MemoryContext context)
 
 	/*
 	 * We do not allocate ZSTD buffers and contexts at this point because we
-	 * have no guarantee that we will need them later. Let's allocate only when
-	 * we are about to use them.
+	 * have no guarantee that we will need them later. Let's allocate only
+	 * when we are about to use them.
 	 */
 	cstate->zstd_c_ctx = NULL;
 	cstate->zstd_c_in_buf = NULL;
@@ -461,6 +461,7 @@ zstd_StreamingCompressData(MemoryContext context, char *src, Size src_size,
 	NO_ZSTD_SUPPORT();
 #else
 	ZSTDStreamingCompressorState *cstate;
+
 	/* Size of remaining data to be copied from src into ZSTD input buffer */
 	Size		toCpy = src_size;
 	char	   *dst_data;
@@ -479,16 +480,16 @@ zstd_StreamingCompressData(MemoryContext context, char *src, Size src_size,
 	/*
 	 * ZSTD streaming compression works with chunks: the source data needs to
 	 * be splitted out in chunks, each of them is then copied into ZSTD input
-	 * buffer.
-	 * For each chunk, we proceed with compression. Streaming compression is
-	 * not intended to compress the whole input chunk, so we have the call
-	 * ZSTD_compressStream2() multiple times until the entire chunk is
-	 * consumed.
+	 * buffer. For each chunk, we proceed with compression. Streaming
+	 * compression is not intended to compress the whole input chunk, so we
+	 * have the call ZSTD_compressStream2() multiple times until the entire
+	 * chunk is consumed.
 	 */
 	while (toCpy > 0)
 	{
 		/* Are we on the last chunk? */
 		bool		last_chunk = (toCpy < cstate->zstd_c_in_buf_size);
+
 		/* Size of the data copied into ZSTD input buffer */
 		Size		cpySize = last_chunk ? toCpy : cstate->zstd_c_in_buf_size;
 		bool		finished = false;
@@ -556,12 +557,13 @@ zstd_StreamingCompressData(MemoryContext context, char *src, Size src_size,
  */
 static void
 zstd_StreamingDecompressData(MemoryContext context, char *src, Size src_size,
-							char **dst, Size dst_size, void *compressor_state)
+							 char **dst, Size dst_size, void *compressor_state)
 {
 #ifndef USE_ZSTD
 	NO_ZSTD_SUPPORT();
 #else
 	ZSTDStreamingCompressorState *cstate;
+
 	/* Size of remaining data to be copied from src into ZSTD input buffer */
 	Size		toCpy = src_size;
 	char	   *dst_data;
@@ -598,7 +600,7 @@ zstd_StreamingDecompressData(MemoryContext context, char *src, Size src_size,
 			output.size = cstate->zstd_d_out_buf_size;
 			output.pos = 0;
 
-			ret = ZSTD_decompressStream(cstate->zstd_d_ctx, &output , &input);
+			ret = ZSTD_decompressStream(cstate->zstd_d_ctx, &output, &input);
 
 			if (ZSTD_isError(ret))
 				ereport(ERROR,
@@ -691,145 +693,148 @@ ReorderBufferCompress(ReorderBuffer *rb, ReorderBufferDiskHeader **header,
 
 	switch (compression_method)
 	{
-		/* No compression */
+			/* No compression */
 		case REORDER_BUFFER_NO_COMPRESSION:
-		{
-			hdr->comp_strat = REORDER_BUFFER_STRAT_UNCOMPRESSED;
-			hdr->size = data_size;
-			hdr->raw_size = data_size - sizeof(ReorderBufferDiskHeader);
-
-			break;
-		}
-		/* LZ4 Compression */
-		case REORDER_BUFFER_LZ4_COMPRESSION:
-		{
-			/*
-			 * XXX Won't this cause a lot of palloc/pfree traffic? We allocate a new
-			 * buffer for every compression, only to immediately throw it away. Look
-			 * at what astreamer_lz4_compressor_content does to reuse a buffer, maybe
-			 * we should do that here too?
-			 */
-			char	   *dst = NULL;
-			Size		dst_size = 0;
-			char	   *src = (char *) rb->outbuf + sizeof(ReorderBufferDiskHeader);
-			Size		src_size = data_size - sizeof(ReorderBufferDiskHeader);
-			ReorderBufferCompressionStrategy strat;
-
-			if (lz4_CanDoStreamingCompression(src_size))
 			{
-				/* Use LZ4 streaming compression if possible */
-				lz4_StreamingCompressData(rb->context, src, src_size, &dst,
-										  &dst_size, compressor_state);
-				strat = REORDER_BUFFER_STRAT_LZ4_STREAMING;
+				hdr->comp_strat = REORDER_BUFFER_STRAT_UNCOMPRESSED;
+				hdr->size = data_size;
+				hdr->raw_size = data_size - sizeof(ReorderBufferDiskHeader);
+
+				break;
 			}
-			else
+			/* LZ4 Compression */
+		case REORDER_BUFFER_LZ4_COMPRESSION:
 			{
-				/* Fallback to LZ4 regular compression */
-				lz4_CompressData(src, src_size, &dst, &dst_size);
-				strat = REORDER_BUFFER_STRAT_LZ4_REGULAR;
-			}
+				/*
+				 * XXX Won't this cause a lot of palloc/pfree traffic? We
+				 * allocate a new buffer for every compression, only to
+				 * immediately throw it away. Look at what
+				 * astreamer_lz4_compressor_content does to reuse a buffer,
+				 * maybe we should do that here too?
+				 */
+				char	   *dst = NULL;
+				Size		dst_size = 0;
+				char	   *src = (char *) rb->outbuf + sizeof(ReorderBufferDiskHeader);
+				Size		src_size = data_size - sizeof(ReorderBufferDiskHeader);
+				ReorderBufferCompressionStrategy strat;
+
+				if (lz4_CanDoStreamingCompression(src_size))
+				{
+					/* Use LZ4 streaming compression if possible */
+					lz4_StreamingCompressData(rb->context, src, src_size, &dst,
+											  &dst_size, compressor_state);
+					strat = REORDER_BUFFER_STRAT_LZ4_STREAMING;
+				}
+				else
+				{
+					/* Fallback to LZ4 regular compression */
+					lz4_CompressData(src, src_size, &dst, &dst_size);
+					strat = REORDER_BUFFER_STRAT_LZ4_REGULAR;
+				}
 
-			/*
-			 * Make sure the ReorderBuffer has enough space to store compressed
-			 * data. Compressed data must be smaller than raw data, so, the
-			 * ReorderBuffer should already have room for compressed data, but
-			 * we do this to avoid buffer overflow risks.
-			 */
-			ReorderBufferReserve(rb, (dst_size + sizeof(ReorderBufferDiskHeader)));
+				/*
+				 * Make sure the ReorderBuffer has enough space to store
+				 * compressed data. Compressed data must be smaller than raw
+				 * data, so, the ReorderBuffer should already have room for
+				 * compressed data, but we do this to avoid buffer overflow
+				 * risks.
+				 */
+				ReorderBufferReserve(rb, (dst_size + sizeof(ReorderBufferDiskHeader)));
 
-			hdr = (ReorderBufferDiskHeader *) rb->outbuf;
-			hdr->comp_strat = strat;
-			hdr->size = dst_size + sizeof(ReorderBufferDiskHeader);
-			hdr->raw_size = src_size;
+				hdr = (ReorderBufferDiskHeader *) rb->outbuf;
+				hdr->comp_strat = strat;
+				hdr->size = dst_size + sizeof(ReorderBufferDiskHeader);
+				hdr->raw_size = src_size;
 
-			/*
-			 * Update header: hdr pointer has potentially changed due to
-			 * ReorderBufferReserve()
-			 */
-			*header = hdr;
+				/*
+				 * Update header: hdr pointer has potentially changed due to
+				 * ReorderBufferReserve()
+				 */
+				*header = hdr;
 
-			/* Copy back compressed data into the ReorderBuffer */
-			memcpy((char *) rb->outbuf + sizeof(ReorderBufferDiskHeader), dst,
-				   dst_size);
+				/* Copy back compressed data into the ReorderBuffer */
+				memcpy((char *) rb->outbuf + sizeof(ReorderBufferDiskHeader), dst,
+					   dst_size);
 
-			pfree(dst);
+				pfree(dst);
+
+				break;
+			}
+			/* PGLZ compression */
 
-			break;
-		}
-		/* PGLZ compression */
-		/*
-		 * XXX I'd probably start by adding pglz first, and only then add lz4 as a
-		 * separate patch, simply because pglz is the default and always supported,
-		 * while lz4 requires extra flags.
-		 */
-		case REORDER_BUFFER_PGLZ_COMPRESSION:
-		{
 			/*
-			 * XXX Same comment about palloc/pfree traffic as for lz4 ...
+			 * XXX I'd probably start by adding pglz first, and only then add
+			 * lz4 as a separate patch, simply because pglz is the default and
+			 * always supported, while lz4 requires extra flags.
 			 */
-			int32		dst_size = 0;
-			char	   *dst = NULL;
-			char	   *src = (char *) rb->outbuf + sizeof(ReorderBufferDiskHeader);
-			int32		src_size = data_size - sizeof(ReorderBufferDiskHeader);
-			int32		max_size = PGLZ_MAX_OUTPUT(src_size);
+		case REORDER_BUFFER_PGLZ_COMPRESSION:
+			{
+				/*
+				 * XXX Same comment about palloc/pfree traffic as for lz4 ...
+				 */
+				int32		dst_size = 0;
+				char	   *dst = NULL;
+				char	   *src = (char *) rb->outbuf + sizeof(ReorderBufferDiskHeader);
+				int32		src_size = data_size - sizeof(ReorderBufferDiskHeader);
+				int32		max_size = PGLZ_MAX_OUTPUT(src_size);
 
-			dst = (char *) palloc0(max_size);
-			dst_size = pglz_compress(src, src_size, dst, PGLZ_strategy_always);
+				dst = (char *) palloc0(max_size);
+				dst_size = pglz_compress(src, src_size, dst, PGLZ_strategy_always);
 
-			if (dst_size < 0)
-				ereport(ERROR,
-						(errcode(ERRCODE_DATA_CORRUPTED),
-						 errmsg_internal("PGLZ compression failed")));
+				if (dst_size < 0)
+					ereport(ERROR,
+							(errcode(ERRCODE_DATA_CORRUPTED),
+							 errmsg_internal("PGLZ compression failed")));
 
-			ReorderBufferReserve(rb, (Size) (dst_size + sizeof(ReorderBufferDiskHeader)));
+				ReorderBufferReserve(rb, (Size) (dst_size + sizeof(ReorderBufferDiskHeader)));
 
-			hdr = (ReorderBufferDiskHeader *) rb->outbuf;
-			hdr->comp_strat = REORDER_BUFFER_STRAT_PGLZ;
-			hdr->size = (Size) dst_size + sizeof(ReorderBufferDiskHeader);
-			hdr->raw_size = (Size) src_size;
+				hdr = (ReorderBufferDiskHeader *) rb->outbuf;
+				hdr->comp_strat = REORDER_BUFFER_STRAT_PGLZ;
+				hdr->size = (Size) dst_size + sizeof(ReorderBufferDiskHeader);
+				hdr->raw_size = (Size) src_size;
 
-			*header = hdr;
+				*header = hdr;
 
-			/* Copy back compressed data into the ReorderBuffer */
-			memcpy((char *) rb->outbuf + sizeof(ReorderBufferDiskHeader), dst,
-				   dst_size);
+				/* Copy back compressed data into the ReorderBuffer */
+				memcpy((char *) rb->outbuf + sizeof(ReorderBufferDiskHeader), dst,
+					   dst_size);
 
-			pfree(dst);
+				pfree(dst);
 
-			break;
-		}
-		/* ZSTD Compression */
+				break;
+			}
+			/* ZSTD Compression */
 		case REORDER_BUFFER_ZSTD_COMPRESSION:
-		{
-			/*
-			 * XXX Same comment about palloc/pfree traffic as for lz4 ...
-			 */
-			char	   *dst = NULL;
-			Size		dst_size = 0;
-			char	   *src = (char *) rb->outbuf + sizeof(ReorderBufferDiskHeader);
-			Size		src_size = data_size - sizeof(ReorderBufferDiskHeader);
+			{
+				/*
+				 * XXX Same comment about palloc/pfree traffic as for lz4 ...
+				 */
+				char	   *dst = NULL;
+				Size		dst_size = 0;
+				char	   *src = (char *) rb->outbuf + sizeof(ReorderBufferDiskHeader);
+				Size		src_size = data_size - sizeof(ReorderBufferDiskHeader);
 
-			/* Use ZSTD streaming compression */
-			zstd_StreamingCompressData(rb->context, src, src_size, &dst,
-									   &dst_size, compressor_state);
+				/* Use ZSTD streaming compression */
+				zstd_StreamingCompressData(rb->context, src, src_size, &dst,
+										   &dst_size, compressor_state);
 
-			ReorderBufferReserve(rb, (dst_size + sizeof(ReorderBufferDiskHeader)));
+				ReorderBufferReserve(rb, (dst_size + sizeof(ReorderBufferDiskHeader)));
 
-			hdr = (ReorderBufferDiskHeader *) rb->outbuf;
-			hdr->comp_strat = REORDER_BUFFER_STRAT_ZSTD_STREAMING;
-			hdr->size = dst_size + sizeof(ReorderBufferDiskHeader);
-			hdr->raw_size = src_size;
+				hdr = (ReorderBufferDiskHeader *) rb->outbuf;
+				hdr->comp_strat = REORDER_BUFFER_STRAT_ZSTD_STREAMING;
+				hdr->size = dst_size + sizeof(ReorderBufferDiskHeader);
+				hdr->raw_size = src_size;
 
-			*header = hdr;
+				*header = hdr;
 
-			/* Copy back compressed data into the ReorderBuffer */
-			memcpy((char *) rb->outbuf + sizeof(ReorderBufferDiskHeader), dst,
-				   dst_size);
+				/* Copy back compressed data into the ReorderBuffer */
+				memcpy((char *) rb->outbuf + sizeof(ReorderBufferDiskHeader), dst,
+					   dst_size);
 
-			pfree(dst);
+				pfree(dst);
 
-			break;
-		}
+				break;
+			}
 	}
 }
 
@@ -847,6 +852,7 @@ ReorderBufferDecompress(ReorderBuffer *rb, char *data,
 						ReorderBufferDiskHeader *header, void *compressor_state)
 {
 	Size		raw_outbufsize = header->raw_size + sizeof(ReorderBufferDiskHeader);
+
 	/*
 	 * Make sure the output reorder buffer has enough space to store
 	 * decompressed/raw data.
@@ -862,7 +868,7 @@ ReorderBufferDecompress(ReorderBuffer *rb, char *data,
 
 	switch (header->comp_strat)
 	{
-		/* No decompression */
+			/* No decompression */
 		case REORDER_BUFFER_STRAT_UNCOMPRESSED:
 			{
 				/*
@@ -873,7 +879,7 @@ ReorderBufferDecompress(ReorderBuffer *rb, char *data,
 					   data, header->raw_size);
 				break;
 			}
-		/* LZ4 regular decompression */
+			/* LZ4 regular decompression */
 		case REORDER_BUFFER_STRAT_LZ4_REGULAR:
 			{
 				char	   *buf;
@@ -889,26 +895,28 @@ ReorderBufferDecompress(ReorderBuffer *rb, char *data,
 				pfree(buf);
 				break;
 			}
-		/* LZ4 streaming decompression */
+			/* LZ4 streaming decompression */
 		case REORDER_BUFFER_STRAT_LZ4_STREAMING:
 			{
-				char	   *buf;	/* XXX shouldn't this be set to NULL explicitly? */
+				char	   *buf;	/* XXX shouldn't this be set to NULL
+									 * explicitly? */
 				Size		src_size = header->size - sizeof(ReorderBufferDiskHeader);
 				Size		buf_size = header->raw_size;
 
 				lz4_StreamingDecompressData(rb->context, data, src_size, &buf,
-										   buf_size, compressor_state);
+											buf_size, compressor_state);
 
 				/* Copy decompressed data into the ReorderBuffer */
 				memcpy((char *) rb->outbuf + sizeof(ReorderBufferDiskHeader),
 					   buf, buf_size);
+
 				/*
 				 * Not necessary to free buf in this case: it points to the
 				 * decompressed data stored in LZ4 output ring buffer.
 				 */
 				break;
 			}
-		/* PGLZ decompression */
+			/* PGLZ decompression */
 		case REORDER_BUFFER_STRAT_PGLZ:
 			{
 				char	   *buf;
@@ -928,10 +936,11 @@ ReorderBufferDecompress(ReorderBuffer *rb, char *data,
 							 errmsg_internal("compressed PGLZ data is corrupted")));
 				break;
 			}
-		/* ZSTD streaming decompression */
+			/* ZSTD streaming decompression */
 		case REORDER_BUFFER_STRAT_ZSTD_STREAMING:
 			{
-				char	   *buf;	/* XXX shouldn't this be set to NULL explicitly? */
+				char	   *buf;	/* XXX shouldn't this be set to NULL
+									 * explicitly? */
 				Size		src_size = header->size - sizeof(ReorderBufferDiskHeader);
 				Size		buf_size = header->raw_size;
 
diff --git a/src/backend/replication/logical/worker.c b/src/backend/replication/logical/worker.c
index eb42e844f99..32b38b94dd7 100644
--- a/src/backend/replication/logical/worker.c
+++ b/src/backend/replication/logical/worker.c
@@ -4471,8 +4471,8 @@ set_stream_options(WalRcvStreamOptions *options,
 	}
 
 	if (server_version >= 180000 &&
-			 MySubscription->stream == LOGICALREP_STREAM_OFF &&
-			 MySubscription->spill_compression != NULL)
+		MySubscription->stream == LOGICALREP_STREAM_OFF &&
+		MySubscription->spill_compression != NULL)
 	{
 		options->proto.logical.spill_compression =
 			pstrdup(MySubscription->spill_compression);
diff --git a/src/include/replication/reorderbuffer_compression.h b/src/include/replication/reorderbuffer_compression.h
index f72f0e0fbd7..3f69d2c2610 100644
--- a/src/include/replication/reorderbuffer_compression.h
+++ b/src/include/replication/reorderbuffer_compression.h
@@ -56,9 +56,9 @@ typedef enum ReorderBufferCompressionStrategy
  */
 typedef struct ReorderBufferDiskHeader
 {
-	ReorderBufferCompressionStrategy comp_strat; /* Compression strategy */
-	Size		size;					/* Ondisk size */
-	Size		raw_size;				/* Raw/uncompressed data size */
+	ReorderBufferCompressionStrategy comp_strat;	/* Compression strategy */
+	Size		size;			/* Ondisk size */
+	Size		raw_size;		/* Raw/uncompressed data size */
 	/* ReorderBufferChange + data follows */
 } ReorderBufferDiskHeader;
 
@@ -81,7 +81,8 @@ typedef struct ReorderBufferDiskHeader
  * LZ4 streaming compression/decompression handlers and ring
  * buffers.
  */
-typedef struct LZ4StreamingCompressorState {
+typedef struct LZ4StreamingCompressorState
+{
 	/* Streaming compression handler */
 	LZ4_stream_t *lz4_stream;
 	/* Streaming decompression handler */
@@ -112,7 +113,8 @@ typedef struct LZ4StreamingCompressorState {
 /*
  * ZSTD streaming compression/decompression handlers and buffers.
  */
-typedef struct ZSTDStreamingCompressorState {
+typedef struct ZSTDStreamingCompressorState
+{
 	/* Compression */
 	ZSTD_CCtx  *zstd_c_ctx;
 	Size		zstd_c_in_buf_size;
diff --git a/src/tools/pgindent/typedefs.list b/src/tools/pgindent/typedefs.list
index ace5414fa5b..ea13d621f6c 100644
--- a/src/tools/pgindent/typedefs.list
+++ b/src/tools/pgindent/typedefs.list
@@ -1487,6 +1487,7 @@ LZ4F_decompressionContext_t
 LZ4F_errorCode_t
 LZ4F_preferences_t
 LZ4State
+LZ4StreamingCompressorState
 LabelProvider
 LagTracker
 LargeObjectDesc
@@ -2412,7 +2413,10 @@ ReorderBufferChange
 ReorderBufferChangeType
 ReorderBufferCommitCB
 ReorderBufferCommitPreparedCB
+ReorderBufferCompressionMethod
+ReorderBufferCompressionStrategy
 ReorderBufferDiskChange
+ReorderBufferDiskHeader
 ReorderBufferIterTXNEntry
 ReorderBufferIterTXNState
 ReorderBufferMessageCB
@@ -3247,6 +3251,7 @@ XmlTableBuilderData
 YYLTYPE
 YYSTYPE
 YY_BUFFER_STATE
+ZSTDStreamingCompressorState
 ZSTD_CCtx
 ZSTD_CStream
 ZSTD_DCtx
-- 
2.46.0