Re: promotion related handling in pg_sync_replication_slots()

From: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
To: Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com>
Cc: shveta malik <shveta(dot)malik(at)gmail(dot)com>, Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, "Zhijie Hou (Fujitsu)" <houzj(dot)fnst(at)fujitsu(dot)com>
Subject: Re: promotion related handling in pg_sync_replication_slots()
Date: 2024-04-16 02:51:04
Message-ID: CAA4eK1J4ExPgEzCqT8Uq8VCgPh-5YNMM5zxAbtu9joj2SDLyKQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Apr 15, 2024 at 7:47 PM Bertrand Drouvot
<bertranddrouvot(dot)pg(at)gmail(dot)com> 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
> > <bertranddrouvot(dot)pg(at)gmail(dot)com> 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 exit.
> > >
> > > It means that it's not possible anymore to trigger a manual sync if
> > > sync_replication_slots is on. Indeed that would trigger:
> > >
> > > postgres=# select pg_sync_replication_slots();
> > > ERROR: cannot synchronize replication slots concurrently
> > >
> > > That looks like an issue to me, thoughts?
> > >
> >
> > This is intentional as of now for the sake of keeping
> > implementation/code simple. It is not difficult to allow them but I am
> > not sure whether we want to add another set of conditions allowing
> > them in parallel.
>
> I think that the ability to launch a manual sync before a switchover would be
> missed. Except for this case I don't think that's an issue to prevent them to
> run in parallel.
>

I think if the slotsync worker is available, it can do that as well.
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 receive some report from the field where there
is a real demand for such a thing, it should be easy to achieve. For
example, I can imagine that we can have sync_state that has values
'started', 'in_progress' , and 'finished'. This should allow us to
achieve what the current proposed patch is doing along with allowing
the API to work in parallel when the sync_state is not 'in_progress'.

I think for now let's restrict their usage in parallel and make the
promotion behavior consistent both for worker and API.

--
With Regards,
Amit Kapila.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2024-04-16 03:16:42 Re: Stability of queryid in minor versions
Previous Message Andres Freund 2024-04-16 02:29:05 Re: Differential code coverage between 16 and HEAD