From c7e71f8c6f76033c4a8b49b5fe47dff46e1da2aa Mon Sep 17 00:00:00 2001 From: shihao zhong Date: Mon, 5 Oct 2026 11:42:14 -0400 Subject: [PATCH v1 1/2] Handle concatenated gzip members in astreamer gzip decompressor With WAL streaming, pg_basebackup -Ft -z writes pg_wal.tar.gz as a series of gzip members. The decompressor did not reset the inflate state when one ended, so inflate() consumed nothing more and the loop never finished. pg_verifybackup and pg_waldump hung on such a backup. Call inflateReset() after each member. --- src/fe_utils/astreamer_gzip.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/fe_utils/astreamer_gzip.c b/src/fe_utils/astreamer_gzip.c index bc3d53076e1..5fdf0e27872 100644 --- a/src/fe_utils/astreamer_gzip.c +++ b/src/fe_utils/astreamer_gzip.c @@ -333,6 +333,14 @@ astreamer_gzip_decompressor_content(astreamer *streamer, mystreamer->base.bbs_buffer.maxlen, context); mystreamer->bytes_written = 0; } + + /* + * The input can be several gzip members one after another, which is + * what pg_basebackup writes for pg_wal.tar.gz. Get ready for the + * next one. + */ + if (res == Z_STREAM_END && inflateReset(zs) != Z_OK) + pg_fatal("could not reset compression stream"); } } -- 2.37.1 (Apple Git-137.1)