Re: Fix publisher-side sequence permission reporting

From: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
To: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
Cc: Tristan Partin <tristan(at)partin(dot)io>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Fix publisher-side sequence permission reporting
Date: 2026-06-24 10:30:09
Message-ID: CAHGQGwEcGpnHWw1uwsWkgVwKv5cwysKfir2yXDQnN1aVOAhCdQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Jun 24, 2026 at 5:50 PM Fujii Masao <masao(dot)fujii(at)gmail(dot)com> wrote:
>
> On Wed, Jun 24, 2026 at 4:40 PM Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
> > Assume a case where the primary fails and the system promotes standby
> > as a new primary. Then the subscriber starts sync from the new
> > primary, there it can lead to an unlogged sequence sync scenario?
>
> When I tested pg_get_sequence_data() with an unlogged sequence on
> new primary after promotion, I hit an assertion failure...

The assertion failure seems to be caused by seq_redo() not flushing
the init fork buffer from shared buffers. As a result, the init fork of
an unlogged sequence can remain invalid. During promotion,
ResetUnloggedRelations() creates the main fork by copying the init
fork from disk, so the main fork also becomes invalid. When
pg_get_sequence_data() later reads the invalid page, it hits the
assertion failure.

The attached patch adds a common function to flush an init fork buffer
and updates seq_redo() to use it. It also updates hash_xlog.c to
reuse the same function to simplify the code.

Thought?

Regards,

--
Fujii Masao

Attachment Content-Type Size
v1-0001-Fix-promoted-standby-reads-of-unlogged-sequences.patch application/octet-stream 5.7 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Maxime Schoemans 2026-06-24 10:41:37 Re: [PATCH] btree_gist: add cross-type integer operator support for GiST
Previous Message Alexander Korotkov 2026-06-24 10:24:49 Re: Add SPLIT PARTITION/MERGE PARTITIONS commands