Re: [HACKERS] warning in twophase.c - Mailing list pgsql-hackers

From Jeevan Ladhe
Subject Re: [HACKERS] warning in twophase.c
Date
Msg-id CAOgcT0NKmOtG_Qx+xmEiFQf7f8qdKpDrhKk++uqaR92JBV1Oag@mail.gmail.com
Whole thread Raw
In response to [HACKERS] warning in twophase.c  (Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>)
Responses Re: [HACKERS] warning in twophase.c  (Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>)
List pgsql-hackers
I have also been seeing this warning lately, I had tried to check git log, and
seems like following commit 546c13e11b29 by Simon has introduced it. 

But per the commit log, this seems to be a temporary arrangement:

commit 546c13e11b29a5408b9d6a6e3cca301380b47f7f
Author: Simon Riggs <simon@2ndQuadrant.com>
Date:   Sun Apr 23 22:12:01 2017 +0100

    Workaround for RecoverPreparedTransactions()
    
    Force overwriteOK = true while we investigate deeper fix
    
    Proposed by Tom Lane as temporary measure, accepted by me

With latest update on following thread, it seems like Simon has proposed a fix
that gets rid of flag overwriteOK:


Regards,
Jeevan Ladhe

On Tue, Apr 25, 2017 at 6:36 AM, Amit Langote <Langote_Amit_f8@lab.ntt.co.jp> wrote:
Been seeing this warning recently:

twophase.c: In function ‘RecoverPreparedTransactions’:
twophase.c:1916:9: warning: variable ‘overwriteOK’ set but not used
[-Wunused-but-set-variable]
   bool  overwriteOK = false;
         ^~~~~~~~~~~

As the message says, the value of overwriteOK is not used anywhere in
RecoverPreparedTransactions:

         bool        overwriteOK = false;

        /*
         * It's possible that SubTransSetParent has been set before, if
         * the prepared transaction generated xid assignment records. Test
         * here must match one used in AssignTransactionId().
         */
        if (InHotStandby && (hdr->nsubxacts >= PGPROC_MAX_CACHED_SUBXIDS ||
                             XLogLogicalInfoActive()))
            overwriteOK = true;

Couldn't we get rid of it?

Thanks,
Amit



--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

pgsql-hackers by date:

Previous
From: David Rowley
Date:
Subject: Re: [HACKERS] Incorrect use of ERRCODE_UNDEFINED_COLUMN in extended stats
Next
From: Amit Langote
Date:
Subject: Re: [HACKERS] warning in twophase.c