pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Nathan Bossart <nathandbossart@gmail.com>
To: Amit Kapila <amit.kapila16@gmail.com>
Cc: Melih Mutlu <m.melihmutlu@gmail.com>
Cc: Thomas Munro <thomas.munro@gmail.com>
Cc: Hayato Kuroda (Fujitsu) <kuroda.hayato@fujitsu.com>
Cc: pgsql-hackers@postgresql.org <pgsql-hackers@postgresql.org>
Subject: Re: wake up logical workers after ALTER SUBSCRIPTION
Date: Tue, 3 Jan 2023 10:21:55 -0800
Message-ID: <20230103182155.GC204418@nathanxps13> (raw)
In-Reply-To: <CAA4eK1Kr+aAaKVwKgy3kyQzuTDuc+_ahEaaOMe3ZF4SyZQSG+Q@mail.gmail.com>
References: <CA+hUKGJXO6LUn3wTf3s0Z8DvgbQROxPTnJDHCsQrhbr3pF3g8Q@mail.gmail.com>
	<20221130050441.GA1677223@nathanxps13>
	<20221202002130.GA2124877@nathanxps13>
	<20221202192101.GB2277157@nathanxps13>
	<CAGPVpCTUuKyxB5f3exgDMBRTivbN5uHVkD=YfXmgznrdnwVOQw@mail.gmail.com>
	<20221206192551.GA3078082@nathanxps13>
	<20221206212954.GA3403597@nathanxps13>
	<CAGPVpCTkdaOyBLXB435VXq0RA1cHLFQut7BPm6t8D4dsdiEXZQ@mail.gmail.com>
	<20221207181145.GA3698731@nathanxps13>
	<CAA4eK1Kr+aAaKVwKgy3kyQzuTDuc+_ahEaaOMe3ZF4SyZQSG+Q@mail.gmail.com>

On Tue, Jan 03, 2023 at 11:43:59AM +0530, Amit Kapila wrote:
> On Wed, Dec 7, 2022 at 11:42 PM Nathan Bossart <nathandbossart@gmail.com> wrote:
>> After sleeping on this, I think we can do better.  IIUC we can simply check
>> for AllTablesyncsReady() at the end of process_syncing_tables_for_apply()
>> and wake up the logical replication workers (which should just consiѕt of
>> setting the current process's latch) if we are ready for two_phase mode.
> 
> How just waking up will help with two_phase mode? For that, we need to
> restart the apply worker as we are doing at the beginning of
> process_syncing_tables_for_apply().

Right.  IIRC waking up causes the apply worker to immediately call
process_syncing_tables_for_apply() again, which will then proc_exit(0) as
appropriate.  It might be possible to move the restart logic to the end of
process_syncing_tables_for_apply() to avoid this extra wakeup.  WDYT?

-- 
Nathan Bossart
Amazon Web Services: https://aws.amazon.com





view thread (77+ messages)  latest in thread

Message-ID: <20230103182155.GC204418@nathanxps13>
Permalink:  ../20230103182155.GC204418@nathanxps13/
Also on:    postgresql.org/message-id/20230103182155.GC204418@nathanxps13

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 using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: nathandbossart@gmail.com, amit.kapila16@gmail.com, m.melihmutlu@gmail.com, thomas.munro@gmail.com, kuroda.hayato@fujitsu.com
  Subject: Re: wake up logical workers after ALTER SUBSCRIPTION
  In-Reply-To: <20230103182155.GC204418@nathanxps13>

* 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