Andy Fan <zhihuifan1213(at)163(dot)com> 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