Re: 回复:Re: BUG #18118: bug report for COMMIT AND CHAIN feature
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: 刘相(佑熙) <evan.lx@alibaba-inc.com>
Cc: "Laurenz Albe" <laurenz.albe@cybertec.at>,
"pgsql-bugs" <pgsql-bugs@lists.postgresql.org>
Date: 2023-09-21T16:16:56Z
Lists: pgsql-bugs
"=?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
Commits
-
Fix COMMIT/ROLLBACK AND CHAIN in the presence of subtransactions.
- 7cabb20a95ae 12.17 landed
- 77dc81602789 15.5 landed
- 555a8d9d37a2 13.13 landed
- 10323f140fef 14.10 landed
- 48e2b234f822 17.0 landed
- 227c7cf15602 16.1 landed
-
Don't use static storage for SaveTransactionCharacteristics().
- 12d768e70497 15.0 cited
-
Transaction chaining
- 280a408b48d5 12.0 cited