public inbox for [email protected]
help / color / mirror / Atom feedFrom: Andy Fan <[email protected]>
To: PostgreSQL Hackers <[email protected]>
Subject: Re: raise ERROR between EndPrepare and PostPrepare_Locks causes ROLLBACK 2pc PAINC
Date: Wed, 25 Mar 2026 08:39:07 +0800
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>
Andy Fan <[email protected]> writes:
> Hi,
>
> With the following hack in PrepareTransaction:
>
> @@ -2697,6 +2697,8 @@ PrepareTransaction(void)
> */
> EndPrepare(gxact);
>
> + elog(ERROR, "some error");
> +
> /*
> * Now we clean up backend-internal state and release internal resources.
> */
>
> Then we can do the following test:
> CREATE TABLE t(a int);
> begin;
> insert into t values(1);
> prepare transaction 'foo';
> ERROR: some error. // before the lock transfer
> rollback prepared 'foo';
> PANIC: failed to re-find shared lock object // because lock is released
> when ERROR.
I found a similar but not exactly same case at 2014 [1] which
might be helpful to recall a boarder understanding on this area.
[1] https://www.postgresql.org/message-id/534AF601.1030007%40vmware.com
--
Best Regards
Andy Fan
view thread (4+ messages) latest in thread
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: [email protected]
Cc: [email protected], [email protected]
Subject: Re: raise ERROR between EndPrepare and PostPrepare_Locks causes ROLLBACK 2pc PAINC
In-Reply-To: <[email protected]>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox