pg.ddx.io pgsql-bugs@postgresql.org mailing list archive
help / color / mirror / Atom feed 回复:Re: BUG #18118: bug report for COMMIT AND CHAIN feature
2+ messages / 2 participants
[nested] [flat]
* 回复:Re: BUG #18118: bug report for COMMIT AND CHAIN feature
@ 2023-09-21 07:12 刘相(佑熙) <evan.lx@alibaba-inc.com>
2023-09-21 16:16 ` Re: 回复:Re: BUG #18118: bug report for COMMIT AND CHAIN feature Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 1 reply; 2+ messages in thread
From: 刘相(佑熙) @ 2023-09-21 07:12 UTC (permalink / raw)
To: Laurenz Albe <laurenz.albe@cybertec.at>; pgsql-bugs <pgsql-bugs@lists.postgresql.org>
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.
START TRANSACTION ISOLATION LEVEL SERIALIZABLE; COMMIT AND CHAIN; COMMIT ;
START TRANSACTION ISOLATION LEVEL SERIALIZABLE; COMMIT ;
START TRANSACTION ISOLATION LEVEL REPEATABLE READ; savepoint s; COMMIT AND CHAIN;
SHOW transaction_isolation; -- transaction is active at this point
COMMIT;------------------------------------------------------------------
发件人:Laurenz Albe<laurenz.albe@cybertec.at>
日 期:2023年09月21日 14:41:20
收件人:刘相(佑熙)<evan.lx@alibaba-inc.com>; <pgsql-bugs@lists.postgresql.org>
主 题:Re: BUG #18118: bug report for COMMIT AND CHAIN feature
On Wed, 2023-09-20 at 09:31 +0000, PG Bug reporting form wrote:
> PostgreSQL version: 14.9
> Operating system: centos7
> Description:
>
> COMMIT(280a408b48d5ee42969f981bceb9e9426c3a344c) provides a way to support
> chained commits. During recent development, I found that it left a flaw.
>
> The defect can be reproduced as follows:
>
> START TRANSACTION ISOLATION LEVEL SERIALIZABLE; COMMIT;
> START TRANSACTION ISOLATION LEVEL REPEATABLE READ\; savepoint s\; COMMIT AND
> CHAIN;
> SHOW transaction_isolation; -- transaction is active at this point
> COMMIT;
>
> will get:
> postgres=*# SHOW transaction_isolation; -- transaction is active at this
> point
> transaction_isolation
> -----------------------
> serializable
> (1 row)
I tried to reproduce that and failed, both with v14 and v16.
For me, "transaction_isolation" is "repeatable read".
Yours,
Laurenz Albe
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: 回复:Re: BUG #18118: bug report for COMMIT AND CHAIN feature
2023-09-21 07:12 回复:Re: BUG #18118: bug report for COMMIT AND CHAIN feature 刘相(佑熙) <evan.lx@alibaba-inc.com>
@ 2023-09-21 16:16 ` Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 0 replies; 2+ messages in thread
From: Tom Lane @ 2023-09-21 16:16 UTC (permalink / raw)
To: 刘相(佑熙) <evan.lx@alibaba-inc.com>; +Cc: Laurenz Albe <laurenz.albe@cybertec.at>; pgsql-bugs <pgsql-bugs@lists.postgresql.org>
"=?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
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2023-09-21 16:16 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2023-09-21 07:12 回复:Re: BUG #18118: bug report for COMMIT AND CHAIN feature 刘相(佑熙) <evan.lx@alibaba-inc.com>
2023-09-21 16:16 ` Tom Lane <tgl@sss.pgh.pa.us>
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