pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Heikki Linnakangas <heikki.linnakangas@iki.fi>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Refactor ListenSocket array.
Date: Thu, 05 Oct 2023 12:08:35 +0000
Message-ID: <E1qoN9e-0009uO-Qd@gemulon.postgresql.org> (raw)

Refactor ListenSocket array.

Keep track of the used size of the array. That avoids looping through
the whole array in a few places. It doesn't matter from a performance
point of view since the array is small anyway, but this feels less
surprising and is a little less code. Now that we have an explicit
NumListenSockets variable that is statically initialized to 0, we
don't need the loop to initialize the array.

Allocate the array in PostmasterContext. The array isn't needed in
child processes, so this allows reusing that memory. We could easily
make the array resizable now, but we haven't heard any complaints
about the current 64 sockets limit.

Discussion: https://www.postgresql.org/message-id/7bb7ad65-a018-2419-742f-fa5fd877d338@iki.fi

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/e29c46439511a2ba8b447079f2308384a4228c92

Modified Files
--------------
src/backend/libpq/pqcomm.c          | 20 ++++------
src/backend/postmaster/postmaster.c | 79 +++++++++++++++----------------------
src/include/libpq/libpq.h           |  2 +-
3 files changed, 40 insertions(+), 61 deletions(-)



Message-ID: <E1qoN9e-0009uO-Qd@gemulon.postgresql.org>
Permalink:  ../E1qoN9e-0009uO-Qd@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1qoN9e-0009uO-Qd@gemulon.postgresql.org

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: heikki.linnakangas@iki.fi, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Refactor ListenSocket array.
  In-Reply-To: <E1qoN9e-0009uO-Qd@gemulon.postgresql.org>

* 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