Re: Assertion failure in update_local_synced_slot(), slotsync.c:364

From: Zhijie Hou <houzhijie22(at)gmail(dot)com>
To: Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com>
Cc: Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
Subject: Re: Assertion failure in update_local_synced_slot(), slotsync.c:364
Date: 2026-11-11 15:13:13
Message-ID: 64bcfe96-b4d4-42bf-8d3a-45236fcee827@gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On Wed, Nov11, 2026 at 01:04 AM Bertrand Drouvot wrote:

> On Tue, Nov 10, 2026 at 05:17:57PM +0800, Zhijie Hou wrote:
> > I agree with your analysis, and I think we can fix it by preserving
> > SS_SKIP_NO_CONSISTENT_SNAPSHOT in update_local_synced_slot() when
> > the remote slot has not advanced since a previous cycle failed to
> > build a consistent snapshot.
> >
> > Attached is a patch for the fix. I also tried to simplify and
> > stabilize the test and merged it into
> > 040_standby_failover_slots_sync.pl in case we want to include a
> > test.
>
> Thanks for the patch!
>
> + else if (slot->slotsync_skip_reason == SS_SKIP_NO_CONSISTENT_SNAPSHOT)
>
> Could slotsync_skip_reason be SS_SKIP_WAL_OR_ROWS_REMOVED here even if
> the slot is still inconsistent? This could happen if the local
> catalog_xmin gets ahead and the remote one later catches up?

Thanks for catching this. I confirmed that this can happen.

Since any temporary slot that reaches a consistent snapshot is persisted
immediately in the same cycle, we can check "else if
(slot->data.persistency == RS_TEMPORARY)" here instead. Attached is the
v2 patch with this change.

--
Best Regards,
Zhijie Hou

Attachment Content-Type Size
v2-0001-Fix-premature-persistence-of-synced-slots-without.patch text/plain 5.2 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Álvaro Herrera 2026-11-11 15:41:34 Re: pgsql: Don't trust NOT NULL on virtual generated columns of partitioned
Previous Message Matheus Alcantara 2026-11-11 14:54:36 Re: Wrong result for whole-row IS NOT NULL with dropped columns