Re: PANIC :Call AbortTransaction when transaction id is no normal - Mailing list pgsql-hackers

From Kuntal Ghosh
Subject Re: PANIC :Call AbortTransaction when transaction id is no normal
Date
Msg-id CAGz5QCJKDptF4R0xHzM9YLxbLwZHA9enW9zjOi+vF93HVycVgw@mail.gmail.com
Whole thread Raw
In response to PANIC :Call AbortTransaction when transaction id is no normal  (Thunder <thunder1@126.com>)
Responses Re: PANIC :Call AbortTransaction when transaction id is no normal
List pgsql-hackers
Hello,

On Mon, May 13, 2019 at 10:15 AM Thunder <thunder1@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

pgsql-hackers by date:

Previous
From: Andrew Gierth
Date:
Subject: Re: SQL-spec incompatibilities in similar_escape() and related stuff
Next
From: Masahiko Sawada
Date:
Subject: Re: [Proposal] Table-level Transparent Data Encryption (TDE) and KeyManagement Service (KMS)