From e9d1e4dcbf17200f34cdb857c7961fb0df1e8435 Mon Sep 17 00:00:00 2001
From: Tomas Vondra <tomas@2ndquadrant.com>
Date: Mon, 13 Mar 2023 20:42:21 +0100
Subject: [PATCH 3/4] questions

---
 src/bin/pg_dump/compress_io.h  | 1 +
 src/bin/pg_dump/compress_lz4.c | 6 ++++++
 2 files changed, 7 insertions(+)

diff --git a/src/bin/pg_dump/compress_io.h b/src/bin/pg_dump/compress_io.h
index cdb15951ea..ae32a4de1c 100644
--- a/src/bin/pg_dump/compress_io.h
+++ b/src/bin/pg_dump/compress_io.h
@@ -18,6 +18,7 @@
 #include "pg_backup_archiver.h"
 
 /* Initial buffer sizes used in zlib compression. */
+/* XXX shouldn't this be moved to compress_gzip.c? */
 #define ZLIB_OUT_SIZE	4096
 #define ZLIB_IN_SIZE	4096
 
diff --git a/src/bin/pg_dump/compress_lz4.c b/src/bin/pg_dump/compress_lz4.c
index 9ab57ceff3..94f28d6806 100644
--- a/src/bin/pg_dump/compress_lz4.c
+++ b/src/bin/pg_dump/compress_lz4.c
@@ -20,6 +20,8 @@
 #include <lz4.h>
 #include <lz4frame.h>
 
+/* Initial buffer sizes used in zlib compression. */
+/* XXX Why is this different from GZIP values? That uses 4kB for both. */
 #define LZ4_OUT_SIZE	(4 * 1024)
 #define LZ4_IN_SIZE		(16 * 1024)
 
@@ -207,6 +209,10 @@ LZ4File_init(LZ4File *fs, int size, bool compressing)
 	if (fs->compressing)
 	{
 		fs->buflen = LZ4F_compressBound(LZ4_IN_SIZE, &fs->prefs);
+		/*
+		 * XXX Does this actually do something meaningful? With LZ4_IN_SIZE=16kB
+		 * I get buflen=143600 (roughly), so can it ever be smaller than 22?
+		 */
 		if (fs->buflen < LZ4F_HEADER_SIZE_MAX)
 			fs->buflen = LZ4F_HEADER_SIZE_MAX;
 
-- 
2.39.2

