Re: promotion related handling in pg_sync_replication_slots()

2024-04-25 Thread Amit Kapila
On Wed, Apr 24, 2024 at 10:28 AM shveta malik wrote: > > Modified the logic to remove only synced temporary slots during > SQL-function exit. > > Please find v11 with above changes. > LGTM, so pushed! -- With Regards, Amit Kapila.

Re: promotion related handling in pg_sync_replication_slots()

2024-04-23 Thread Masahiko Sawada
On Tue, Apr 23, 2024 at 12:37 PM Amit Kapila wrote: > > On Mon, Apr 22, 2024 at 7:04 PM Masahiko Sawada wrote: > > > > On Mon, Apr 22, 2024 at 9:02 PM shveta malik wrote: > > > > > > Thanks for the patch, the changes look good Amit. Please find the merged > > > patch. > > > > > > > I've

Re: promotion related handling in pg_sync_replication_slots()

2024-04-23 Thread shveta malik
On Tue, Apr 23, 2024 at 9:07 AM Amit Kapila wrote: > > On Mon, Apr 22, 2024 at 7:04 PM Masahiko Sawada wrote: > > > > On Mon, Apr 22, 2024 at 9:02 PM shveta malik wrote: > > > > > > Thanks for the patch, the changes look good Amit. Please find the merged > > > patch. > > > > > > > I've

Re: promotion related handling in pg_sync_replication_slots()

2024-04-22 Thread Amit Kapila
On Mon, Apr 22, 2024 at 7:04 PM Masahiko Sawada wrote: > > On Mon, Apr 22, 2024 at 9:02 PM shveta malik wrote: > > > > Thanks for the patch, the changes look good Amit. Please find the merged > > patch. > > > > I've reviewed the patch and have some comments: > > --- > /* > -* Early

Re: promotion related handling in pg_sync_replication_slots()

2024-04-22 Thread Masahiko Sawada
On Mon, Apr 22, 2024 at 9:02 PM shveta malik wrote: > > On Mon, Apr 22, 2024 at 5:10 PM Amit Kapila wrote: > > > > On Fri, Apr 19, 2024 at 1:52 PM shveta malik wrote: > > > > > > Please find v9 with the above comments addressed. > > > > > > > I have made minor modifications in the comments and

Re: promotion related handling in pg_sync_replication_slots()

2024-04-22 Thread shveta malik
On Mon, Apr 22, 2024 at 5:10 PM Amit Kapila wrote: > > On Fri, Apr 19, 2024 at 1:52 PM shveta malik wrote: > > > > Please find v9 with the above comments addressed. > > > > I have made minor modifications in the comments and a function name. > Please see the attached top-up patch. Apart from

Re: promotion related handling in pg_sync_replication_slots()

2024-04-22 Thread Amit Kapila
On Fri, Apr 19, 2024 at 1:52 PM shveta malik wrote: > > Please find v9 with the above comments addressed. > I have made minor modifications in the comments and a function name. Please see the attached top-up patch. Apart from this, the patch looks good to me. -- With Regards, Amit Kapila. diff

RE: promotion related handling in pg_sync_replication_slots()

2024-04-21 Thread Zhijie Hou (Fujitsu)
On Friday, April 19, 2024 4:22 PM shveta malik wrote: > On Fri, Apr 19, 2024 at 11:37 AM shveta malik wrote: > > > > On Fri, Apr 19, 2024 at 10:53 AM Bertrand Drouvot > > wrote: > > > > > > Hi, > > > > > > On Thu, Apr 18, 2024 at 05:36:05PM +0530, shveta malik wrote: > > > > Please find v8

Re: promotion related handling in pg_sync_replication_slots()

2024-04-19 Thread shveta malik
On Fri, Apr 19, 2024 at 11:37 AM shveta malik wrote: > > On Fri, Apr 19, 2024 at 10:53 AM Bertrand Drouvot > wrote: > > > > Hi, > > > > On Thu, Apr 18, 2024 at 05:36:05PM +0530, shveta malik wrote: > > > Please find v8 attached. Changes are: > > > > Thanks! > > > > A few comments: > > Thanks for

Re: promotion related handling in pg_sync_replication_slots()

2024-04-19 Thread shveta malik
On Fri, Apr 19, 2024 at 10:53 AM Bertrand Drouvot wrote: > > Hi, > > On Thu, Apr 18, 2024 at 05:36:05PM +0530, shveta malik wrote: > > Please find v8 attached. Changes are: > > Thanks! > > A few comments: Thanks for reviewing. > 1 === > > @@ -1440,7 +1461,7 @@ ReplSlotSyncWorkerMain(char

Re: promotion related handling in pg_sync_replication_slots()

2024-04-18 Thread Bertrand Drouvot
Hi, On Thu, Apr 18, 2024 at 05:36:05PM +0530, shveta malik wrote: > Please find v8 attached. Changes are: Thanks! A few comments: 1 === @@ -1440,7 +1461,7 @@ ReplSlotSyncWorkerMain(char *startup_data, size_t startup_data_len) * slotsync_worker_onexit() but that will need the

Re: promotion related handling in pg_sync_replication_slots()

2024-04-18 Thread shveta malik
On Thu, Apr 18, 2024 at 12:35 PM shveta malik wrote: > > To fix above issues, these changes have been made in v7: Please find v8 attached. Changes are: 1) It fixes ShutDownSlotSync() issue, where we perform kill(SlotSyncCtx->pid). There are chances that after we release spin-lock and before we

Re: promotion related handling in pg_sync_replication_slots()

2024-04-18 Thread shveta malik
On Tue, Apr 16, 2024 at 2:52 PM Bertrand Drouvot wrote: > > Hi, > > On Tue, Apr 16, 2024 at 02:06:45PM +0530, shveta malik wrote: > > On Tue, Apr 16, 2024 at 1:55 PM Zhijie Hou (Fujitsu) > > wrote: > > > I personally feel adding the additional check for sync_replication_slots > > > may > > >

Re: promotion related handling in pg_sync_replication_slots()

2024-04-16 Thread Bertrand Drouvot
Hi, On Tue, Apr 16, 2024 at 02:06:45PM +0530, shveta malik wrote: > On Tue, Apr 16, 2024 at 1:55 PM Zhijie Hou (Fujitsu) > wrote: > > I personally feel adding the additional check for sync_replication_slots may > > not improve the situation here. Because the GUC sync_replication_slots can > >

Re: promotion related handling in pg_sync_replication_slots()

2024-04-16 Thread shveta malik
On Tue, Apr 16, 2024 at 1:55 PM Zhijie Hou (Fujitsu) wrote: > > On Tuesday, April 16, 2024 2:52 PM Bertrand Drouvot > wrote: > > > Hi, > > > On Tue, Apr 16, 2024 at 10:00:04AM +0530, shveta malik wrote: > > > Please find v5 addressing above comments. > > > > Thanks! > > > > @@ -1634,9 +1677,14

RE: promotion related handling in pg_sync_replication_slots()

2024-04-16 Thread Zhijie Hou (Fujitsu)
On Tuesday, April 16, 2024 2:52 PM Bertrand Drouvot wrote: Hi, > On Tue, Apr 16, 2024 at 10:00:04AM +0530, shveta malik wrote: > > Please find v5 addressing above comments. > > Thanks! > > @@ -1634,9 +1677,14 @@ SyncReplicationSlots(WalReceiverConn *wrconn) { >

Re: promotion related handling in pg_sync_replication_slots()

2024-04-16 Thread shveta malik
On Tue, Apr 16, 2024 at 12:03 PM Bertrand Drouvot wrote: > > > I think for now let's restrict their usage in parallel and make the > > promotion behavior consistent both for worker and API. > > Okay, let's do it that way. Is it worth to add a few words in the doc related > to >

Re: promotion related handling in pg_sync_replication_slots()

2024-04-16 Thread Bertrand Drouvot
Hi, On Tue, Apr 16, 2024 at 10:00:04AM +0530, shveta malik wrote: > Please find v5 addressing above comments. Thanks! @@ -1634,9 +1677,14 @@ SyncReplicationSlots(WalReceiverConn *wrconn) { PG_ENSURE_ERROR_CLEANUP(slotsync_failure_callback, PointerGetDatum(wrconn)); { +

Re: promotion related handling in pg_sync_replication_slots()

2024-04-16 Thread Amit Kapila
On Tue, Apr 16, 2024 at 12:03 PM Bertrand Drouvot wrote: > > On Tue, Apr 16, 2024 at 08:21:04AM +0530, Amit Kapila wrote: > > > There is no clear use case for allowing them in parallel and I feel it > > would add more confusion when it can work sometimes but not other > > times. However, if we

Re: promotion related handling in pg_sync_replication_slots()

2024-04-16 Thread Bertrand Drouvot
Hi, On Tue, Apr 16, 2024 at 08:21:04AM +0530, Amit Kapila wrote: > On Mon, Apr 15, 2024 at 7:47 PM Bertrand Drouvot > wrote: > > > > On Mon, Apr 15, 2024 at 06:29:49PM +0530, Amit Kapila wrote: > > > On Mon, Apr 15, 2024 at 6:21 PM Bertrand Drouvot > > > wrote: > > > > > > > > On Mon, Apr 15,

Re: promotion related handling in pg_sync_replication_slots()

2024-04-15 Thread shveta malik
On Tue, Apr 16, 2024 at 9:27 AM Zhijie Hou (Fujitsu) wrote: > > On Monday, April 15, 2024 6:09 PM shveta malik wrote: > > > > Please find v4 addressing the above comments. > > Thanks for the patch. > > Here are few comments: Thanks for reviewing the patch. > > 1. > > +

RE: promotion related handling in pg_sync_replication_slots()

2024-04-15 Thread Zhijie Hou (Fujitsu)
On Monday, April 15, 2024 6:09 PM shveta malik wrote: > > Please find v4 addressing the above comments. Thanks for the patch. Here are few comments: 1. + ereport(ERROR, + errmsg("promotion in progress, can not synchronize

Re: promotion related handling in pg_sync_replication_slots()

2024-04-15 Thread Amit Kapila
On Mon, Apr 15, 2024 at 7:47 PM Bertrand Drouvot wrote: > > On Mon, Apr 15, 2024 at 06:29:49PM +0530, Amit Kapila wrote: > > On Mon, Apr 15, 2024 at 6:21 PM Bertrand Drouvot > > wrote: > > > > > > On Mon, Apr 15, 2024 at 03:38:53PM +0530, shveta malik wrote: > > > > Now both worker and SQL > > >

Re: promotion related handling in pg_sync_replication_slots()

2024-04-15 Thread Bertrand Drouvot
Hi, On Mon, Apr 15, 2024 at 06:29:49PM +0530, Amit Kapila wrote: > On Mon, Apr 15, 2024 at 6:21 PM Bertrand Drouvot > wrote: > > > > On Mon, Apr 15, 2024 at 03:38:53PM +0530, shveta malik wrote: > > > Now both worker and SQL > > > function set 'syncing' when they start and reset it when they

Re: promotion related handling in pg_sync_replication_slots()

2024-04-15 Thread Amit Kapila
On Mon, Apr 15, 2024 at 6:21 PM Bertrand Drouvot wrote: > > On Mon, Apr 15, 2024 at 03:38:53PM +0530, shveta malik wrote: > > On Mon, Apr 15, 2024 at 2:29 PM Amit Kapila wrote: > > > > > > On Fri, Apr 12, 2024 at 5:25 PM shveta malik > > > wrote: > > > > > > > > Please find v3 addressing

Re: promotion related handling in pg_sync_replication_slots()

2024-04-15 Thread Bertrand Drouvot
Hi, On Mon, Apr 15, 2024 at 03:38:53PM +0530, shveta malik wrote: > On Mon, Apr 15, 2024 at 2:29 PM Amit Kapila wrote: > > > > On Fri, Apr 12, 2024 at 5:25 PM shveta malik wrote: > > > > > > Please find v3 addressing race-condition and one other comment. > > > > > > Up-thread it was suggested

Re: promotion related handling in pg_sync_replication_slots()

2024-04-15 Thread shveta malik
On Mon, Apr 15, 2024 at 2:29 PM Amit Kapila wrote: > > On Fri, Apr 12, 2024 at 5:25 PM shveta malik wrote: > > > > Please find v3 addressing race-condition and one other comment. > > > > Up-thread it was suggested that, probably, checking > > SlotSyncCtx->syncing should be sufficient in

Re: promotion related handling in pg_sync_replication_slots()

2024-04-15 Thread Amit Kapila
On Fri, Apr 12, 2024 at 5:25 PM shveta malik wrote: > > Please find v3 addressing race-condition and one other comment. > > Up-thread it was suggested that, probably, checking > SlotSyncCtx->syncing should be sufficient in ShutDownSlotSync(). On > re-thinking, it might not be. Slot sync worker

Re: promotion related handling in pg_sync_replication_slots()

2024-04-12 Thread shveta malik
On Fri, Apr 12, 2024 at 4:18 PM Amit Kapila wrote: > > On Fri, Apr 12, 2024 at 7:57 AM shveta malik wrote: > > > > On Sat, Apr 6, 2024 at 12:25 PM Bharath Rupireddy > > wrote: > > > > > > On Fri, Apr 5, 2024 at 10:31 AM shveta malik > > > wrote: > > > > > > > > Please find v2. Changes are: >

Re: promotion related handling in pg_sync_replication_slots()

2024-04-12 Thread Amit Kapila
On Fri, Apr 12, 2024 at 7:57 AM shveta malik wrote: > > On Sat, Apr 6, 2024 at 12:25 PM Bharath Rupireddy > wrote: > > > > On Fri, Apr 5, 2024 at 10:31 AM shveta malik wrote: > > > > > > Please find v2. Changes are: > > > > Thanks for the patch. Here are some comments. > > Thanks for reviewing.

Re: promotion related handling in pg_sync_replication_slots()

2024-04-12 Thread Amit Kapila
On Fri, Apr 12, 2024 at 7:47 AM shveta malik wrote: > > On Sat, Apr 6, 2024 at 11:49 AM Amit Kapila wrote: > > > > > > Few comments: > > == > > 1. > > void > > SyncReplicationSlots(WalReceiverConn *wrconn) > > { > > + /* > > + * Startup process signaled the slot sync to stop, so

Re: promotion related handling in pg_sync_replication_slots()

2024-04-11 Thread shveta malik
On Sat, Apr 6, 2024 at 12:25 PM Bharath Rupireddy wrote: > > On Fri, Apr 5, 2024 at 10:31 AM shveta malik wrote: > > > > Please find v2. Changes are: > > Thanks for the patch. Here are some comments. Thanks for reviewing. > > 1. Can we have a clear saying in the shmem variable who's syncing at

Re: promotion related handling in pg_sync_replication_slots()

2024-04-11 Thread shveta malik
On Sat, Apr 6, 2024 at 11:49 AM Amit Kapila wrote: > > On Fri, Apr 5, 2024 at 10:31 AM shveta malik wrote: > > > > Please find v2. Changes are: > > 1) Rebased the patch as there was conflict due to recent commit 6f132ed. > > 2) Added an Assert in update_synced_slots_inactive_since() to ensure >

Re: promotion related handling in pg_sync_replication_slots()

2024-04-06 Thread Bharath Rupireddy
On Fri, Apr 5, 2024 at 10:31 AM shveta malik wrote: > > Please find v2. Changes are: Thanks for the patch. Here are some comments. 1. Can we have a clear saying in the shmem variable who's syncing at the moment? Is it a slot sync worker or a backend via SQL function? Perhaps turn "bool

Re: promotion related handling in pg_sync_replication_slots()

2024-04-06 Thread Amit Kapila
On Fri, Apr 5, 2024 at 10:31 AM shveta malik wrote: > > Please find v2. Changes are: > 1) Rebased the patch as there was conflict due to recent commit 6f132ed. > 2) Added an Assert in update_synced_slots_inactive_since() to ensure > that the slot does not have active_pid. > 3) Improved commit msg

Re: promotion related handling in pg_sync_replication_slots()

2024-04-04 Thread shveta malik
On Thu, Apr 4, 2024 at 5:17 PM Amit Kapila wrote: > > On Thu, Apr 4, 2024 at 5:05 PM shveta malik wrote: > > > > Hello hackers, > > > > Currently, promotion related handling is missing in the slot sync SQL > > function pg_sync_replication_slots(). Here is the background on how > > it is done

Re: promotion related handling in pg_sync_replication_slots()

2024-04-04 Thread Amit Kapila
On Thu, Apr 4, 2024 at 5:05 PM shveta malik wrote: > > Hello hackers, > > Currently, promotion related handling is missing in the slot sync SQL > function pg_sync_replication_slots(). Here is the background on how > it is done in slot sync worker: > During promotion, the startup process in