On Fri, Sep 1, 2023 at 10:50 AM vignesh C <vignes...@gmail.com> wrote: > > On Fri, 1 Sept 2023 at 10:06, Amit Kapila <amit.kapil...@gmail.com> wrote: > > > > On Thu, Aug 31, 2023 at 6:12 PM Ashutosh Bapat > > <ashutosh.bapat....@gmail.com> wrote: > > > > > > On Thu, Aug 31, 2023 at 2:52 PM Amit Kapila <amit.kapil...@gmail.com> > > > wrote: > > > > > > > > All but one. Normally, the idea of marking dirty is to indicate that > > > > we will actually write/flush the contents at a later point (except > > > > when required for correctness) as even indicated in the comments atop > > > > ReplicatioinSlotMarkDirty(). However, I see your point that we use > > > > that protocol at all the current places including CreateSlotOnDisk(). > > > > So, we can probably do it here as well. > > > > > > yes > > > > > > > I think we should also ensure that slots are not invalidated > > (slot.data.invalidated != RS_INVAL_NONE) before marking them dirty > > because we don't allow decoding from such slots, so we shouldn't > > include those. > > Added this check. > > Apart from this I have also fixed the following issues that were > agreed on: a) Setting slots to dirty in CheckPointReplicationSlots > instead of setting it in SaveSlotToPath >
+ if (is_shutdown && SlotIsLogical(s)) + { + SpinLockAcquire(&s->mutex); + if (s->data.invalidated == RS_INVAL_NONE && + s->data.confirmed_flush != s->last_saved_confirmed_flush) + s->dirty = true; I think it is better to use ReplicationSlotMarkDirty() as that would be consistent with all other usages. -- With Regards, Amit Kapila.