pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: 刘相(佑熙) <evan.lx@alibaba-inc.com>
Cc: Laurenz Albe <laurenz.albe@cybertec.at>
Cc: pgsql-bugs <pgsql-bugs@lists.postgresql.org>
Subject: Re: 回复:Re: BUG #18118: bug report for COMMIT AND CHAIN feature
Date: Thu, 21 Sep 2023 12:16:56 -0400
Message-ID: <710008.1695313016@sss.pgh.pa.us> (raw)
In-Reply-To: <511e16d9-9deb-44d8-a64f-712bd18ebc12.evan.lx@alibaba-inc.com>
References: <18118-4b72fcbb903aace6@postgresql.org>
	<a2b1d633e39041d57f6d43e9e14d9fd1877a5e1c.camel@cybertec.at>
	<511e16d9-9deb-44d8-a64f-712bd18ebc12.evan.lx@alibaba-inc.com>

"=?UTF-8?B?5YiY55u4KOS9keeGmSk=?=" <evan.lx@alibaba-inc.com> writes:
> This problem seems to have been solved in v15 and v16. Because of this patch (12d768e70497afc5a57acf73c251316997b5175a), the use of static variables has been cancelled. But this problem can obviously be reproduced on v14(and perhaps v12 v13). Try the following SQL again.

Oooh ... I see the problem.  It's not really about the use of static
variables.  In the older branches, CommitTransactionCommand does

	if (s->chain)
		SaveTransactionCharacteristics();

....

				if (s->chain)
					RestoreTransactionCharacteristics();

but if we're closing out any subtransactions then *those two checks
are inspecting different "s" structs*, and the "chain" flag has
only been set in the bottom of the state stack.

12d768e70 fixed the problem rather accidentally, because I removed the
initial "if (s->chain)" test to avoid a compiler warning.  I think we
can just do the same in the back branches, without having to address
the question of whether it'd be OK to break API for
SaveTransactionCharacteristics and RestoreTransactionCharacteristics.

			regards, tom lane





view thread (2+ messages)

Message-ID: <710008.1695313016@sss.pgh.pa.us>
Permalink:  ../710008.1695313016@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/710008.1695313016@sss.pgh.pa.us

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, evan.lx@alibaba-inc.com, laurenz.albe@cybertec.at, pgsql-bugs@lists.postgresql.org
  Subject: Re: 回复:Re: BUG #18118: bug report for COMMIT AND CHAIN feature
  In-Reply-To: <710008.1695313016@sss.pgh.pa.us>

* 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