]> git.ipfire.org Git - thirdparty/postgresql.git/commitdiff
Use fake LSNs consistently in hash index AM.
authorPeter Geoghegan <pg@bowt.ie>
Thu, 16 Jul 2026 22:08:41 +0000 (18:08 -0400)
committerPeter Geoghegan <pg@bowt.ie>
Thu, 16 Jul 2026 22:08:41 +0000 (18:08 -0400)
Defensively make sure that all hash index atomic actions use a fake LSN
with an unlogged relation.

Oversight in commit e5836f7b, which added fake LSN support to the hash
index AM, but missed log_split_page.

Author: Peter Geoghegan <pg@bowt.ie>
Reviewed-by: Ewan Young <kdbase.hack@gmail.com>
Discussion: https://postgr.es/m/CAH2-WzkC-opX8iS6X=a470DDC31er_x5rzPw=HjRxha9N8brZw@mail.gmail.com
Backpatch-through: 19

src/backend/access/hash/hashpage.c

index 8099b0d021f05dcd3ef82c1ba4276e77efc6c5f2..c50f9a48520b5e4ccf6077fdce5dd46613c27289 100644 (file)
@@ -1477,18 +1477,20 @@ _hash_finish_split(Relation rel, Buffer metabuf, Buffer obuf, Bucket obucket,
 static void
 log_split_page(Relation rel, Buffer buf)
 {
+       XLogRecPtr      recptr;
+
        if (RelationNeedsWAL(rel))
        {
-               XLogRecPtr      recptr;
-
                XLogBeginInsert();
 
                XLogRegisterBuffer(0, buf, REGBUF_FORCE_IMAGE | REGBUF_STANDARD);
 
                recptr = XLogInsert(RM_HASH_ID, XLOG_HASH_SPLIT_PAGE);
-
-               PageSetLSN(BufferGetPage(buf), recptr);
        }
+       else
+               recptr = XLogGetFakeLSN(rel);
+
+       PageSetLSN(BufferGetPage(buf), recptr);
 }
 
 /*