pgsql: Remove a low-value, high-risk optimization in pg_waldump. - Mailing list pgsql-committers

From Tom Lane
Subject pgsql: Remove a low-value, high-risk optimization in pg_waldump.
Date
Msg-id E1w5XSH-001S48-2P@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
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

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(-)


pgsql-committers by date:

Previous
From: Tom Lane
Date:
Subject: pgsql: Fix misuse of simplehash.h hash operations in pg_waldump.
Next
From: Michael Paquier
Date:
Subject: pgsql: Improve timeout handling of pg_promote()