pgsql: Fix misuse of simplehash.h hash operations in pg_waldump.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Fix misuse of simplehash.h hash operations in pg_waldump.
Date: 2026-03-25 22:37:40
Message-ID: E1w5Wr5-001Rpc-2f@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix misuse of simplehash.h hash operations in pg_waldump.

Both ArchivedWAL_insert() and ArchivedWAL_delete_item() can cause
existing hashtable entries to move. The code didn't account for this
and could leave privateInfo->cur_file pointing at a dead or incorrect
entry, with hilarity ensuing. Likewise, read_archive_wal_page calls
read_archive_file which could result in movement of the hashtable
entry it is working with.

I believe these bugs explain some odd buildfarm failures, although
the amount of data we use in pg_waldump's TAP tests isn't enough to
trigger them reliably.

This code's all new as of commit b15c15139, so no need for back-patch.

Discussion: https://postgr.es/m/374225.1774459521@sss.pgh.pa.us

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/ff84efe4fdc081545ec68064588dffecfb026527

Modified Files
--------------
src/bin/pg_waldump/archive_waldump.c | 36 ++++++++++++++++++++++++++++++++++++
1 file changed, 36 insertions(+)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2026-03-25 23:16:06 pgsql: Remove a low-value, high-risk optimization in pg_waldump.
Previous Message Masahiko Sawada 2026-03-25 18:36:00 pgsql: Add base32hex support to encode() and decode() functions.