pgsql: Fix misuse of simplehash.h hash operations in pg_waldump. - Mailing list pgsql-committers

From Tom Lane
Subject pgsql: Fix misuse of simplehash.h hash operations in pg_waldump.
Date
Msg-id E1w5Wr5-001Rpc-2f@gemulon.postgresql.org
Whole thread Raw
List 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(+)


pgsql-committers by date:

Previous
From: Masahiko Sawada
Date:
Subject: pgsql: Add base32hex support to encode() and decode() functions.
Next
From: Tom Lane
Date:
Subject: pgsql: Remove a low-value, high-risk optimization in pg_waldump.