[pgpool-committers: 6830] pgpool: Fix for log messages from child processes printing the main pro

Muhammad Usama m.usama at gmail.com
Fri Jul 3 03:11:19 JST 2020


Fix for log messages from child processes printing the main process's PID

The issue was caused by my log collector commit. And the reason was: as part of
the log collector implementation, I added a new global variable myProcPid to hold
to the process PID so that we can avoid calling getpid() function every time
during the construction of the log message.

The change was meant to increase the performance but unfortunately I missed
setting the myProcPid variable after fork() at one of the places.
(After forking the pgpool child process).

So to make sure we can avoid such mistakes in the future, I also did a little bit
of refactoring as part of this fix and created a new function that sets all
process-related global variables (process_application_name, myProcPid and
processType) so that we have a single place to add/modify such stuff.

Apart from that, I have made a few changes in functions for setting the
process_application_name and moved them to pool_globasl.c from pgpool_main.c

Branch
------
master

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

Modified Files
--------------
src/include/pool.h             | 12 ++++--
src/main/main.c                |  5 ++-
src/main/pgpool_logger.c       |  3 +-
src/main/pgpool_main.c         | 97 ++----------------------------------------
src/main/pool_globals.c        | 84 +++++++++++++++++++++++++++++++++++-
src/pcp_con/pcp_child.c        | 10 +----
src/protocol/child.c           |  2 -
src/tools/pgenc/Makefile.am    |  8 +---
src/tools/pgenc/Makefile.in    | 17 +++-----
src/tools/pgmd5/Makefile.am    |  8 +---
src/tools/pgmd5/Makefile.in    | 12 ++----
src/tools/watchdog/Makefile.am |  5 +--
src/tools/watchdog/Makefile.in |  7 +--
src/watchdog/watchdog.c        |  5 +--
src/watchdog/wd_escalation.c   |  8 +---
src/watchdog/wd_heartbeat.c    |  8 +---
src/watchdog/wd_if.c           |  4 +-
src/watchdog/wd_lifecheck.c    |  6 +--
src/watchdog/wd_ping.c         |  5 +--
19 files changed, 122 insertions(+), 184 deletions(-)



More information about the pgpool-committers mailing list