pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Amit Kapila <amit.kapila16@gmail.com>
To: Ajin Cherian <itsajin@gmail.com>
Cc: Masahiko Sawada <sawada.mshk@gmail.com>
Cc: Peter Smith <smithpb2250@gmail.com>
Cc: houzj.fnst@fujitsu.com <houzj.fnst@fujitsu.com>
Cc: Hubert Lubaczewski <depesz@depesz.com>
Cc: PostgreSQL mailing lists <pgsql-bugs@lists.postgresql.org>
Subject: Re: Excessive number of replication slots for 12->14 logical replication
Date: Fri, 26 Aug 2022 07:04:12 +0530
Message-ID: <CAA4eK1JK0zs0H27-i3Pko2na-xt2vrO2r6Y3mn+sfr9CWzobBg@mail.gmail.com> (raw)
In-Reply-To: <CAFPTHDbY_DOr4zWQzNR5ZaC1eEWz5JtFdH1mp2jKbT83CbaRuw@mail.gmail.com>
References: <20220714115155.GA5439@depesz.com>
	<CAA4eK1LAk=9fi7V=XKb7d40hOyKTt5a3MTOaEQpUr-RHgpixxg@mail.gmail.com>
	<20220718094330.GA24063@depesz.com>
	<CAA4eK1+RL43Qty=Rb+RJhw0+0sm-f2T=7ST=9u0R+vmnDDVZaA@mail.gmail.com>
	<CAFPTHDbppsYxW3Ttg0fpYrJ8F8Zx1HVFr3Sn56XLK54C2GUYCg@mail.gmail.com>
	<OS0PR01MB5716ED883D44E2214F3563B094959@OS0PR01MB5716.jpnprd01.prod.outlook.com>
	<CAFPTHDZBs98Vn9OBf=x1tAo_3bTY9wnvRrRX1KMYfMqu+Pngng@mail.gmail.com>
	<CAHut+Puq73cDWPiGFTw=v6tHkL7pDNKJcB4VScPA25qPQOVn8A@mail.gmail.com>
	<CAFPTHDa+M1SLWdHiMC55LDTikP+DcsuFC8z9TjFkhxpp09pgHQ@mail.gmail.com>
	<CAHut+Pvt9G8Z8DDE0627=GZJFWC6jiF_uymmXX-RzDojQTw2hw@mail.gmail.com>
	<CAFPTHDYgyNfhaR7UkFEYrMZgjrtat0Ry=hezNc6M_rwEuKi4MQ@mail.gmail.com>
	<CAHut+PsjtG+RWH-oX_+sd_LCNUk61-94Hs4mT1mPCsvGoNzmww@mail.gmail.com>
	<CAFPTHDYmA_bJwXm8GaNdwG49X3m4YNeUaA5fFhOf-2BdeSTTWg@mail.gmail.com>
	<CAD21AoBGXi9nFsQTvgF-NfqcvoGOA9SrgSRwoEdGevEHvTm53g@mail.gmail.com>
	<CAFPTHDbVNXXwug7PX=VjMvWqv9eZzDmbgSEq=6BpLdBBv4XJ5Q@mail.gmail.com>
	<CAD21AoCjdrTeDJxyGCekopzZ4MKB=5+224B1whnM48N2ZFLexQ@mail.gmail.com>
	<CAFPTHDZ53seBTgvBE8bWayGOELt3njKOuaj_t+vpZuuMxXw=tQ@mail.gmail.com>
	<CAD21AoBW-mhbXRY1O8ka3UEnz5YUv5ozE36w22VKcN9QEVXX7g@mail.gmail.com>
	<CAA4eK1+iccdSM=gdO5K_b5H5UYiw3Fidpyw1_Zi_-MzYRFJExA@mail.gmail.com>
	<CAD21AoA9hF3XWHe7R6wqUgfx150SEJA-iyKagCA8b7zT2=qk_Q@mail.gmail.com>
	<CAA4eK1J4H81Nw_Ng9fUaOnVsE5L0GHXz+dVn6HqaPXFEvCuJfA@mail.gmail.com>
	<CAD21AoA=ep=Qqb_hQm09OHKroMs2eUo1deSiqj5H-shcKpen8Q@mail.gmail.com>
	<CAFPTHDZbgea5udnJoT2THLQ+6WpwXZHNJYkM=5yUasxxd4CDTw@mail.gmail.com>
	<CAD21AoD7R=WQGCxLxx1BPK6PKApzuv25tEO0g+ckBhDNZi=oVQ@mail.gmail.com>
	<CAFPTHDZQ1wGbs08hMb_jG9aeOWQT68qRi_qg7YoCxxeJUHaniA@mail.gmail.com>
	<CAD21AoD+6iYC7YJr0moJJJykbkPPxs88LMUpbCgoD6OyDT3d_w@mail.gmail.com>
	<CAFPTHDYbMLxTga3aBYE8pOPgk0K4L44FMz2LokB16PmE4LU=Wg@mail.gmail.com>
	<CAA4eK1JAE3c6w=cJY5P1m4TpvOsWh6vxnjpGBv_1B8S-tNmWkQ@mail.gmail.com>
	<CAA4eK1+gVZ8tSemRudU7gj6B3jYOKNSswH0PhEd+kt068ivnCw@mail.gmail.com>
	<CAFPTHDbY_DOr4zWQzNR5ZaC1eEWz5JtFdH1mp2jKbT83CbaRuw@mail.gmail.com>

On Thu, Aug 25, 2022 at 7:38 PM Ajin Cherian <itsajin@gmail.com> wrote:
>
> On Wed, Aug 24, 2022 at 3:54 PM Amit Kapila <amit.kapila16@gmail.com> wrote:
> >
> > On Tue, Aug 23, 2022 at 7:56 PM Amit Kapila <amit.kapila16@gmail.com> wrote:
> > >
> > > On Thu, Aug 18, 2022 at 11:28 AM Ajin Cherian <itsajin@gmail.com> wrote:
> > > >
> > > > On Thu, Aug 18, 2022 at 3:46 PM Masahiko Sawada <sawada.mshk@gmail.com> wrote:
> > > > > Looks good.
> > > > >
> > > > > I have one minor comment:
> > > > >
> > > > > -                    * SUBREL_STATE_FINISHEDCOPY. The apply worker can also
> > > > > -                    * concurrently try to drop the origin and by this time
> > > > > -                    * the origin might be already removed. For these reasons,
> > > > > -                    * passing missing_ok = true.
> > > > > +                    * SUBREL_STATE_FINISHEDCOPY. So passing missing_ok = true.
> > > > >
> > > > > I think we should change "the apply worker" to "the tablesync worker"
> > > > > but should not remove this sentence. The fact that another process
> > > > > could concurrently try to drop the origin is still true.
> > > > >
> > > > > The rest looks good to me.
> > > > >
> > > >
> > > > Updated as described.
> > > >
> > >
> > > The patch looks good to me though I would like to test it a bit more
> > > before pushing.
> > >
> >
> > While testing/reviewing it further, I noticed that the patch has used
> > missing_ok as true when dropping origin via tablesync worker. I don't
> > think that is correct because the concurrent operations that remove
> > origin like a refresh for the subscription take an access exclusive
> > lock on pg_subscription which prevent the previous operation to update
> > the rel state to SUBREL_STATE_SYNCDONE to succeed. So, I think we
> > should pass missing_ok as false which would be consistent with slot
> > handling. I have changed that and comments a few places. What do you
> > think of the attached?
> >
>
> Yes, this makes sense. I tested with a debugger to create simultaneous
> alter subscription refresh publication AND tablesync worker
> deleting the tracking origin. What I see is that the alter subscription command
> gets the lock on SubscriptionRelRelationId  and then actually goes on to
> kill the tablesync worker. Even if the tablesync worker is waiting for
> the same lock,
> it looks like the SIGTERM is being handled and the worker is killed.
>
> From my testing, there doesn't seem to be a case where the tablesync worker
> would try and drop a previously dropped origin. So, I think we can pass
> missing_ok as 'false' while dropping origin. The patch looks good to me.
>

Thanks for the testing. I'll push this sometime early next week (by
Tuesday) unless Sawada-San or someone else has any comments on it.

-- 
With Regards,
Amit Kapila.





view thread (61+ messages)  latest in thread

Message-ID: <CAA4eK1JK0zs0H27-i3Pko2na-xt2vrO2r6Y3mn+sfr9CWzobBg@mail.gmail.com>
Permalink:  ../CAA4eK1JK0zs0H27-i3Pko2na-xt2vrO2r6Y3mn+sfr9CWzobBg@mail.gmail.com/
Also on:    postgresql.org/message-id/CAA4eK1JK0zs0H27-i3Pko2na-xt2vrO2r6Y3mn+sfr9CWzobBg@mail.gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: amit.kapila16@gmail.com, itsajin@gmail.com, sawada.mshk@gmail.com, smithpb2250@gmail.com, houzj.fnst@fujitsu.com, depesz@depesz.com
  Subject: Re: Excessive number of replication slots for 12->14 logical replication
  In-Reply-To: <CAA4eK1JK0zs0H27-i3Pko2na-xt2vrO2r6Y3mn+sfr9CWzobBg@mail.gmail.com>
  References: <20220714115155.GA5439@depesz.com> <CAA4eK1+iccdSM=gdO5K_b5H5UYiw3Fidpyw1_Zi_-MzYRFJExA@mail.gmail.com> <CAD21AoA9hF3XWHe7R6wqUgfx150SEJA-iyKagCA8b7zT2=qk_Q@mail.gmail.com> <CAA4eK1J4H81Nw_Ng9fUaOnVsE5L0GHXz+dVn6HqaPXFEvCuJfA@mail.gmail.com> <CAD21AoA=ep=Qqb_hQm09OHKroMs2eUo1deSiqj5H-shcKpen8Q@mail.gmail.com> <CAFPTHDZbgea5udnJoT2THLQ+6WpwXZHNJYkM=5yUasxxd4CDTw@mail.gmail.com> <CAD21AoD7R=WQGCxLxx1BPK6PKApzuv25tEO0g+ckBhDNZi=oVQ@mail.gmail.com> <CAFPTHDZQ1wGbs08hMb_jG9aeOWQT68qRi_qg7YoCxxeJUHaniA@mail.gmail.com> <CAD21AoD+6iYC7YJr0moJJJykbkPPxs88LMUpbCgoD6OyDT3d_w@mail.gmail.com> <CAFPTHDYbMLxTga3aBYE8pOPgk0K4L44FMz2LokB16PmE4LU=Wg@mail.gmail.com> <CAA4eK1JAE3c6w=cJY5P1m4TpvOsWh6vxnjpGBv_1B8S-tNmWkQ@mail.gmail.com> <CAA4eK1+gVZ8tSemRudU7gj6B3jYOKNSswH0PhEd+kt068ivnCw@mail.gmail.com> <CAFPTHDbY_DOr4zWQzNR5ZaC1eEWz5JtFdH1mp2jKbT83CbaRuw@mail.gmail.com> <CAA4eK1JK0zs0H27-i3Pko2na-xt2vrO2r6Y3mn+sfr9CWzobBg@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox