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

From: Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com>
To: Zhijie Hou <houzhijie22(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 10:53:01
Message-ID: avGmDSdgyIZB73Sl@bdtpg
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hi,

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.

Regards,

--
Bertrand Drouvot
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Zhijie Hou 2026-11-09 11:46:59 Re: BUG #19839: Assert in ReorderBufferRestoreCleanup for aborted, spilled transaction
Previous Message Dilip Kumar 2026-11-09 10:49:50 Re: BUG #19807: CHECK constraint not enforced on partitioned table when partition overrides a virtual generated colu