Re: Reset the output buffer after sending from WalSndWriteData

From: Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>
To: Markus Wanner <markus(dot)wanner(at)enterprisedb(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Reset the output buffer after sending from WalSndWriteData
Date: 2025-02-21 06:17:18
Message-ID: CAD21AoAD_B2yjDwpg5Xvi_evmO_Lm=MinpbZT-soWxuqRWomKQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Feb 20, 2025 at 12:50 PM Markus Wanner
<markus(dot)wanner(at)enterprisedb(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2025-02-21 06:31:01 Re: Missing [NO] INDENT flag in XMLSerialize backward parsing
Previous Message Richard Guo 2025-02-21 06:16:35 Re: Virtual generated columns