Re: [PATCH] Writing changes of decoding plugin in the memory context where data is kept?

From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: Andres Freund <andres(at)2ndquadrant(dot)com>
Cc: PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [PATCH] Writing changes of decoding plugin in the memory context where data is kept?
Date: 2014-05-15 00:42:26
Message-ID: CAB7nPqT+1fHBSgbJwz7qjt0G_-n_VP+iVoyGMTh7qsip08BaaA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, May 15, 2014 at 9:18 AM, Andres Freund <andres(at)2ndquadrant(dot)com> wrote:
> On 2014-05-15 09:11:15 +0900, Michael Paquier wrote:
>> When working on a decoder plugin, I have been pointed that it is
>> incorrect to write changes in an output plugin while not being in the
>> memory context where changes are written.
>
> That was a misunderstanding. It's perfectly alright to do so. The 'bug'
> you have is that you sometimes wrote empty messages. Which
> pg_recvlogical doesn't accept. There's little reason to allow doing so,
> but for consistency we could probably ok to allow it.
Yeah, thanks. Pushed a fix. Also I imagine that this is not really a
problem, but is there an impact on the plugin if
OutputPluginPrepareWrite is called and OutputPluginWrite is not for a
single change? By looking at the code I am guessing that we use
WalSndPrepareWrite for a plugin to prepare a message, and then
WalSndWriteData to finish the work, so we end up with an empty message
that is not sent to the backend. It doesn't matter much for
test_decoding as it always writes a change, but shouldn't we
discourage users to do so in the documentation? Something like a
big-fat warning mentioning that using OutputPluginPrepareWrite called
without OutputPluginWrite may result in stall messages stuck in the
queue?
--
Michael

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Jeff Janes 2014-05-15 00:46:49 Re: Freezing without write I/O
Previous Message Tom Lane 2014-05-15 00:30:01 Re: buildfarm / handling (undefined) locales