pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Robert Haas <rhaas@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Move some code from src/bin/scripts to src/fe_utils to permit re
Date: Fri, 05 Feb 2021 18:54:06 +0000
Message-ID: <E1l86F4-0000lk-Eg@gemulon.postgresql.org> (raw)

Move some code from src/bin/scripts to src/fe_utils to permit reuse.

The parallel slots infrastructure (which implements client-side
multiplexing of server connections doing similar things, not
threading or multiple processes or anything like that) are moved from
src/bin/scripts/scripts_parallel.c to src/fe_utils/parallel_slot.c.

The functions consumeQueryResult() and processQueryResult() which were
previously part of src/bin/scripts/common.c are now moved into that
file as well, becoming static helper functions. This might need to be
changed in the future, but currently they're not used for anything
else.

Some other functions from src/bin/scripts/common.c are moved to to
src/fe_utils and are split up among several files.  connectDatabase(),
connectMaintenanceDatabase(), and disconnectDatabase() are moved to
connect_utils.c.  executeQuery(), executeCommand(), and
executeMaintenanceCommand() are move to query_utils.c.
handle_help_version_opts() is moved to option_utils.c.

Mark Dilger, reviewed by me. The larger patch series of which this is
a part has also had review from Peter Geoghegan, Andres Freund, Álvaro
Herrera, Michael Paquier, and Amul Sul, but I don't know whether any
of them have reviewed this bit specifically.

Discussion: http://postgr.es/m/12ED3DA8-25F0-4B68-937D-D907CFBF08E7@enterprisedb.com
Discussion: http://postgr.es/m/5F743835-3399-419C-8324-2D424237E999@enterprisedb.com
Discussion: http://postgr.es/m/70655DF3-33CE-4527-9A4D-DDEB582B6BA0@enterprisedb.com

Branch
------
master

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

Modified Files
--------------
src/bin/scripts/Makefile                           |   6 +-
src/bin/scripts/clusterdb.c                        |   2 +
src/bin/scripts/common.c                           | 318 +--------------------
src/bin/scripts/common.h                           |  49 +---
src/bin/scripts/createdb.c                         |   1 +
src/bin/scripts/createuser.c                       |   1 +
src/bin/scripts/dropdb.c                           |   1 +
src/bin/scripts/dropuser.c                         |   1 +
src/bin/scripts/nls.mk                             |   2 +-
src/bin/scripts/pg_isready.c                       |   1 +
src/bin/scripts/reindexdb.c                        |   4 +-
src/bin/scripts/vacuumdb.c                         |   4 +-
src/fe_utils/Makefile                              |   4 +
src/fe_utils/connect_utils.c                       | 181 ++++++++++++
src/fe_utils/option_utils.c                        |  38 +++
.../parallel_slot.c}                               |  63 +++-
src/fe_utils/query_utils.c                         |  92 ++++++
src/include/fe_utils/connect_utils.h               |  48 ++++
src/include/fe_utils/option_utils.h                |  23 ++
.../fe_utils/parallel_slot.h}                      |  13 +-
src/include/fe_utils/query_utils.h                 |  26 ++
src/tools/msvc/Mkvcbuild.pm                        |   5 +-
22 files changed, 498 insertions(+), 385 deletions(-)



Message-ID: <E1l86F4-0000lk-Eg@gemulon.postgresql.org>
Permalink:  ../E1l86F4-0000lk-Eg@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1l86F4-0000lk-Eg@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 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-committers@postgresql.org
  Cc: rhaas@postgresql.org
  Subject: Re: pgsql: Move some code from src/bin/scripts to src/fe_utils to permit re
  In-Reply-To: <E1l86F4-0000lk-Eg@gemulon.postgresql.org>
  References: <E1l86F4-0000lk-Eg@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