On Wed, Nov 20, 2013 at 10:21 AM, Peter Eisentraut <pete...@gmx.net> wrote:
> On 11/5/13, 2:47 AM, Gurjeet Singh wrote:
> > On Mon, Nov 4, 2013 at 12:20 AM, Tom Lane <t...@sss.pgh.pa.us
> > <mailto:t...@sss.pgh.pa.us>> wrote:
> > But we're not buying much. A few instructions during postmaster
> > shutdown
> > is entirely negligible.
> > The patch is for ClosePostmasterPorts(), which is called from every
> > child process startup sequence (as $subject also implies), not in
> > postmaster shutdown. I hope that adds some weight to the argument.
> If there is a concern about future maintenance, you could add assertions
> (in appropriate compile mode) that the rest of the array is indeed
> PGINVALID_SOCKET. I think that could be a win for both performance and
Makes sense! Does the attached patch look like what you expected? I also
added a comment to explain the expectation.
Thanks and best regards,
Gurjeet Singh http://gurjeet.singh.im/
EDB Inc. www.EnterpriseDB.com <http://www.enterprisedb.com>
diff --git a/src/backend/postmaster/postmaster.c b/src/backend/postmaster/postmaster.c
index ccb8b86..9efc9fa 100644
@@ -2236,6 +2236,20 @@ ClosePostmasterPorts(bool am_syslogger)
ListenSocket[i] = PGINVALID_SOCKET;
+ * Do not process the rest of the array elements since we expect
+ * the presence of an invalid socket id to mark the end of valid
+ * elements.
+ int j;
+ for(j = i; j < MAXLISTEN; j++)
+ Assert(ListenSocket[i] == PGINVALID_SOCKET);
/* If using syslogger, close the read side of the pipe */
Sent via pgsql-hackers mailing list (firstname.lastname@example.org)
To make changes to your subscription: