[pgpool-committers: 6705] pgpool: Some code reorganization

Muhammad Usama m.usama at gmail.com
Mon May 4 22:12:56 JST 2020


Some code reorganization

While working on the pcp_stop_pgpool command to implement cluster mode,
I realized that we have a lot of clutter in a few source files. Especially
pool.h header file. So I also did some code reorganization and added a
bunch of new includefiles in the hope to reduce the size of pool.h and
also get rid of too many global functions.

Along the way, I found out there are few other files that need a little
shredding as well, src/main/pgpool_main.c and src/protocol/child.c are at
the top of this wanted to be trimmed list. So as part of this commit.

I have taken a few things related to internal commands
(interface between the child processes can and Pgpool-II main process)
from pgpool_main.c file and moved them into new "src/main/pool_internal_comms.c"

Similarly, src/protocol/child.c had and still has so many functions that do
not fit with the personality of child.c file. So I have moved some of the
stuff related to DB functions info src/protocol/pool_pg_utils.c file.

Having done that I think this is still not enough and we may require another
round ( if someoneis willing to work on it) of a source file reorganization.

Branch
------
master

Details
-------
https://git.postgresql.org/gitweb?p=pgpool2.git;a=commitdiff;h=3c68ae5a36814349b42e279628e54106a9ab2483
Author: Muhammad Usama <m.usama at highgo.ca>

Modified Files
--------------
src/Makefile.am                                    |   2 +
src/Makefile.in                                    |  33 +-
src/auth/auth-scram.c                              |   3 +-
src/auth/pool_auth.c                               | 195 +-----
src/auth/pool_hba.c                                |  33 +-
src/config/pool_config_variables.c                 |   1 +
src/context/pool_process_context.c                 |   1 +
src/context/pool_query_context.c                   |   6 +-
src/context/pool_session_context.c                 |   5 +-
src/include/auth/md5.h                             |   4 +-
src/include/auth/pool_auth.h                       |  33 +
src/include/context/pool_process_context.h         |   6 +-
src/include/main/health_check.h                    |  50 ++
src/include/main/pool_internal_comms.h             |  46 ++
src/include/pcp/pcp.h                              |   2 +-
src/include/pcp/pcp_stream.h                       |   2 +-
src/include/pcp/pcp_worker.h                       |  32 +
src/include/pcp/recovery.h                         |  30 +
src/include/pool.h                                 | 372 ++----------
src/include/protocol/pool_connection_pool.h        |  40 ++
src/include/protocol/pool_pg_utils.h               |  56 ++
src/include/protocol/pool_process_query.h          |  86 +++
src/include/protocol/pool_proto_modules.h          |  15 +
src/include/utils/elog.h                           |   2 +
src/include/utils/pool_ip.h                        |   4 +-
src/include/utils/pool_ipc.h                       |   5 +
src/include/utils/pool_params.h                    |  39 ++
src/include/utils/pool_signal.h                    |   1 +
src/include/utils/pool_ssl.h                       |  81 +++
src/include/utils/ps_status.h                      |  37 ++
src/include/utils/socket_stream.h                  |   2 +-
src/include/utils/statistics.h                     |  30 +
src/include/watchdog/wd_commands.h                 |   2 +-
src/libs/pcp/Makefile.am                           |   2 +-
src/main/health_check.c                            |  10 +-
src/main/main.c                                    |  12 +-
src/main/pgpool_main.c                             | 398 +------------
src/main/pool_internal_comms.c                     | 446 ++++++++++++++
src/pcp_con/pcp_child.c                            |   5 +
src/pcp_con/pcp_worker.c                           |  53 +-
src/pcp_con/recovery.c                             |  12 +-
src/protocol/CommandComplete.c                     |   1 +
src/protocol/child.c                               | 661 +--------------------
src/protocol/pool_connection_pool.c                |  40 +-
src/protocol/pool_pg_utils.c                       | 647 ++++++++++++++++++++
src/protocol/pool_process_query.c                  |  12 +-
src/protocol/pool_proto_modules.c                  | 201 ++++++-
src/query_cache/pool_memqcache.c                   |   4 +
src/rewrite/pool_lobj.c                            |   1 +
src/rewrite/pool_timestamp.c                       |   2 +
src/streaming_replication/pool_worker_child.c      |  12 +-
.../tests/010.rewrite_timestamp/timestamp/main.c   |   3 +
src/utils/pool_params.c                            |   3 +-
src/utils/pool_process_reporting.c                 |   3 +
src/utils/pool_relcache.c                          |   3 +
src/utils/pool_select_walker.c                     |   1 +
src/utils/pool_signal.c                            |   2 +-
src/utils/pool_ssl.c                               |  12 +-
src/utils/pool_stream.c                            |   4 +-
src/utils/ps_status.c                              |   6 +-
src/utils/statistics.c                             |   3 +-
src/watchdog/watchdog.c                            |  19 +-
src/watchdog/wd_escalation.c                       |   3 +-
src/watchdog/wd_heartbeat.c                        |   5 +-
src/watchdog/wd_internal_commands.c                |   8 +-
src/watchdog/wd_lifecheck.c                        |   2 +
src/watchdog/wd_ping.c                             |   1 +
67 files changed, 2169 insertions(+), 1684 deletions(-)



More information about the pgpool-committers mailing list