Re: pg_decode_message vs skip_empty_xacts and xact_wrote_changes - Mailing list pgsql-hackers

From Amit Kapila
Subject Re: pg_decode_message vs skip_empty_xacts and xact_wrote_changes
Date
Msg-id CAA4eK1JLRiW_Mkps+oGu_a1DZHJqhoXV9Ru33B4hV5UYUtLPJg@mail.gmail.com
Whole thread Raw
In response to pg_decode_message vs skip_empty_xacts and xact_wrote_changes  (Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>)
Responses Re: pg_decode_message vs skip_empty_xacts and xact_wrote_changes
List pgsql-hackers
On Mon, Jun 26, 2023 at 3:07 PM Ashutosh Bapat
<ashutosh.bapat.oss@gmail.com> wrote:
>
> Hi All,
> Every pg_decode routine except pg_decode_message  that decodes a
> transactional change, has following block
> /* output BEGIN if we haven't yet */
> if (data->skip_empty_xacts && !txndata->xact_wrote_changes)
> {
> pg_output_begin(ctx, data, txn, false);
> }
> txndata->xact_wrote_changes = true;
>
> But pg_decode_message() doesn't call pg_output_begin(). If a WAL
> message is the first change in the transaction, it won't have a BEGIN
> before it. That looks like a bug. Why is pg_decode_message()
> exception?
>

I can't see a reason why we shouldn't have a similar check for
transactional messages. So, agreed this is a bug.

--
With Regards,
Amit Kapila.



pgsql-hackers by date:

Previous
From: Ashutosh Bapat
Date:
Subject: pg_decode_message vs skip_empty_xacts and xact_wrote_changes
Next
From: Amit Kapila
Date:
Subject: Re: Synchronizing slots from primary to standby