On 2026-03-21 Sa 2:34 AM, Tom Lane wrote:
Michael Paquier<[email protected]> writes:
On Fri, Mar 20, 2026 at 11:49:02PM -0400, Tom Lane wrote:
Buildfarm members batta and hachi don't like this very much.
I did not look at what's happening on the host, but it seems like a
safe bet to assume that we are not seeing many failures in the
buildfarm because we don't have many animals that have the idea to add
--with-zstd to their build configuration, like these two ones.
That may be part of the story, but only part. I spent a good deal of
time trying to reproduce batta & hachi's configurations locally, on
several different platforms, but still couldn't duplicate what they
are showing.
Yeah, I haven't been able to reproduce it either. But while
investigating I found a couple of issues. We neglected to add one of the
tests to meson.build, and we neglected to close some files, causing
errors on windows.
I also noticed a possible bug in astreamer, where the decompressor
finalize functions send bbs_buffer.maxlen bytes to the next streamer
when flushing remaining data at end-of-stream. This seems wrong because
the buffer may only be partially filled with valid decompressed data.
Possible patch for that attached. (But I don't think it's related to
these failures).
cheers
andrew
--
Andrew Dunstan
EDB:https://www.enterprisedb.com
diff --git a/src/bin/pg_waldump/archive_waldump.c b/src/bin/pg_waldump/archive_waldump.c
index b078c2d6960..023a549ae9e 100644
--- a/src/bin/pg_waldump/archive_waldump.c
+++ b/src/bin/pg_waldump/archive_waldump.c
@@ -474,7 +474,11 @@ get_archive_wal_entry(const char *fname, XLogDumpPrivate *privateInfo)
entry = ArchivedWAL_lookup(privateInfo->archive_wal_htab, fname);
if (entry != NULL)
+ {
+ if (write_fp != NULL)
+ fclose(write_fp);
return entry;
+ }
/*
* Capture the current entry before calling read_archive_file(),
diff --git a/src/bin/pg_waldump/meson.build b/src/bin/pg_waldump/meson.build
index 5296f21b82c..d2b4bd0c048 100644
--- a/src/bin/pg_waldump/meson.build
+++ b/src/bin/pg_waldump/meson.build
@@ -34,6 +34,7 @@ tests += {
'tests': [
't/001_basic.pl',
't/002_save_fullpage.pl',
+ 't/003_archive.pl',
],
},
}
--
2.43.0
diff --git a/src/fe_utils/astreamer_gzip.c b/src/fe_utils/astreamer_gzip.c
index 2e080c37a58..df392f67cab 100644
--- a/src/fe_utils/astreamer_gzip.c
+++ b/src/fe_utils/astreamer_gzip.c
@@ -347,10 +347,11 @@ astreamer_gzip_decompressor_finalize(astreamer *streamer)
* End of the stream, if there is some pending data in output buffers then
* we must forward it to next streamer.
*/
- astreamer_content(mystreamer->base.bbs_next, NULL,
- mystreamer->base.bbs_buffer.data,
- mystreamer->base.bbs_buffer.maxlen,
- ASTREAMER_UNKNOWN);
+ if (mystreamer->bytes_written > 0)
+ astreamer_content(mystreamer->base.bbs_next, NULL,
+ mystreamer->base.bbs_buffer.data,
+ mystreamer->bytes_written,
+ ASTREAMER_UNKNOWN);
astreamer_finalize(mystreamer->base.bbs_next);
}
diff --git a/src/fe_utils/astreamer_lz4.c b/src/fe_utils/astreamer_lz4.c
index 2bc32b42879..605c188007b 100644
--- a/src/fe_utils/astreamer_lz4.c
+++ b/src/fe_utils/astreamer_lz4.c
@@ -397,10 +397,11 @@ astreamer_lz4_decompressor_finalize(astreamer *streamer)
* End of the stream, if there is some pending data in output buffers then
* we must forward it to next streamer.
*/
- astreamer_content(mystreamer->base.bbs_next, NULL,
- mystreamer->base.bbs_buffer.data,
- mystreamer->base.bbs_buffer.maxlen,
- ASTREAMER_UNKNOWN);
+ if (mystreamer->bytes_written > 0)
+ astreamer_content(mystreamer->base.bbs_next, NULL,
+ mystreamer->base.bbs_buffer.data,
+ mystreamer->bytes_written,
+ ASTREAMER_UNKNOWN);
astreamer_finalize(mystreamer->base.bbs_next);
}
diff --git a/src/fe_utils/astreamer_zstd.c b/src/fe_utils/astreamer_zstd.c
index f26abcfd0fa..4b43ab795e3 100644
--- a/src/fe_utils/astreamer_zstd.c
+++ b/src/fe_utils/astreamer_zstd.c
@@ -347,7 +347,7 @@ astreamer_zstd_decompressor_finalize(astreamer *streamer)
if (mystreamer->zstd_outBuf.pos > 0)
astreamer_content(mystreamer->base.bbs_next, NULL,
mystreamer->base.bbs_buffer.data,
- mystreamer->base.bbs_buffer.maxlen,
+ mystreamer->zstd_outBuf.pos,
ASTREAMER_UNKNOWN);
astreamer_finalize(mystreamer->base.bbs_next);
--
2.43.0