Re: Any objections to implementing LogicalDecodeMessageCB for pgoutput?
Amit Kapila <amit.kapila16@gmail.com>
From: Amit Kapila <amit.kapila16@gmail.com>
To: Euler Taveira <euler.taveira@2ndquadrant.com>
Cc: David Pirotte <dpirotte@gmail.com>,
Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>, Dave Cramer <davecramer@gmail.com>, Michael Paquier <michael@paquier.xyz>, Andres Freund <andres@anarazel.de>,
PostgreSQL-development <pgsql-hackers@postgresql.org>, Ashutosh Bapat <ashutosh.bapat@enterprisedb.com>
Date: 2021-04-01T10:19:01Z
Lists: pgsql-hackers
On Wed, Nov 25, 2020 at 8:58 AM Euler Taveira
<euler.taveira@2ndquadrant.com> wrote:
>
> On Wed, 18 Nov 2020 at 03:04, David Pirotte <dpirotte@gmail.com> wrote:
>>
>> On Fri, Nov 6, 2020 at 7:05 AM Ashutosh Bapat <ashutosh.bapat.oss@gmail.com> wrote:
>>>
>>> +/*
>>> + * Write MESSAGE to stream
>>> + */
>>> +void
>>> +logicalrep_write_message(StringInfo out, ReorderBufferTXN *txn, XLogRecPtr lsn,
>>> + bool transactional, const char *prefix, Size sz,
>>> + const char *message)
>>> +{
>>> + uint8 flags = 0;
>>> +
>>> + pq_sendbyte(out, LOGICAL_REP_MSG_MESSAGE);
>>> +
>>>
>>> Similar to the UPDATE/DELETE/INSERT records decoded when streaming is being
>>> used, we need to add transaction id for transactional messages. May be we add
>>> that even in case of non-streaming case and use it to decide whether it's a
>>> transactional message or not. That might save us a byte when we are adding a
>>> transaction id.
>>
>>
> I also reviewed your patch. This feature would be really useful for replication
> scenarios. Supporting this feature means that you don't need to use a table to
> pass messages from one node to another one. Here are a few comments/ideas.
>
Your ideas/suggestions look good to me. Don't we need to provide a
read function corresponding to logicalrep_write_message? We have it
for other write functions. Can you please combine all of your changes
into one patch?
--
With Regards,
Amit Kapila.
Commits
-
Allow pgoutput to send logical decoding messages.
- ac4645c0157f 14.0 landed
-
Refactor function parse_output_parameters.
- 531737ddad21 14.0 landed