Re: BUG #19839: Assert in ReorderBufferRestoreCleanup for aborted, spilled transaction

From: Zhijie Hou <houzhijie22(at)gmail(dot)com>
To: Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com>
Cc: Atisss hh <125atishprak(at)gmail(dot)com>, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #19839: Assert in ReorderBufferRestoreCleanup for aborted, spilled transaction
Date: 2026-11-09 11:46:59
Message-ID: ba2ec30c-e381-4422-913b-24afb4263fc8@gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hi,

On Mon, Nov 9, 2026 at 06:53 PM Bertrand Drouvot wrote:
>
> On Sun, Nov 08, 2026 at 11:11:09PM +0800, Zhijie Hou wrote:
> > Thanks for the report and patch.
>
> +1.
>
> > See the attachment for a test to reproduce this issue. (Feel free to merge
> > if it's worth adding a test to cover this path)
>
> > I think in a rare case, this can also affect the stats collection
> > for spilled txns. For example, if an empty subtransaction is marked
> > as
> > serialized, we skip incrementing spillTxns because no changes were written;
> > if real changes are later serialized in this subtransaction, we still do not
> > increment spillTxns because the subtransaction is already marked as
> > serialized and we avoid counting it "twice".
>
> Agreed.
>
> That's why I think the test is worth adding (as the bug could also
> produce real user visible impact as it can cause spill_txns to be
> undercounted on non assert enabled builds). The test only detects the
> regression on assert enabled builds, but I think that is enough. A
> test for the spill_txns case would be more complicated and is probably
> not worth it.
>
> >
> > + if (spilled)
> > + txn->txn_flags |= RBTXN_IS_SERIALIZED;
> >
> > ReorderBufferSerializeTXN() already has an "if (spilled)" block
> > right above this, so we shall directly move the assignment into that
> > block.
>
> +1.

Thanks for the review. It looks like Atisss's update patches didn't
reach the list, probably a missing Reply-All, so I'm helping to attach
the same patches (provided by Atisss) here.

--
Best Regards,
Zhijie Hou

Attachment Content-Type Size
v2-0001-fix-empty-subxact-serialized-flag.patch text/x-patch 4.7 KB
v2-REL_14_STABLE.patch text/x-patch 3.3 KB
v2-REL_17_STABLE.patch text/x-patch 3.2 KB

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Amit Langote 2026-11-09 12:58:52 Re: SQL/JSON PASSING fails for char(n), name and domains over text
Previous Message Bertrand Drouvot 2026-11-09 10:53:01 Re: BUG #19839: Assert in ReorderBufferRestoreCleanup for aborted, spilled transaction