On Tue, Sep 23, 2025 at 12:19 PM Amit Kapila <amit.kapil...@gmail.com> wrote: > > On Wed, Sep 17, 2025 at 4:19 PM Vitaly Davydov <v.davy...@postgrespro.ru> > 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 minimal value from the current reserved LSN and the reserved LSN at > + * the moment of checkpoint start (before CheckPointReplicationSlots). > + */ > + keep = XLogGetReplicationSlotMinimumLSN(); > + if (!XLogRecPtrIsInvalid(slotsMinReqLSN)) > + keep = Min(keep, slotsMinReqLSN); > > Can we add why we need this additional calculation here? >
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? -- With Regards, Amit Kapila.