RE: Newly created replication slot may be invalidated by checkpoint

2025-09-24 Thread Hayato Kuroda (Fujitsu)
Dear Vitaly, > I propose to apply this patch and then to think how to resolve this race > condition, which seems to take place in 18 and master as well. No, I think this invalidation can't happen in PG18/HEAD. This is because in CheckpointGuts()->CheckPointReplicationSlots()-> ReplicationSlotsCom

RE: Newly created replication slot may be invalidated by checkpoint

2025-09-24 Thread Vitaly Davydov
Dear Amit, Hayato On Wednesday, September 24, 2025 14:31 MSK, "Hayato Kuroda (Fujitsu)" wrote: >> I was thinking some more about this solution. Won't it lead to the >> same problem if ReplicationSlotReserveWal() calls >> ReplicationSlotsComputeRequiredLSN() after the above calculation of >> che

RE: Newly created replication slot may be invalidated by checkpoint

2025-09-24 Thread Hayato Kuroda (Fujitsu)
Dear Amit, Vitaly, > I was thinking some more about this solution. Won't it lead to the > same problem if ReplicationSlotReserveWal() calls > ReplicationSlotsComputeRequiredLSN() after the above calculation of > checkpointer? Exactly. I verified that in your patch, the invalidation can still happ

Re: Newly created replication slot may be invalidated by checkpoint

2025-09-24 Thread Amit Kapila
On Tue, Sep 23, 2025 at 12:19 PM Amit Kapila wrote: > > On Wed, Sep 17, 2025 at 4:19 PM Vitaly Davydov > wrote: > > > > [1] 0001-Fix-invalidation-when-slot-is-created-during-checkpo.patch > > > > - /* Calculate how many segments are kept by slots. */ > - keep = slotsMinReqLSN; > + /* > + * Calcu

Re: Newly created replication slot may be invalidated by checkpoint

2025-09-23 Thread Amit Kapila
On Mon, Sep 15, 2025 at 8:11 PM suyu.cmj wrote: > > > Additionally, while studying the InvalidatePossiblyObsoleteSlot(), I noticed > a behavioral difference between PG15 (and earlier) and PG16 (and later). In > PG15 and earlier, while attempting to acquire a slot, if the slot's > restart_lsn ad

Re: Newly created replication slot may be invalidated by checkpoint

2025-09-22 Thread Amit Kapila
On Wed, Sep 17, 2025 at 4:19 PM Vitaly Davydov wrote: > > [1] 0001-Fix-invalidation-when-slot-is-created-during-checkpo.patch > - /* Calculate how many segments are kept by slots. */ - keep = slotsMinReqLSN; + /* + * Calculate how many segments are kept by slots. Keep the wal using + * the minima

Re: Newly created replication slot may be invalidated by checkpoint

2025-09-17 Thread Vitaly Davydov
alidated-by.patch With best regards, Vitaly From 7d2df5ee9681a614ca5c0c8cf8f1aa2468324657 Mon Sep 17 00:00:00 2001 From: "suyu.cmj" Date: Mon, 15 Sep 2025 08:44:17 +0000 Subject: [PATCH] Newly created replication slot may be invalidated by checkpoint Commit 2090edc6f32f652a2c995ca5f7e65748ae1e4c5d introduced a chan

Newly created replication slot may be invalidated by checkpoint

2025-09-15 Thread suyu.cmj
Hi, all, I'd like to discuss an issue about getting the minimal restart_lsn for WAL segments removal during checkpoint. The discussion [1] fixed the issue with the unexpected removal of old WAL segments after checkpoint, followed by an immediate restart. The commit 2090edc6f32f652a2c introduced