Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bSmle-0002KL-IM for pgsql-hackers@arkaria.postgresql.org; Thu, 28 Jul 2016 14:58:34 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bSmld-00022g-Ty for pgsql-hackers@arkaria.postgresql.org; Thu, 28 Jul 2016 14:58:33 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bSmlc-000221-L6 for pgsql-hackers@postgresql.org; Thu, 28 Jul 2016 14:58:32 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bSmla-0005he-BP for pgsql-hackers@postgresql.org; Thu, 28 Jul 2016 14:58:31 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id u6SEwOx3004783; Thu, 28 Jul 2016 10:58:24 -0400 From: Tom Lane To: Kyotaro HORIGUCHI cc: a.zakirov@postgrespro.ru, pgsql-hackers@postgresql.org Subject: Re: pg_upgrade: exit_hook_registered variable In-reply-to: <20160728.192100.59056316.horiguchi.kyotaro@lab.ntt.co.jp> References: <20160728.192100.59056316.horiguchi.kyotaro@lab.ntt.co.jp> Comments: In-reply-to Kyotaro HORIGUCHI message dated "Thu, 28 Jul 2016 19:21:00 +0900" Date: Thu, 28 Jul 2016 10:58:24 -0400 Message-ID: <4782.1469717904@sss.pgh.pa.us> X-Pg-Spam-Score: -3.2 (---) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org Kyotaro HORIGUCHI 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