Re: Reset the output buffer after sending from WalSndWriteData - Mailing list pgsql-hackers

From Masahiko Sawada
Subject Re: Reset the output buffer after sending from WalSndWriteData
Date
Msg-id CAD21AoAD_B2yjDwpg5Xvi_evmO_Lm=MinpbZT-soWxuqRWomKQ@mail.gmail.com
Whole thread Raw
In response to Reset the output buffer after sending from WalSndWriteData  (Markus Wanner <markus.wanner@enterprisedb.com>)
Responses Re: Reset the output buffer after sending from WalSndWriteData
List pgsql-hackers
On Thu, Feb 20, 2025 at 12:50 PM Markus Wanner
<markus.wanner@enterprisedb.com> wrote:
>
> Hi,
>
> I recently stumbled over an issue with an unintentional re-transmission.
> While this clearly was our fault in the output plugin code, I think the
> walsender's exposed API could easily be hardened to prevent the bad
> consequence from this mistake.
>
> Does anything speak against the attached one line patch?

According to the documentation[1], OutputPluginPrepareWrite() has to
be called before OutputPluginWrite(). When it comes to walsender
codes, we reset the ctx->out buffer in WalSndPrepareWrite() called via
OutputPluginPrepareWrite(). Could you share the case where you faced
the unintentional re-transmission error?

Regards,

[1] https://www.postgresql.org/docs/devel/logicaldecoding-output-plugin.html#LOGICALDECODING-OUTPUT-PLUGIN-OUTPUT

--
Masahiko Sawada
Amazon Web Services: https://aws.amazon.com



pgsql-hackers by date:

Previous
From: Richard Guo
Date:
Subject: Re: Virtual generated columns
Next
From: Michael Paquier
Date:
Subject: Re: Missing [NO] INDENT flag in XMLSerialize backward parsing