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/[email protected] Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/e9d723487b262e8d2bb883e4f8e799c3774265c7 Modified Files -------------- src/bin/pg_waldump/archive_waldump.c | 63 +++++++++--------------------------- 1 file changed, 16 insertions(+), 47 deletions(-)
