Hello,

On Mon, May 13, 2019 at 10:15 AM Thunder <thund...@126.com> wrote:

> I try to fix this issue and check whether it's normal transaction id
> before we do abort.
>
> diff --git a/src/backend/access/transam/xact.c
> b/src/backend/access/transam/xact.c
> index 20feeec327..dbf2bf567a 100644
> --- a/src/backend/access/transam/xact.c
> +++ b/src/backend/access/transam/xact.c
> @@ -4504,8 +4504,13 @@ RollbackAndReleaseCurrentSubTransaction(void)
>  void
>  AbortOutOfAnyTransaction(void)
>  {
> +       TransactionId xid = GetCurrentTransactionIdIfAny();
>         TransactionState s = CurrentTransactionState;
>
> +       /* Check to see if the transaction ID is a permanent one because
> we cannot abort it */
> +       if (!TransactionIdIsNormal(xid))
> +               return;
> +
>         /* Ensure we're not running in a doomed memory context */
>         AtAbort_Memory();
>
> Can we fix in this way?
>
> If we fix the issue in this way, we're certainly not going to do all those
portal,locks,memory,resource owner cleanups that are done
inside AbortTransaction() for a normal transaction ID. But, I'm not sure
how relevant those steps are since the database is anyway shutting down.

-- 
Thanks & Regards,
Kuntal Ghosh
EnterpriseDB: http://www.enterprisedb.com

Reply via email to