| From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
|---|---|
| To: | Andrew Dunstan <andrew(at)dunslane(dot)net> |
| Cc: | Michael Paquier <michael(at)paquier(dot)xyz>, Amul Sul <sulamul(at)gmail(dot)com>, Zsolt Parragi <zsolt(dot)parragi(at)percona(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>, Jakub Wartak <jakub(dot)wartak(at)enterprisedb(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
| Subject: | Re: pg_waldump: support decoding of WAL inside tarfile |
| Date: | 2026-03-23 03:02:20 |
| Message-ID: | 3424809.1774234940@sss.pgh.pa.us |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
I wrote:
> Everything's pushed, although it looks like it'll be a few hours
> before we see results from batta or hachi.
batta just went green, so I'm feeling optimistic that we've correctly
diagnosed and fixed the problem.
Meanwhile, I noticed one more thing that could use fixing: while
astreamer_zstd.c is careful to use a reasonably-sized output
bbs_buffer (about 256kB looks like), the decompressors in
astreamer_gzip.c and astreamer_lz4.c just leave bbs_buffer's size
at the default 1kB. This means we're pushing decompressed data
to the next astreamer in very small units in those cases.
I suspect strongly that this difference in buffer sizes has a lot
to do with the observed results that only zstd failed on batta/hachi
while only the other two failed in the test cases that I've been
able to reproduce here. I'm too lazy to try to run that to ground
though, especially since it's mostly moot now. But I think that
on performance grounds, we ought to use a reasonable buffer size
for all three decompressors.
I also noticed that astreamer_zstd.c was using ZSTD_DStreamOutSize()
as the target buffer size for both compression and decompression,
although the libzstd API provides a separate function
ZSTD_CStreamOutSize() for the compression case. Those two functions
produce the same result (256K) on my machine, so this seems to be just
a cosmetic issue, but it still seems pretty tin-eared to not use the
functions as specified.
Proposed patch attached. There might be an argument for using some
other size than 256K for the other two decompressors, but my
inclination is to try to make all three use roughly the same block
size. (See also 66ec01dc4.)
regards, tom lane
| Attachment | Content-Type | Size |
|---|---|---|
| v1-fix-astreamer-buffer-sizes.patch | text/x-diff | 1.7 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | shveta malik | 2026-03-23 03:15:51 | Re: [Proposal] Adding Log File Capability to pg_createsubscriber |
| Previous Message | Chao Li | 2026-03-23 02:48:25 | Re: Use-after-free issue in postgres_fdw |