Remove a low-value, high-risk optimization in pg_waldump.
Tom Lane <tgl@sss.pgh.pa.us>
Remove a low-value, high-risk optimization in pg_waldump. The code removed here deleted already-used data from a partially-read WAL segment's hashtable entry. The intent was evidently to try to keep the entry's memory consumption below the WAL segment's total size, but we don't use WAL segments that are so large as to make that a big win. The important memory-space optimization is to remove hashtable entries altogether when done with them, and that's handled elsewhere. To buy that, we must accept a substantially more complex (and under-documented) logical invariant about what is in entry->buf, as well as complex and under-documented interactions with the entry spilling logic, various re-checking code paths in xlogreader.c, and pg_waldump's overall data processing order. Any of those aspects could have bugs lurking still, and are quite likely to be prone to new bugs after future code changes. Given the number of bugs we've already found in commit b15c15139, I judge that simplifying anything we possibly can is a good decision. While here, revise and extend some related comments. Discussion: https://postgr.es/m/374225.1774459521@sss.pgh.pa.us
Files
| Path | Change | +/− |
|---|---|---|
| src/bin/pg_waldump/archive_waldump.c | modified | +16 −47 |
Discussion
- pg_waldump: support decoding of WAL inside tarfile 126 messages · 2025-08-07 → 2026-04-15