pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Zhijie Hou <houzhijie22@gmail.com>
To: Masahiko Sawada <sawada.mshk@gmail.com>
To: Ajin Cherian <itsajin@gmail.com>
Cc: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Cc: Amit Kapila <amit.kapila16@gmail.com>
Cc: Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
Cc: Chao Li <li.evan.chao@gmail.com>
Cc: Fujii Masao <masao.fujii@gmail.com>
Cc: PostgreSQL-development <pgsql-hackers@postgresql.org>
Subject: Re: Add a hook for handling logical decoding messages on subscribers.
Date: Tue, 1 Dec 2026 17:06:38 +0800
Message-ID: <1b885669-20a1-4d62-91de-885427e1d029@gmail.com> (raw)
In-Reply-To: <CAD21AoA91YO+72AMyaBYBjs1n9owoJG17K1k1nJwh-gqmO2w9w@mail.gmail.com>
References: <CALj2ACVj+khUL=8Y3ukqJ6uF8cr0kmY6Q++fxJKYZ4P4bww=AA@mail.gmail.com>
	<CALj2ACVuHCZJ2vdrbB22LG77gCjwsw2DYcqNEy8GuHuKe_1Agg@mail.gmail.com>
	<CAD21AoD5rwBPQv-_dGZEdsgzL7H1KywpsAd5HD3-DWKGQ5oTeQ@mail.gmail.com>
	<b9b5bd27-6416-48b4-8f73-c5a60e2c97e2@gmail.com>
	<CAA4eK1J1Jdz6DunCPWJ2KCpGbSERxgv+xydXkTa+19GgG5dPOA@mail.gmail.com>
	<CAD21AoAhdXE1+i_bfGx3H=MheEizysk8uRirkZ3Y-v=AJzVvYw@mail.gmail.com>
	<CAD21AoC-pOvm54YzNiihFS90kSDRWr=qG6BE-9HW-YW=tqRubw@mail.gmail.com>
	<CAD21AoAWtvvHi1F2kSU2wOvNxfSDzQWNXYW4yL4B4Ttoq-Ek7A@mail.gmail.com>
	<CAA4eK1K3ypFDLk1R1DEx7YqCRbjNLTtJPP5+FfcX0F63rQ+Ekg@mail.gmail.com>
	<avWPil2vQXgXQBn+@bdtpg>
	<CAD21AoDQdj2xouprHesGvSFGVwZYJJp=qZfgUL6m_HLdEMvaoQ@mail.gmail.com>
	<4d9e1d2f-27a2-40ec-92c8-4b5740736cf8@gmail.com>
	<CAD21AoCbrcp=E5M4uMxfHLXsJsKfDscBoy-Bfhvqt6YuMhOEgw@mail.gmail.com>
	<CAFPTHDaWcPj8PV69+SBn4NF+VwMYWiDtf3PwcWC0d2OWgB0x6g@mail.gmail.com>
	<CAD21AoA91YO+72AMyaBYBjs1n9owoJG17K1k1nJwh-gqmO2w9w@mail.gmail.com>

Hi,

On Sat, Nov21, 2026 at 02:35 AM Masahiko Sawada wrote:
> Good find. Since we already treat msg.lsn as the position the message
> is applied at when reporting the flush position, it makes sense to
> advance the origin to it as well, as we do for commits.
>
> Given that we’ve agreed on the 0001 patch, I’m going to push it early
> next week, barring any objections. I’d like to hold off on the 0002
> patch to give it more review time.

Thanks for pushing 0001!

I reviewed 0002 and have few comments:

1.

+	if (!MySubscription->messages || am_tablesync_worker())
+		ereport(ERROR,
+				(errcode(ERRCODE_PROTOCOL_VIOLATION),
+				 errmsg_internal("MESSAGE message received but messages are not 
enabled for this worker")));

I hit the above internal error in a parallel apply worker when disabling 
the "messages" option. I think the reason is that the parallel apply 
worker could re-read the subscription info earlier than the leader 
worker; since parallel apply workers don't exit on option changes (see 
apply_worker_exit()), it updated MySubscription->messages to false and 
then processed an in-flight MESSAGE sent by the leader, triggering this 
error. Maybe we can skip the !MySubscription->messages check in parallel 
apply workers to avoid this.

2.

The ordering of the "submessages" column in catalogs.sgml (and 
system_views.sql) differs from pg_subscription.h, where "submessages" is 
placed before "subconflictlogdest".

-- 
Best Regards,
Zhijie Hou






view thread (60+ messages)  latest in thread

Message-ID: <1b885669-20a1-4d62-91de-885427e1d029@gmail.com>
Permalink:  ../1b885669-20a1-4d62-91de-885427e1d029@gmail.com/
Also on:    postgresql.org/message-id/1b885669-20a1-4d62-91de-885427e1d029@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-hackers@postgresql.org
  Cc: houzhijie22@gmail.com, sawada.mshk@gmail.com, itsajin@gmail.com, bertranddrouvot.pg@gmail.com, amit.kapila16@gmail.com, bharath.rupireddyforpostgres@gmail.com, li.evan.chao@gmail.com, masao.fujii@gmail.com
  Subject: Re: Add a hook for handling logical decoding messages on subscribers.
  In-Reply-To: <1b885669-20a1-4d62-91de-885427e1d029@gmail.com>
  References: <CALj2ACVj+khUL=8Y3ukqJ6uF8cr0kmY6Q++fxJKYZ4P4bww=AA@mail.gmail.com> <CAD21AoD5rwBPQv-_dGZEdsgzL7H1KywpsAd5HD3-DWKGQ5oTeQ@mail.gmail.com> <b9b5bd27-6416-48b4-8f73-c5a60e2c97e2@gmail.com> <CAA4eK1J1Jdz6DunCPWJ2KCpGbSERxgv+xydXkTa+19GgG5dPOA@mail.gmail.com> <CAD21AoAhdXE1+i_bfGx3H=MheEizysk8uRirkZ3Y-v=AJzVvYw@mail.gmail.com> <CAD21AoC-pOvm54YzNiihFS90kSDRWr=qG6BE-9HW-YW=tqRubw@mail.gmail.com> <CAD21AoAWtvvHi1F2kSU2wOvNxfSDzQWNXYW4yL4B4Ttoq-Ek7A@mail.gmail.com> <CAA4eK1K3ypFDLk1R1DEx7YqCRbjNLTtJPP5+FfcX0F63rQ+Ekg@mail.gmail.com> <avWPil2vQXgXQBn+@bdtpg> <CAD21AoDQdj2xouprHesGvSFGVwZYJJp=qZfgUL6m_HLdEMvaoQ@mail.gmail.com> <4d9e1d2f-27a2-40ec-92c8-4b5740736cf8@gmail.com> <CAD21AoCbrcp=E5M4uMxfHLXsJsKfDscBoy-Bfhvqt6YuMhOEgw@mail.gmail.com> <CAFPTHDaWcPj8PV69+SBn4NF+VwMYWiDtf3PwcWC0d2OWgB0x6g@mail.gmail.com> <CAD21AoA91YO+72AMyaBYBjs1n9owoJG17K1k1nJwh-gqmO2w9w@mail.gmail.com> <1b885669-20a1-4d62-91de-885427e1d029@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