pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
To: Zhijie Hou <houzhijie22@gmail.com>
Cc: Atisss hh <125atishprak@gmail.com>
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #19839: Assert in ReorderBufferRestoreCleanup for aborted, spilled transaction
Date: Mon, 9 Nov 2026 10:53:01 +0000
Message-ID: <avGmDSdgyIZB73Sl@bdtpg> (raw)
In-Reply-To: <1da45744-968f-4f40-addf-dc085e928ec5@gmail.com>
References: <19839-ead02c2208a3f8bd@postgresql.org>
	<CAGqfTtvQB4J0dJFnNMAF9LCAJhGBe5THd2R_=MxTHP5C5vwD=w@mail.gmail.com>
	<1da45744-968f-4f40-addf-dc085e928ec5@gmail.com>

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






view thread (7+ messages)  latest in thread

Message-ID: <avGmDSdgyIZB73Sl@bdtpg>
Permalink:  ../avGmDSdgyIZB73Sl@bdtpg/
Also on:    postgresql.org/message-id/avGmDSdgyIZB73Sl@bdtpg

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: bertranddrouvot.pg@gmail.com, houzhijie22@gmail.com, 125atishprak@gmail.com
  Subject: Re: BUG #19839: Assert in ReorderBufferRestoreCleanup for aborted, spilled transaction
  In-Reply-To: <avGmDSdgyIZB73Sl@bdtpg>
  References: <19839-ead02c2208a3f8bd@postgresql.org> <CAGqfTtvQB4J0dJFnNMAF9LCAJhGBe5THd2R_=MxTHP5C5vwD=w@mail.gmail.com> <1da45744-968f-4f40-addf-dc085e928ec5@gmail.com> <avGmDSdgyIZB73Sl@bdtpg>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox