Re: persist logical slots to disk during shutdown checkpoint

2023-09-20 Thread Michael Paquier
On Wed, Sep 20, 2023 at 04:48:00PM +0530, Ashutosh Bapat wrote: > Commitfest entry "https://commitfest.postgresql.org/44/4536/ is in > "Ready for committer" state. Is there something remaining here? We > should probably set it as "committed". Thanks, I've switched that to "Committed". -- Michael

Re: persist logical slots to disk during shutdown checkpoint

2023-09-20 Thread Ashutosh Bapat
On Thu, Sep 14, 2023 at 2:41 PM Amit Kapila wrote: > > On Thu, Sep 14, 2023 at 7:20 AM Michael Paquier wrote: > > > > On Wed, Sep 13, 2023 at 04:20:37PM +0530, Amit Kapila wrote: > > > The patch is updated as per recent discussion. > > > > WFM. Thanks for the updated version. > > > > Pushed.

Re: persist logical slots to disk during shutdown checkpoint

2023-09-14 Thread Amit Kapila
On Thu, Sep 14, 2023 at 7:20 AM Michael Paquier wrote: > > On Wed, Sep 13, 2023 at 04:20:37PM +0530, Amit Kapila wrote: > > The patch is updated as per recent discussion. > > WFM. Thanks for the updated version. > Pushed. -- With Regards, Amit Kapila.

Re: persist logical slots to disk during shutdown checkpoint

2023-09-13 Thread Michael Paquier
On Wed, Sep 13, 2023 at 04:20:37PM +0530, Amit Kapila wrote: > The patch is updated as per recent discussion. WFM. Thanks for the updated version. -- Michael signature.asc Description: PGP signature

Re: persist logical slots to disk during shutdown checkpoint

2023-09-13 Thread Amit Kapila
On Wed, Sep 13, 2023 at 12:45 PM Michael Paquier wrote: > > On Wed, Sep 13, 2023 at 12:07:12PM +0530, Amit Kapila wrote: > > Consider if we move this call to bgwriter (aka flushing slots is no > > longer part of a checkpoint), Would that be okay? Previously, I think > > it was okay but not now. I

Re: persist logical slots to disk during shutdown checkpoint

2023-09-13 Thread Michael Paquier
On Wed, Sep 13, 2023 at 12:07:12PM +0530, Amit Kapila wrote: > Consider if we move this call to bgwriter (aka flushing slots is no > longer part of a checkpoint), Would that be okay? Previously, I think > it was okay but not now. I see an argument to keep that as it is as > well because we have

Re: persist logical slots to disk during shutdown checkpoint

2023-09-13 Thread Amit Kapila
On Wed, Sep 13, 2023 at 10:57 AM Michael Paquier wrote: > > On Tue, Sep 12, 2023 at 03:15:44PM +0530, Amit Kapila wrote: > >> > >> - Not sure that there is any point to mention the other code paths in > >> the tree where ReplicationSlotSave() can be called, and a slot can be > >> saved in other

Re: persist logical slots to disk during shutdown checkpoint

2023-09-12 Thread Michael Paquier
On Tue, Sep 12, 2023 at 03:15:44PM +0530, Amit Kapila wrote: > I don't think it will become more responsive in any way, not sure what > made you think like that. The key idea is that after restart we want > to ensure that all the WAL data up to the shutdown checkpoint record > is sent to

Re: persist logical slots to disk during shutdown checkpoint

2023-09-12 Thread Amit Kapila
On Tue, Sep 12, 2023 at 10:55 AM Michael Paquier wrote: > > On Mon, Sep 11, 2023 at 02:49:49PM +0530, Amit Kapila wrote: > > Please see the v11 attached, that rewords all the places of the patch > that need clarifications IMO. I've found that the comment additions > in

Re: persist logical slots to disk during shutdown checkpoint

2023-09-11 Thread Michael Paquier
On Mon, Sep 11, 2023 at 02:49:49PM +0530, Amit Kapila wrote: > I don't know if the difference is worth inventing a new BACKEND_TYPE_* > but if you think so then we can probably discuss this in a new thread. > I think we may want to improve some comments as a separate patch to > make this evident.

Re: persist logical slots to disk during shutdown checkpoint

2023-09-11 Thread Amit Kapila
On Mon, Sep 11, 2023 at 12:08 PM Michael Paquier wrote: > > On Fri, Sep 08, 2023 at 11:50:37AM +0530, Amit Kapila wrote: > > On Fri, Sep 8, 2023 at 10:08 AM Michael Paquier wrote: > >> > >> > >> +/* > >> + * This is used to track the last persisted confirmed_flush LSN value > >> to > >>

Re: persist logical slots to disk during shutdown checkpoint

2023-09-11 Thread Michael Paquier
On Fri, Sep 08, 2023 at 11:50:37AM +0530, Amit Kapila wrote: > On Fri, Sep 8, 2023 at 10:08 AM Michael Paquier wrote: >> >> >> +/* >> + * This is used to track the last persisted confirmed_flush LSN value to >> + * detect any divergence in the in-memory and on-disk values for the >>

Re: persist logical slots to disk during shutdown checkpoint

2023-09-08 Thread Amit Kapila
On Fri, Sep 8, 2023 at 10:08 AM Michael Paquier wrote: > > > +/* > + * This is used to track the last persisted confirmed_flush LSN value to > + * detect any divergence in the in-memory and on-disk values for the > same. > + */ > > "This value tracks is the last LSN where this

Re: persist logical slots to disk during shutdown checkpoint

2023-09-07 Thread Michael Paquier
On Fri, Sep 08, 2023 at 09:04:43AM +0530, Amit Kapila wrote: > I have added something on these lines and also changed the other > comment pointed out by you. In the passing, I made minor cosmetic > changes as well. + * We can flush dirty replication slots at regular intervals by any + *

Re: persist logical slots to disk during shutdown checkpoint

2023-09-07 Thread Amit Kapila
On Thu, Sep 7, 2023 at 3:38 PM Ashutosh Bapat wrote: > > On Thu, Sep 7, 2023 at 1:43 PM Amit Kapila wrote: > > > > On Thu, Sep 7, 2023 at 1:18 PM Michael Paquier wrote: > > > > > > On Thu, Sep 07, 2023 at 11:56:28AM +0530, Amit Kapila wrote: > > > > Thanks, the patch looks good to me as well. >

Re: persist logical slots to disk during shutdown checkpoint

2023-09-07 Thread Amit Kapila
On Thu, Sep 7, 2023 at 4:30 PM Ashutosh Bapat wrote: > > On Thu, Sep 7, 2023 at 4:11 PM Amit Kapila wrote: > > > > On Thu, Sep 7, 2023 at 3:38 PM Ashutosh Bapat > > wrote: > > > > > > * This needn't actually be part of a checkpoint, but it's a convenient > > > - * location. > > > + *

Re: persist logical slots to disk during shutdown checkpoint

2023-09-07 Thread Ashutosh Bapat
On Thu, Sep 7, 2023 at 4:11 PM Amit Kapila wrote: > > On Thu, Sep 7, 2023 at 3:38 PM Ashutosh Bapat > wrote: > > > > * This needn't actually be part of a checkpoint, but it's a convenient > > - * location. > > + * location. is_shutdown is true in case of a shutdown checkpoint. > > > > Relying

Re: persist logical slots to disk during shutdown checkpoint

2023-09-07 Thread Amit Kapila
On Thu, Sep 7, 2023 at 3:38 PM Ashutosh Bapat wrote: > > * This needn't actually be part of a checkpoint, but it's a convenient > - * location. > + * location. is_shutdown is true in case of a shutdown checkpoint. > > Relying on the first sentence, if we decide to not persist the > replication

Re: persist logical slots to disk during shutdown checkpoint

2023-09-07 Thread Ashutosh Bapat
On Thu, Sep 7, 2023 at 1:43 PM Amit Kapila wrote: > > On Thu, Sep 7, 2023 at 1:18 PM Michael Paquier wrote: > > > > On Thu, Sep 07, 2023 at 11:56:28AM +0530, Amit Kapila wrote: > > > Thanks, the patch looks good to me as well. > > > > + /* This is used to track the last saved confirmed_flush

Re: persist logical slots to disk during shutdown checkpoint

2023-09-07 Thread Amit Kapila
On Thu, Sep 7, 2023 at 1:18 PM Michael Paquier wrote: > > On Thu, Sep 07, 2023 at 11:56:28AM +0530, Amit Kapila wrote: > > Thanks, the patch looks good to me as well. > > + /* This is used to track the last saved confirmed_flush LSN value */ > + XLogRecPtr last_saved_confirmed_flush; > >

Re: persist logical slots to disk during shutdown checkpoint

2023-09-07 Thread Michael Paquier
On Thu, Sep 07, 2023 at 11:56:28AM +0530, Amit Kapila wrote: > Thanks, the patch looks good to me as well. + /* This is used to track the last saved confirmed_flush LSN value */ + XLogRecPtr last_saved_confirmed_flush; This does not feel sufficient, as the comment explaining what this

Re: persist logical slots to disk during shutdown checkpoint

2023-09-07 Thread Amit Kapila
On Thu, Sep 7, 2023 at 10:13 AM vignesh C wrote: > > On Wed, 6 Sept 2023 at 12:09, Dilip Kumar wrote: > > > > Other than that the patch LGTM. > > pgindent reported that the new comments added need to be re-adjusted, > here is an updated patch for the same. > Thanks, the patch looks good to me

Re: persist logical slots to disk during shutdown checkpoint

2023-09-06 Thread vignesh C
On Wed, 6 Sept 2023 at 12:09, Dilip Kumar wrote: > > Other than that the patch LGTM. pgindent reported that the new comments added need to be re-adjusted, here is an updated patch for the same. I also verified the following: a) patch applies neatly on HEAD b) make check-world passes c) pgindent

Re: persist logical slots to disk during shutdown checkpoint

2023-09-06 Thread Dilip Kumar
On Wed, Sep 6, 2023 at 12:01 PM Amit Kapila wrote: > > On Wed, Sep 6, 2023 at 9:57 AM Dilip Kumar wrote: > > > > On Wed, Sep 6, 2023 at 9:47 AM Amit Kapila wrote: > > > > > > On Tue, Sep 5, 2023 at 6:00 PM Dilip Kumar wrote: > > > > > > > > Right, it can change and in that case, the check

Re: persist logical slots to disk during shutdown checkpoint

2023-09-06 Thread Amit Kapila
On Wed, Sep 6, 2023 at 9:57 AM Dilip Kumar wrote: > > On Wed, Sep 6, 2023 at 9:47 AM Amit Kapila wrote: > > > > On Tue, Sep 5, 2023 at 6:00 PM Dilip Kumar wrote: > > > > > Right, it can change and in that case, the check related to > > confirm_flush LSN will fail during the upgrade. However,

Re: persist logical slots to disk during shutdown checkpoint

2023-09-05 Thread Dilip Kumar
On Wed, Sep 6, 2023 at 9:47 AM Amit Kapila wrote: > > On Tue, Sep 5, 2023 at 6:00 PM Dilip Kumar wrote: > > Right, it can change and in that case, the check related to > confirm_flush LSN will fail during the upgrade. However, the point is > that if we don't take spinlock, we need to properly

Re: persist logical slots to disk during shutdown checkpoint

2023-09-05 Thread Amit Kapila
On Tue, Sep 5, 2023 at 6:00 PM Dilip Kumar wrote: > > On Tue, Sep 5, 2023 at 5:04 PM Zhijie Hou (Fujitsu) > wrote: > > > > > > Can't we just have code like this? I mean we will have to make > > > ReplicationSlotMarkDirty take slot as an argument or have another version > > > which takes slot as

Re: persist logical slots to disk during shutdown checkpoint

2023-09-05 Thread Dilip Kumar
On Tue, Sep 5, 2023 at 5:04 PM Zhijie Hou (Fujitsu) wrote: > > > Can't we just have code like this? I mean we will have to make > > ReplicationSlotMarkDirty take slot as an argument or have another version > > which takes slot as an argument and that would be called by us as well as by > >

RE: persist logical slots to disk during shutdown checkpoint

2023-09-05 Thread Zhijie Hou (Fujitsu)
On Tuesday, September 5, 2023 4:15 PM Dilip Kumar wrote: Hi, > > On Tue, Sep 5, 2023 at 10:12 AM Amit Kapila > wrote: > > > > On Tue, Sep 5, 2023 at 7:54 AM Zhijie Hou (Fujitsu) > > wrote: > > > > > > On Monday, September 4, 2023 6:15 PM vignesh C > wrote: > > > > > > > > On Mon, 4 Sept

Re: persist logical slots to disk during shutdown checkpoint

2023-09-05 Thread Dilip Kumar
On Tue, Sep 5, 2023 at 10:12 AM Amit Kapila wrote: > > On Tue, Sep 5, 2023 at 7:54 AM Zhijie Hou (Fujitsu) > wrote: > > > > On Monday, September 4, 2023 6:15 PM vignesh C wrote: > > > > > > On Mon, 4 Sept 2023 at 15:20, Amit Kapila wrote: > > > > > > > > On Fri, Sep 1, 2023 at 10:50 AM vignesh

Re: persist logical slots to disk during shutdown checkpoint

2023-09-05 Thread vignesh C
On Tue, 5 Sept 2023 at 09:10, Dilip Kumar wrote: > > On Fri, Sep 1, 2023 at 12:16 PM vignesh C wrote: > > > > On Fri, 1 Sept 2023 at 10:06, Amit Kapila wrote: > > > > > > On Thu, Aug 31, 2023 at 6:12 PM Ashutosh Bapat > > > wrote: > > > > > > > > On Thu, Aug 31, 2023 at 2:52 PM Amit Kapila >

Re: persist logical slots to disk during shutdown checkpoint

2023-09-04 Thread Dilip Kumar
On Tue, Sep 5, 2023 at 9:58 AM Amit Kapila wrote: > > On Tue, Sep 5, 2023 at 9:10 AM Dilip Kumar wrote: > > > > The comments don't mention anything about why we are just flushing at > > the shutdown checkpoint. I mean the checkpoint is not that frequent > > and we already perform a lot of I/O

Re: persist logical slots to disk during shutdown checkpoint

2023-09-04 Thread Amit Kapila
On Tue, Sep 5, 2023 at 9:10 AM Dilip Kumar wrote: > > On Fri, Sep 1, 2023 at 12:16 PM vignesh C wrote: > > > > On Fri, 1 Sept 2023 at 10:06, Amit Kapila wrote: > > > > > > On Thu, Aug 31, 2023 at 6:12 PM Ashutosh Bapat > > > wrote: > > > > > > > > On Thu, Aug 31, 2023 at 2:52 PM Amit Kapila

Re: persist logical slots to disk during shutdown checkpoint

2023-09-04 Thread Dilip Kumar
On Fri, Sep 1, 2023 at 12:16 PM vignesh C wrote: > > On Fri, 1 Sept 2023 at 10:06, Amit Kapila wrote: > > > > On Thu, Aug 31, 2023 at 6:12 PM Ashutosh Bapat > > wrote: > > > > > > On Thu, Aug 31, 2023 at 2:52 PM Amit Kapila > > > wrote: > > > > > > > > All but one. Normally, the idea of

Re: persist logical slots to disk during shutdown checkpoint

2023-09-04 Thread Amit Kapila
On Tue, Sep 5, 2023 at 7:54 AM Zhijie Hou (Fujitsu) wrote: > > On Monday, September 4, 2023 6:15 PM vignesh C wrote: > > > > On Mon, 4 Sept 2023 at 15:20, Amit Kapila wrote: > > > > > > On Fri, Sep 1, 2023 at 10:50 AM vignesh C wrote: > > > > > > > > On Fri, 1 Sept 2023 at 10:06, Amit Kapila

RE: persist logical slots to disk during shutdown checkpoint

2023-09-04 Thread Zhijie Hou (Fujitsu)
On Monday, September 4, 2023 6:15 PM vignesh C wrote: > > On Mon, 4 Sept 2023 at 15:20, Amit Kapila wrote: > > > > On Fri, Sep 1, 2023 at 10:50 AM vignesh C wrote: > > > > > > On Fri, 1 Sept 2023 at 10:06, Amit Kapila wrote: > > > > > > > > On Thu, Aug 31, 2023 at 6:12 PM Ashutosh Bapat > > >

Re: persist logical slots to disk during shutdown checkpoint

2023-09-04 Thread vignesh C
On Mon, 4 Sept 2023 at 15:20, Amit Kapila wrote: > > On Fri, Sep 1, 2023 at 10:50 AM vignesh C wrote: > > > > On Fri, 1 Sept 2023 at 10:06, Amit Kapila wrote: > > > > > > On Thu, Aug 31, 2023 at 6:12 PM Ashutosh Bapat > > > wrote: > > > > > > > > On Thu, Aug 31, 2023 at 2:52 PM Amit Kapila >

Re: persist logical slots to disk during shutdown checkpoint

2023-09-04 Thread Amit Kapila
On Fri, Sep 1, 2023 at 10:50 AM vignesh C wrote: > > On Fri, 1 Sept 2023 at 10:06, Amit Kapila wrote: > > > > On Thu, Aug 31, 2023 at 6:12 PM Ashutosh Bapat > > wrote: > > > > > > On Thu, Aug 31, 2023 at 2:52 PM Amit Kapila > > > wrote: > > > > > > > > All but one. Normally, the idea of

Re: persist logical slots to disk during shutdown checkpoint

2023-09-01 Thread Amit Kapila
On Fri, Sep 1, 2023 at 1:11 PM Ashutosh Bapat wrote: > > On Thu, Aug 31, 2023 at 7:28 PM Amit Kapila wrote: > > > > On Thu, Aug 31, 2023 at 6:12 PM Ashutosh Bapat > > wrote: > > > > > > > + qr/Streaming transactions committing after ([A-F0-9]+\/[A-F0-9]+), > > > > reading WAL from

Re: persist logical slots to disk during shutdown checkpoint

2023-09-01 Thread Ashutosh Bapat
On Thu, Aug 31, 2023 at 7:28 PM Amit Kapila wrote: > > On Thu, Aug 31, 2023 at 6:12 PM Ashutosh Bapat > wrote: > > > > On Thu, Aug 31, 2023 at 2:52 PM Amit Kapila wrote: > > > > > > I > > > > > > think we should shut down subscriber, restart publisher and then > > > > > > make this > > > > > >

Re: persist logical slots to disk during shutdown checkpoint

2023-08-31 Thread vignesh C
On Fri, 1 Sept 2023 at 10:06, Amit Kapila wrote: > > On Thu, Aug 31, 2023 at 6:12 PM Ashutosh Bapat > wrote: > > > > On Thu, Aug 31, 2023 at 2:52 PM Amit Kapila wrote: > > > > > > All but one. Normally, the idea of marking dirty is to indicate that > > > we will actually write/flush the

Re: persist logical slots to disk during shutdown checkpoint

2023-08-31 Thread Amit Kapila
On Thu, Aug 31, 2023 at 6:12 PM Ashutosh Bapat wrote: > > On Thu, Aug 31, 2023 at 2:52 PM Amit Kapila 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

Re: persist logical slots to disk during shutdown checkpoint

2023-08-31 Thread Amit Kapila
On Thu, Aug 31, 2023 at 6:12 PM Ashutosh Bapat wrote: > > On Thu, Aug 31, 2023 at 2:52 PM Amit Kapila wrote: > > > > > I > > > > > think we should shut down subscriber, restart publisher and then make > > > > > this > > > > > check based on the contents of the replication slot instead of server

Re: persist logical slots to disk during shutdown checkpoint

2023-08-31 Thread Ashutosh Bapat
On Thu, Aug 31, 2023 at 2:52 PM Amit Kapila wrote: > > > > I > > > > think we should shut down subscriber, restart publisher and then make > > > > this > > > > check based on the contents of the replication slot instead of server > > > > log. > > > > Shutting down subscriber will ensure that

Re: persist logical slots to disk during shutdown checkpoint

2023-08-31 Thread Amit Kapila
On Thu, Aug 31, 2023 at 12:25 PM Ashutosh Bapat wrote: > > On Thu, Aug 31, 2023 at 12:10 PM Amit Kapila wrote: > > > > > + > > > +/* > > > + * We won't ensure that the slot is persisted after the > > > confirmed_flush > > > + * LSN is updated as that could lead to frequent writes.

Re: persist logical slots to disk during shutdown checkpoint

2023-08-31 Thread Ashutosh Bapat
On Thu, Aug 31, 2023 at 12:10 PM Amit Kapila wrote: > > > + > > +/* > > + * We won't ensure that the slot is persisted after the confirmed_flush > > + * LSN is updated as that could lead to frequent writes. However, we > > need > > + * to ensure that we do persist the slots at

Re: persist logical slots to disk during shutdown checkpoint

2023-08-31 Thread Amit Kapila
On Wed, Aug 30, 2023 at 6:33 PM Ashutosh Bapat wrote: > > On Tue, Aug 29, 2023 at 5:40 PM Ashutosh Bapat > wrote: > > > > I am looking at it. If you can wait till the end of the week, that > > will be great. > > /* > * Successfully wrote, unset dirty bit, unless somebody dirtied again

Re: persist logical slots to disk during shutdown checkpoint

2023-08-30 Thread Ashutosh Bapat
On Tue, Aug 29, 2023 at 5:40 PM Ashutosh Bapat wrote: > > I am looking at it. If you can wait till the end of the week, that > will be great. /* * Successfully wrote, unset dirty bit, unless somebody dirtied again - * already. + * already and remember the confirmed_flush LSN

Re: persist logical slots to disk during shutdown checkpoint

2023-08-29 Thread Amit Kapila
On Wed, Aug 30, 2023 at 9:03 AM Julien Rouhaud wrote: > > On Tue, Aug 29, 2023 at 02:21:15PM +0530, Amit Kapila wrote: > > On Tue, Aug 29, 2023 at 10:16 AM vignesh C wrote: > > > > > > That makes sense. The attached v6 version has the changes for the > > > same, apart from this I have also fixed

Re: persist logical slots to disk during shutdown checkpoint

2023-08-29 Thread Julien Rouhaud
Hi, On Tue, Aug 29, 2023 at 02:21:15PM +0530, Amit Kapila wrote: > On Tue, Aug 29, 2023 at 10:16 AM vignesh C wrote: > > > > That makes sense. The attached v6 version has the changes for the > > same, apart from this I have also fixed a) pgindent issues b) perltidy > > issues c) one variable

Re: persist logical slots to disk during shutdown checkpoint

2023-08-29 Thread Ashutosh Bapat
On Tue, Aug 29, 2023 at 2:21 PM Amit Kapila wrote: > > On Tue, Aug 29, 2023 at 10:16 AM vignesh C wrote: > > > > That makes sense. The attached v6 version has the changes for the > > same, apart from this I have also fixed a) pgindent issues b) perltidy > > issues c) one variable change

Re: persist logical slots to disk during shutdown checkpoint

2023-08-29 Thread Amit Kapila
On Tue, Aug 29, 2023 at 10:16 AM vignesh C wrote: > > That makes sense. The attached v6 version has the changes for the > same, apart from this I have also fixed a) pgindent issues b) perltidy > issues c) one variable change (flush_lsn_changed to > confirmed_flush_has_changed) d) corrected few

Re: persist logical slots to disk during shutdown checkpoint

2023-08-28 Thread vignesh C
On Mon, 28 Aug 2023 at 18:56, Amit Kapila wrote: > > On Thu, Aug 24, 2023 at 11:44 AM vignesh C wrote: > > > > The patch looks mostly good to me. I have made minor changes which are > as follows: (a) removed the autovacuum =off and > wal_receiver_status_interval = 0 setting as those doesn't seem

Re: persist logical slots to disk during shutdown checkpoint

2023-08-28 Thread Amit Kapila
On Thu, Aug 24, 2023 at 11:44 AM vignesh C wrote: > The patch looks mostly good to me. I have made minor changes which are as follows: (a) removed the autovacuum =off and wal_receiver_status_interval = 0 setting as those doesn't seem to be required for the test; (b) changed a few comments and

RE: persist logical slots to disk during shutdown checkpoint

2023-08-28 Thread Hayato Kuroda (Fujitsu)
Dear hackers, I also tested for logical slots on the physical standby. PSA the script. confirmed_flush_lsn for such slots were successfully persisted. # Topology In this test nodes are connected each other. node1 --(physical replication)-->node2--(logical replication)-->node3 # Test method

Re: persist logical slots to disk during shutdown checkpoint

2023-08-27 Thread vignesh C
On Fri, 25 Aug 2023 at 17:40, vignesh C wrote: > > On Sat, 19 Aug 2023 at 11:53, Amit Kapila wrote: > > > > It's entirely possible for a logical slot to have a confirmed_flush > > LSN higher than the last value saved on disk while not being marked as > > dirty. It's currently not a problem to

Re: persist logical slots to disk during shutdown checkpoint

2023-08-25 Thread vignesh C
On Sat, 19 Aug 2023 at 11:53, Amit Kapila wrote: > > It's entirely possible for a logical slot to have a confirmed_flush > LSN higher than the last value saved on disk while not being marked as > dirty. It's currently not a problem to lose that value during a clean > shutdown / restart cycle but

Re: persist logical slots to disk during shutdown checkpoint

2023-08-24 Thread vignesh C
On Wed, 23 Aug 2023 at 14:21, Hayato Kuroda (Fujitsu) wrote: > > Dear Vignesh, > > > Here is a patch to persist to disk logical slots during a shutdown > > checkpoint if the updated confirmed_flush_lsn has not yet been > > persisted. > > Thanks for making the patch with different approach! Here

Re: persist logical slots to disk during shutdown checkpoint

2023-08-23 Thread vignesh C
On Wed, 23 Aug 2023 at 14:21, Hayato Kuroda (Fujitsu) wrote: > > Dear Vignesh, > > > Here is a patch to persist to disk logical slots during a shutdown > > checkpoint if the updated confirmed_flush_lsn has not yet been > > persisted. > > Thanks for making the patch with different approach! Here

RE: persist logical slots to disk during shutdown checkpoint

2023-08-23 Thread Hayato Kuroda (Fujitsu)
Dear Vignesh, > Here is a patch to persist to disk logical slots during a shutdown > checkpoint if the updated confirmed_flush_lsn has not yet been > persisted. Thanks for making the patch with different approach! Here are comments. 01. RestoreSlotFromDisk ```

Re: persist logical slots to disk during shutdown checkpoint

2023-08-22 Thread vignesh C
On Tue, 22 Aug 2023 at 15:42, Amit Kapila wrote: > > On Tue, Aug 22, 2023 at 2:56 PM Ashutosh Bapat > wrote: > > > > On Tue, Aug 22, 2023 at 9:48 AM Amit Kapila wrote: > > > > > > > > Another idea is to record the confirm_flush_lsn at the time of > > > > persisting the slot. We can use it in

RE: persist logical slots to disk during shutdown checkpoint

2023-08-22 Thread Hayato Kuroda (Fujitsu)
Dear hackers, Thanks for forking the thread! I think we would choose another design, but I wanted to post the updated version once with the current approach. All comments came from the parent thread [1]. > 1. GENERAL -- git apply > > The patch fails to apply cleanly. There are whitespace

Re: persist logical slots to disk during shutdown checkpoint

2023-08-22 Thread Ashutosh Bapat
On Tue, Aug 22, 2023 at 3:42 PM Amit Kapila wrote: > > > > Once we have last_persisted_confirm_flush_lsn, (1) is just an > > optimization on top of that. With that we take the opportunity to > > persist confirmed_flush_lsn which is much farther than the current > > persisted value and thus

Re: persist logical slots to disk during shutdown checkpoint

2023-08-22 Thread Amit Kapila
On Tue, Aug 22, 2023 at 2:56 PM Ashutosh Bapat wrote: > > On Tue, Aug 22, 2023 at 9:48 AM Amit Kapila wrote: > > > > > > Another idea is to record the confirm_flush_lsn at the time of > > > persisting the slot. We can use it in two different ways 1. to mark a > > > slot dirty and persist if the

Re: persist logical slots to disk during shutdown checkpoint

2023-08-22 Thread Ashutosh Bapat
On Tue, Aug 22, 2023 at 9:48 AM Amit Kapila wrote: > > > > Another idea is to record the confirm_flush_lsn at the time of > > persisting the slot. We can use it in two different ways 1. to mark a > > slot dirty and persist if the last confirm_flush_lsn when slot was > > persisted was too far from

Re: persist logical slots to disk during shutdown checkpoint

2023-08-21 Thread Amit Kapila
On Mon, Aug 21, 2023 at 6:36 PM Ashutosh Bapat wrote: > > On Sun, Aug 20, 2023 at 8:40 AM Amit Kapila wrote: > > > > The other possibility is that we introduce yet another dirty flag for > > slots, say dirty_for_shutdown_checkpoint which will be set when we > > update confirmed_flush LSN. The

Re: persist logical slots to disk during shutdown checkpoint

2023-08-21 Thread Ashutosh Bapat
On Sun, Aug 20, 2023 at 8:40 AM Amit Kapila wrote: > > On Sat, Aug 19, 2023 at 12:46 PM Julien Rouhaud wrote: > > > > On Sat, 19 Aug 2023, 14:16 Amit Kapila, wrote: > >> > > > >> The idea discussed in the thread [1] is to always persist logical > >> slots to disk during the shutdown checkpoint.

Re: persist logical slots to disk during shutdown checkpoint

2023-08-19 Thread Amit Kapila
On Sat, Aug 19, 2023 at 12:46 PM Julien Rouhaud wrote: > > On Sat, 19 Aug 2023, 14:16 Amit Kapila, wrote: >> > >> The idea discussed in the thread [1] is to always persist logical >> slots to disk during the shutdown checkpoint. I have extracted the >> patch to achieve the same from that thread

Re: persist logical slots to disk during shutdown checkpoint

2023-08-19 Thread Julien Rouhaud
On Sat, 19 Aug 2023, 14:16 Amit Kapila, wrote: > It's entirely possible for a logical slot to have a confirmed_flush > LSN higher than the last value saved on disk while not being marked as > dirty. It's currently not a problem to lose that value during a clean > shutdown / restart cycle but to