pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Kyotaro HORIGUCHI <horiguchi.kyotaro@lab.ntt.co.jp>
Cc: a.zakirov@postgrespro.ru
Cc: pgsql-hackers@postgresql.org
Subject: Re: pg_upgrade: exit_hook_registered variable
Date: Thu, 28 Jul 2016 10:58:24 -0400
Message-ID: <4782.1469717904@sss.pgh.pa.us> (raw)
In-Reply-To: <20160728.192100.59056316.horiguchi.kyotaro@lab.ntt.co.jp>
References: <d279e817-02b5-caa6-215f-cfb05dce109a@postgrespro.ru>
	<20160728.192100.59056316.horiguchi.kyotaro@lab.ntt.co.jp>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>

Kyotaro HORIGUCHI <horiguchi.kyotaro@lab.ntt.co.jp> writes:
>> I noticed that exit_hook_registered variable in start_postmaster() is
>> local variable. Shouldn't it be a static variable?

> Good catch! It is totally useless unless being static.

Indeed.

> But I think it is not necessary to go outside
> start_postmaster. Just being static staying in start_postmaster
> is enough.

I agree, since there's no need for any other function to touch it.
But personally I'd want to visually separate the static variable
from the non-static ones.  So maybe like this:

{
	char		cmd[MAXPGPATH * 4 + 1000];
	PGconn	   *conn;
-	bool		exit_hook_registered = false;
	bool		pg_ctl_return = false;
	char		socket_string[MAXPGPATH + 200];
+
+	static bool	exit_hook_registered = false;

	if (!exit_hook_registered)
	{


Will push it in a bit.

			regards, tom lane


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



view thread (4+ messages)  latest in thread

Message-ID: <4782.1469717904@sss.pgh.pa.us>
Permalink:  ../4782.1469717904@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/4782.1469717904@sss.pgh.pa.us

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-hackers@postgresql.org
  Cc: tgl@sss.pgh.pa.us, horiguchi.kyotaro@lab.ntt.co.jp, a.zakirov@postgrespro.ru
  Subject: Re: pg_upgrade: exit_hook_registered variable
  In-Reply-To: <4782.1469717904@sss.pgh.pa.us>
  References: <d279e817-02b5-caa6-215f-cfb05dce109a@postgrespro.ru> <20160728.192100.59056316.horiguchi.kyotaro@lab.ntt.co.jp> <4782.1469717904@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox